Core/Scripting: Delay zone script's OnCreatureCreate until the creature has been added to map stores

Port From (https://github.com/TrinityCore/TrinityCore/commit/d57e74b3b592536ffd32a92a342eb0abc6e05e62)
This commit is contained in:
hondacrx
2021-11-02 14:22:09 -04:00
parent d76e1918aa
commit dad2f6c5a5
+3 -3
View File
@@ -63,9 +63,6 @@ namespace Game.Entities
// Register the creature for guid lookup // Register the creature for guid lookup
if (!IsInWorld) if (!IsInWorld)
{ {
if (m_zoneScript != null)
m_zoneScript.OnCreatureCreate(this);
GetMap().GetObjectsStore().Add(GetGUID(), this); GetMap().GetObjectsStore().Add(GetGUID(), this);
if (m_spawnId != 0) if (m_spawnId != 0)
GetMap().GetCreatureBySpawnIdStore().Add(m_spawnId, this); GetMap().GetCreatureBySpawnIdStore().Add(m_spawnId, this);
@@ -75,6 +72,9 @@ namespace Game.Entities
InitializeAI(); InitializeAI();
if (IsVehicle()) if (IsVehicle())
GetVehicleKit().Install(); GetVehicleKit().Install();
if (m_zoneScript != null)
m_zoneScript.OnCreatureCreate(this);
} }
} }