fix hardcoded melee attack ranges

pull/35/head
mrcheko 9 years ago
parent 05794505c8
commit 8d4f0660ce

@ -54,11 +54,11 @@ namespace MWMechanics
AiCombatStorage():
mAttackCooldown(0),
mTimerReact(0),
mTimerReact(AI_REACTION_TIME),
mTimerCombatMove(0),
mReadyToAttack(false),
mAttack(false),
mAttackRange(200), // default attack range (same as in Creature::Hit)
mAttackRange(0),
mCombatMove(false),
mLastTargetPos(0,0,0),
mCell(NULL),
@ -159,8 +159,11 @@ namespace MWMechanics
|| target.getClass().getCreatureStats(target).isDead())
return true;
//Update every frame
storage.mReadyToAttack = pathTo(actor, target.getRefData().getPosition().pos, duration, storage.mAttackRange);
if (storage.mCurrentAction.get()) // need to wait to init action with it's attack range
{
//Update every frame
storage.mReadyToAttack = pathTo(actor, target.getRefData().getPosition().pos, duration, storage.mAttackRange);
}
storage.updateCombatMove(duration);
if (storage.mReadyToAttack) updateActorsMovement(actor, duration, storage);

@ -44,7 +44,8 @@ float suggestCombatRange(int rangeTypes)
{
if (rangeTypes & Touch)
{
return 100.f;
static const float fCombatDistance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fCombatDistance")->getFloat();
return fCombatDistance;
}
else if (rangeTypes & Target)
{

Loading…
Cancel
Save