diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 7ea7def8d..8d2454a2b 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -391,8 +391,6 @@ namespace Game.Entities public override void Update(uint diff) { - m_Events.Update(diff); - base.Update(diff); if (GetAI() != null) diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index d2f8337df..e8672927a 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -955,6 +955,12 @@ namespace Game.Entities return false; } + + public virtual void Update(uint diff) + { + m_Events.Update(diff); + } + public void SetWorldObject(bool on) { if (!IsInWorld) @@ -962,6 +968,7 @@ namespace Game.Entities GetMap().AddObjectToSwitchList(this, on); } + public void SetActive(bool on) { if (m_isActive == on) @@ -1034,6 +1041,8 @@ namespace Game.Entities ITransport transport = GetTransport(); if (transport != null) transport.RemovePassenger(this); + + m_Events.KillAllEvents(false); // non-delatable (currently cast spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList } public uint GetZoneId() { return m_zoneId; } @@ -3080,8 +3089,6 @@ namespace Game.Entities public Conversation ToConversation() { return IsConversation() ? (this as Conversation) : null; } public SceneObject ToSceneObject() { return IsSceneObject() ? (this as SceneObject) : null; } - public virtual void Update(uint diff) { } - public virtual uint GetLevelForTarget(WorldObject target) { return 1; } public ZoneScript GetZoneScript() { return m_zoneScript; } diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 6205ac989..049121006 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -120,15 +120,13 @@ namespace Game.Entities { // WARNING! Order of execution here is important, do not change. // Spells must be processed with event system BEFORE they go to _UpdateSpells. - m_Events.Update(diff); + base.Update(diff); if (!IsInWorld) return; _UpdateSpells(diff); - base.Update(diff); - // If this is set during update SetCantProc(false) call is missing somewhere in the code // Having this would prevent spells from being proced, so let's crash Cypher.Assert(m_procDeep == 0); @@ -527,9 +525,9 @@ namespace Game.Entities if (finalCleanup) m_cleanupDone = true; - m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map.RemoveAllObjectsInRemoveList CombatStop(); } + public override void CleanupsBeforeDelete(bool finalCleanup = true) { CleanupBeforeRemoveFromMap(finalCleanup);