mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 15:15:31 +00:00
fix hardcoded melee attack ranges
This commit is contained in:
parent
05794505c8
commit
8d4f0660ce
2 changed files with 9 additions and 5 deletions
|
@ -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…
Reference in a new issue