mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
fix hardcoded melee attack ranges
This commit is contained in:
parent
05794505c8
commit
8d4f0660ce
@ -54,11 +54,11 @@ namespace MWMechanics
|
|||||||
|
|
||||||
AiCombatStorage():
|
AiCombatStorage():
|
||||||
mAttackCooldown(0),
|
mAttackCooldown(0),
|
||||||
mTimerReact(0),
|
mTimerReact(AI_REACTION_TIME),
|
||||||
mTimerCombatMove(0),
|
mTimerCombatMove(0),
|
||||||
mReadyToAttack(false),
|
mReadyToAttack(false),
|
||||||
mAttack(false),
|
mAttack(false),
|
||||||
mAttackRange(200), // default attack range (same as in Creature::Hit)
|
mAttackRange(0),
|
||||||
mCombatMove(false),
|
mCombatMove(false),
|
||||||
mLastTargetPos(0,0,0),
|
mLastTargetPos(0,0,0),
|
||||||
mCell(NULL),
|
mCell(NULL),
|
||||||
@ -159,8 +159,11 @@ namespace MWMechanics
|
|||||||
|| target.getClass().getCreatureStats(target).isDead())
|
|| target.getClass().getCreatureStats(target).isDead())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Update every frame
|
if (storage.mCurrentAction.get()) // need to wait to init action with it's attack range
|
||||||
storage.mReadyToAttack = pathTo(actor, target.getRefData().getPosition().pos, duration, storage.mAttackRange);
|
{
|
||||||
|
//Update every frame
|
||||||
|
storage.mReadyToAttack = pathTo(actor, target.getRefData().getPosition().pos, duration, storage.mAttackRange);
|
||||||
|
}
|
||||||
|
|
||||||
storage.updateCombatMove(duration);
|
storage.updateCombatMove(duration);
|
||||||
if (storage.mReadyToAttack) updateActorsMovement(actor, duration, storage);
|
if (storage.mReadyToAttack) updateActorsMovement(actor, duration, storage);
|
||||||
|
@ -44,7 +44,8 @@ float suggestCombatRange(int rangeTypes)
|
|||||||
{
|
{
|
||||||
if (rangeTypes & Touch)
|
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)
|
else if (rangeTypes & Target)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user