1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

fix hardcoded melee attack ranges

This commit is contained in:
mrcheko 2016-07-12 00:17:43 +03:00
parent 05794505c8
commit 8d4f0660ce
2 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -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)
{