Core/GameObjects: implement JustAppeared AI hook for gameobjectAI

This commit is contained in:
Ovahlord committed 2020-04-23 14:02:19 +02:00
1 parent 06b983bee2
commit 5c61fcfb19
3 files changed
+13 -1

No files matched your search

@@ -58,7 +58,7 @@ QuaternionData QuaternionData::fromEulerAnglesZYX(float Z, float Y, float X)
}
GameObject::GameObject() : WorldObject(false), MapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false)
m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _triggerJustAppeared(true)
{
m_objectType |= TYPEMASK_GAMEOBJECT;
m_objectTypeId = TYPEID_GAMEOBJECT;
@@ -364,6 +364,12 @@ void GameObject::Update(uint32 diff)
else if (!AIM_Initialize())
TC_LOG_ERROR("misc", "Could not initialize GameObjectAI");
if (AI() && _triggerJustAppeared)
{
_triggerJustAppeared = false;
AI()->JustAppeared();
}
if (m_despawnDelay)
{
if (m_despawnDelay > diff)
@@ -1202,6 +1208,9 @@ void GameObject::Respawn()
m_respawnTime = GameTime::GetGameTime();
GetMap()->Respawn(SPAWN_TYPE_GAMEOBJECT, m_spawnId);
}
if (m_respawnCompatibilityMode)
_triggerJustAppeared = true;
}
bool GameObject::ActivateToQuest(Player* target) const