mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 08:06:45 +00:00
Check whether can actor move along z-axis in separate function
This commit is contained in:
parent
bbd82a743a
commit
92b34e8bb4
2 changed files with 10 additions and 6 deletions
|
@ -129,12 +129,7 @@ bool MWMechanics::AiPackage::pathTo(const MWWorld::Ptr& actor, const osg::Vec3f&
|
||||||
|
|
||||||
const bool wasShortcutting = mIsShortcutting;
|
const bool wasShortcutting = mIsShortcutting;
|
||||||
bool destInLOS = false;
|
bool destInLOS = false;
|
||||||
|
const bool actorCanMoveByZ = canActorMoveByZAxis(actor);
|
||||||
const MWWorld::Class& actorClass = actor.getClass();
|
|
||||||
|
|
||||||
// check if actor can move along z-axis
|
|
||||||
bool actorCanMoveByZ = (actorClass.canSwim(actor) && world->isSwimming(actor))
|
|
||||||
|| world->isFlying(actor);
|
|
||||||
|
|
||||||
// Prohibit shortcuts for AiWander, if the actor can not move in 3 dimensions.
|
// Prohibit shortcuts for AiWander, if the actor can not move in 3 dimensions.
|
||||||
if (actorCanMoveByZ)
|
if (actorCanMoveByZ)
|
||||||
|
@ -418,3 +413,10 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MWMechanics::AiPackage::canActorMoveByZAxis(const MWWorld::Ptr& actor) const
|
||||||
|
{
|
||||||
|
const auto world = MWBase::Environment::get().getWorld();
|
||||||
|
const auto& actorClass = actor.getClass();
|
||||||
|
return (actorClass.canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor);
|
||||||
|
}
|
||||||
|
|
|
@ -134,6 +134,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
DetourNavigator::Flags getNavigatorFlags(const MWWorld::Ptr& actor) const;
|
DetourNavigator::Flags getNavigatorFlags(const MWWorld::Ptr& actor) const;
|
||||||
|
|
||||||
|
bool canActorMoveByZAxis(const MWWorld::Ptr& actor) const;
|
||||||
|
|
||||||
// TODO: all this does not belong here, move into temporary storage
|
// TODO: all this does not belong here, move into temporary storage
|
||||||
PathFinder mPathFinder;
|
PathFinder mPathFinder;
|
||||||
ObstacleCheck mObstacleCheck;
|
ObstacleCheck mObstacleCheck;
|
||||||
|
|
Loading…
Reference in a new issue