2015-08-21 09:12:39 +00:00
|
|
|
#ifndef OPENMW_MWMECHANICS_ACTORUTIL_H
|
|
|
|
#define OPENMW_MWMECHANICS_ACTORUTIL_H
|
|
|
|
|
2020-06-02 19:59:37 +00:00
|
|
|
#include <components/esm/loadcrea.hpp>
|
|
|
|
#include <components/esm/loadnpc.hpp>
|
|
|
|
|
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
|
|
|
#include "../mwworld/esmstore.hpp"
|
|
|
|
|
|
|
|
#include "./creaturestats.hpp"
|
|
|
|
|
2019-02-18 22:10:55 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
2015-08-21 09:12:39 +00:00
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
2020-05-17 01:06:39 +00:00
|
|
|
enum GreetingState
|
|
|
|
{
|
|
|
|
Greet_None,
|
|
|
|
Greet_InProgress,
|
|
|
|
Greet_Done
|
|
|
|
};
|
|
|
|
|
2015-08-21 09:12:39 +00:00
|
|
|
MWWorld::Ptr getPlayer();
|
2015-09-10 06:48:34 +00:00
|
|
|
bool isPlayerInCombat();
|
2019-06-05 08:40:38 +00:00
|
|
|
bool canActorMoveByZAxis(const MWWorld::Ptr& actor);
|
2020-06-02 19:59:37 +00:00
|
|
|
|
|
|
|
template<class T>
|
|
|
|
void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value)
|
|
|
|
{
|
|
|
|
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
|
|
|
|
switch(setting)
|
|
|
|
{
|
|
|
|
case MWMechanics::CreatureStats::AiSetting::AI_Hello:
|
|
|
|
copy.mAiData.mHello = value;
|
|
|
|
break;
|
|
|
|
case MWMechanics::CreatureStats::AiSetting::AI_Fight:
|
|
|
|
copy.mAiData.mFight = value;
|
|
|
|
break;
|
|
|
|
case MWMechanics::CreatureStats::AiSetting::AI_Flee:
|
|
|
|
copy.mAiData.mFlee = value;
|
|
|
|
break;
|
|
|
|
case MWMechanics::CreatureStats::AiSetting::AI_Alarm:
|
|
|
|
copy.mAiData.mAlarm = value;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
template void setBaseAISetting<ESM::Creature>(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value);
|
|
|
|
template void setBaseAISetting<ESM::NPC>(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value);
|
2015-08-21 09:12:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|