mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Allow water walking actors to find path over water surface
This commit is contained in:
parent
634556be9d
commit
28fc21792e
3 changed files with 9 additions and 1 deletions
|
@ -23,4 +23,10 @@ namespace MWMechanics
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
return (actor.getClass().canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor);
|
return (actor.getClass().canSwim(actor) && world->isSwimming(actor)) || world->isFlying(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasWaterWalking(const MWWorld::Ptr& actor)
|
||||||
|
{
|
||||||
|
const MWMechanics::MagicEffects& effects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
||||||
|
return effects.get(ESM::MagicEffect::WaterWalking).getMagnitude() > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace MWMechanics
|
||||||
MWWorld::Ptr getPlayer();
|
MWWorld::Ptr getPlayer();
|
||||||
bool isPlayerInCombat();
|
bool isPlayerInCombat();
|
||||||
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
||||||
|
bool hasWaterWalking(const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value)
|
void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value)
|
||||||
|
|
|
@ -419,7 +419,8 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::
|
||||||
if (actorClass.isPureWaterCreature(actor)
|
if (actorClass.isPureWaterCreature(actor)
|
||||||
|| (getTypeId() != AiPackageTypeId::Wander
|
|| (getTypeId() != AiPackageTypeId::Wander
|
||||||
&& ((allowToFollowOverWaterSurface && getTypeId() == AiPackageTypeId::Follow)
|
&& ((allowToFollowOverWaterSurface && getTypeId() == AiPackageTypeId::Follow)
|
||||||
|| actorClass.canSwim(actor))))
|
|| actorClass.canSwim(actor)
|
||||||
|
|| hasWaterWalking(actor))))
|
||||||
result |= DetourNavigator::Flag_swim;
|
result |= DetourNavigator::Flag_swim;
|
||||||
|
|
||||||
if (actorClass.canWalk(actor))
|
if (actorClass.canWalk(actor))
|
||||||
|
|
Loading…
Reference in a new issue