diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 09e2dec440..09da2f3362 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -40,6 +40,8 @@ class TC_GAME_API GameObjectAI virtual void Reset() { } + virtual void JustAppeared() { } + // Pass parameters between AI virtual void DoAction(int32 /*param = 0 */) { } virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id = 0 */) { } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 4b2c9095d3..34864e4242 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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 diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 8b9a265e7d..414fd47630 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -361,5 +361,6 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject GameObjectAI* m_AI; bool m_respawnCompatibilityMode; + bool _triggerJustAppeared; }; #endif