1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:19:57 +00:00
openmw-tes3mp/apps/openmw/mwmechanics/actorutil.cpp

33 lines
917 B
C++
Raw Normal View History

2015-08-21 09:12:39 +00:00
#include "actorutil.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/class.hpp"
2015-09-10 06:48:34 +00:00
#include "../mwworld/player.hpp"
2015-08-21 09:12:39 +00:00
namespace MWMechanics
{
MWWorld::Ptr getPlayer()
{
return MWBase::Environment::get().getWorld()->getPlayerPtr();
}
2015-09-10 06:48:34 +00:00
bool isPlayerInCombat()
{
return MWBase::Environment::get().getWorld()->getPlayer().isInCombat();
}
bool canActorMoveByZAxis(const MWWorld::Ptr& actor)
{
MWBase::World* world = MWBase::Environment::get().getWorld();
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;
}
2015-08-21 09:12:39 +00:00
}