Core/Objects: Move EventProcessor update to WorldObject::Update

This commit is contained in:
Shauren
2023-02-05 16:24:13 +01:00
parent 56d0f7a970
commit b6965b2c30
5 changed files with 17 additions and 7 deletions

View File

@@ -447,6 +447,10 @@ class CreatureGameObjectAreaTriggerScriptRegistrySwapHooks
// Hook which is called before a gameobject is swapped
static void UnloadResetScript(GameObject* gameobject)
{
// Remove deletable events only,
// otherwise it causes crashes with non-deletable spell events.
gameobject->m_Events.KillAllEvents(false);
gameobject->AI()->Reset();
}
@@ -461,6 +465,10 @@ class CreatureGameObjectAreaTriggerScriptRegistrySwapHooks
// Hook which is called before a areatrigger is swapped
static void UnloadResetScript(AreaTrigger* at)
{
// Remove deletable events only,
// otherwise it causes crashes with non-deletable spell events.
at->m_Events.KillAllEvents(false);
at->AI()->OnRemove();
}