1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 10:45:32 +00:00
Though it still can happen sometimes but not in such stupid manner.
This commit is contained in:
mrcheko 2014-05-25 13:31:46 +04:00
parent 559c772906
commit c62187bd55

View file

@ -330,7 +330,7 @@ namespace MWMechanics
bool isStuck = false; bool isStuck = false;
float speed = 0.0f; float speed = 0.0f;
if(mMovement.mPosition[1] && (Ogre::Vector3(mLastPos.pos) - vActorPos).length() < (speed = actorCls.getSpeed(actor)) / 10.0f) if(mMovement.mPosition[1] && (Ogre::Vector3(mLastPos.pos) - vActorPos).length() < (speed = actorCls.getSpeed(actor)) * tReaction / 2)
isStuck = true; isStuck = true;
mLastPos = pos; mLastPos = pos;
@ -398,13 +398,9 @@ namespace MWMechanics
bool preferShortcut = false; bool preferShortcut = false;
bool inLOS = MWBase::Environment::get().getWorld()->getLOS(actor, target); bool inLOS = MWBase::Environment::get().getWorld()->getLOS(actor, target);
if(mReadyToAttack) isStuck = false;
// check if shortcut is available // check if shortcut is available
if(!isStuck if(inLOS && (!isStuck || mReadyToAttack)
&& (!mForceNoShortcut && (!mForceNoShortcut || (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST))
|| (Ogre::Vector3(mShortcutFailPos.pos) - vActorPos).length() >= PATHFIND_SHORTCUT_RETRY_DIST)
&& inLOS)
{ {
if(speed == 0.0f) speed = actorCls.getSpeed(actor); if(speed == 0.0f) speed = actorCls.getSpeed(actor);
// maximum dist before pit/obstacle for actor to avoid them depending on his speed // maximum dist before pit/obstacle for actor to avoid them depending on his speed
@ -467,7 +463,7 @@ namespace MWMechanics
mReadyToAttack = false; mReadyToAttack = false;
} }
if(distToTarget > rangeAttack && !distantCombat) if(!isStuck && distToTarget > rangeAttack && !distantCombat)
{ {
//special run attack; it shouldn't affect melee combat tactics //special run attack; it shouldn't affect melee combat tactics
if(actorCls.getMovementSettings(actor).mPosition[1] == 1) if(actorCls.getMovementSettings(actor).mPosition[1] == 1)