From 863455736eebf6b6f212b352eaa27fc174e3a533 Mon Sep 17 00:00:00 2001 From: patou01 <2592673+patou01@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:38:59 +0100 Subject: [PATCH] fix(core/Creature): initialize AI before calling OnCreatureCreate --- src/server/game/Entities/Creature/Creature.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 958bf061d..d6718fe19 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -222,13 +222,11 @@ void Creature::AddToWorld() // it's also initialized in AIM_Initialize(), few lines below, but it's not a problem Motion_Initialize(); - if (GetZoneScript()) - GetZoneScript()->OnCreatureCreate(this); - GetMap()->GetObjectsStore().Insert(GetGUID(), this); if (m_spawnId) + { GetMap()->GetCreatureBySpawnIdStore().insert(std::make_pair(m_spawnId, this)); - + } Unit::AddToWorld(); SearchFormation(); @@ -236,7 +234,14 @@ void Creature::AddToWorld() AIM_Initialize(); if (IsVehicle()) + { GetVehicleKit()->Install(); + } + + if (GetZoneScript()) + { + GetZoneScript()->OnCreatureCreate(this); + } #ifdef ELUNA sEluna->OnAddToWorld(this);