mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 22:15:34 +00:00
Stop walking for water and flying creatures after single stuck
This commit is contained in:
parent
a65f60e1f1
commit
287433efa8
1 changed files with 11 additions and 1 deletions
|
@ -47,6 +47,16 @@ namespace MWMechanics
|
|||
std::string("idle9"),
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
inline int getCountBeforeReset(const MWWorld::ConstPtr& actor)
|
||||
{
|
||||
if (actor.getClass().isPureWaterCreature(actor) || actor.getClass().isPureFlyingCreature(actor))
|
||||
return 1;
|
||||
return COUNT_BEFORE_RESET;
|
||||
}
|
||||
}
|
||||
|
||||
AiWander::AiWander(int distance, int duration, int timeOfDay, const std::vector<unsigned char>& idle, bool repeat):
|
||||
mDistance(distance), mDuration(duration), mRemainingDuration(duration), mTimeOfDay(timeOfDay), mIdle(idle),
|
||||
mRepeat(repeat), mStoredInitialActorPosition(false), mInitialActorPosition(osg::Vec3f(0, 0, 0)),
|
||||
|
@ -493,7 +503,7 @@ namespace MWMechanics
|
|||
}
|
||||
|
||||
// if stuck for sufficiently long, act like current location was the destination
|
||||
if (storage.mStuckCount >= COUNT_BEFORE_RESET) // something has gone wrong, reset
|
||||
if (storage.mStuckCount >= getCountBeforeReset(actor)) // something has gone wrong, reset
|
||||
{
|
||||
mObstacleCheck.clear();
|
||||
stopWalking(actor, storage);
|
||||
|
|
Loading…
Reference in a new issue