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

(cherry picked from commit b4a1887c4d)
This commit is contained in:
Treeston
2018-08-29 13:55:49 +02:00
committed by Shauren
parent fd930d4c83
commit d57e74b3b5

View File

@@ -323,9 +323,6 @@ void Creature::AddToWorld()
///- Register the creature for guid lookup
if (!IsInWorld())
{
if (GetZoneScript())
GetZoneScript()->OnCreatureCreate(this);
GetMap()->GetObjectsStore().Insert<Creature>(GetGUID(), this);
if (m_spawnId)
GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this));
@@ -335,6 +332,9 @@ void Creature::AddToWorld()
AIM_Initialize();
if (IsVehicle())
GetVehicleKit()->Install();
if (GetZoneScript())
GetZoneScript()->OnCreatureCreate(this);
}
}