You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwmechanics/actorutil.cpp

33 lines
917 B
C++

#include "actorutil.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/player.hpp"
namespace MWMechanics
{
MWWorld::Ptr getPlayer()
{
return MWBase::Environment::get().getWorld()->getPlayerPtr();
}
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;
}
}