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

Port From (https://github.com/TrinityCore/TrinityCore/commit/b6965b2c30eb3317228b328a0c1da71235d7c257)
This commit is contained in:
hondacrx
2023-02-12 01:23:08 -05:00
parent 42f94c354f
commit 1ed5fadf4d
3 changed files with 11 additions and 8 deletions
@@ -391,8 +391,6 @@ namespace Game.Entities
public override void Update(uint diff) public override void Update(uint diff)
{ {
m_Events.Update(diff);
base.Update(diff); base.Update(diff);
if (GetAI() != null) if (GetAI() != null)
+9 -2
View File
@@ -955,6 +955,12 @@ namespace Game.Entities
return false; return false;
} }
public virtual void Update(uint diff)
{
m_Events.Update(diff);
}
public void SetWorldObject(bool on) public void SetWorldObject(bool on)
{ {
if (!IsInWorld) if (!IsInWorld)
@@ -962,6 +968,7 @@ namespace Game.Entities
GetMap().AddObjectToSwitchList(this, on); GetMap().AddObjectToSwitchList(this, on);
} }
public void SetActive(bool on) public void SetActive(bool on)
{ {
if (m_isActive == on) if (m_isActive == on)
@@ -1034,6 +1041,8 @@ namespace Game.Entities
ITransport transport = GetTransport(); ITransport transport = GetTransport();
if (transport != null) if (transport != null)
transport.RemovePassenger(this); 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; } public uint GetZoneId() { return m_zoneId; }
@@ -3080,8 +3089,6 @@ namespace Game.Entities
public Conversation ToConversation() { return IsConversation() ? (this as Conversation) : null; } public Conversation ToConversation() { return IsConversation() ? (this as Conversation) : null; }
public SceneObject ToSceneObject() { return IsSceneObject() ? (this as SceneObject) : 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 virtual uint GetLevelForTarget(WorldObject target) { return 1; }
public ZoneScript GetZoneScript() { return m_zoneScript; } public ZoneScript GetZoneScript() { return m_zoneScript; }
+2 -4
View File
@@ -120,15 +120,13 @@ namespace Game.Entities
{ {
// WARNING! Order of execution here is important, do not change. // WARNING! Order of execution here is important, do not change.
// Spells must be processed with event system BEFORE they go to _UpdateSpells. // Spells must be processed with event system BEFORE they go to _UpdateSpells.
m_Events.Update(diff); base.Update(diff);
if (!IsInWorld) if (!IsInWorld)
return; return;
_UpdateSpells(diff); _UpdateSpells(diff);
base.Update(diff);
// If this is set during update SetCantProc(false) call is missing somewhere in the code // 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 // Having this would prevent spells from being proced, so let's crash
Cypher.Assert(m_procDeep == 0); Cypher.Assert(m_procDeep == 0);
@@ -527,9 +525,9 @@ namespace Game.Entities
if (finalCleanup) if (finalCleanup)
m_cleanupDone = true; 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(); CombatStop();
} }
public override void CleanupsBeforeDelete(bool finalCleanup = true) public override void CleanupsBeforeDelete(bool finalCleanup = true)
{ {
CleanupBeforeRemoveFromMap(finalCleanup); CleanupBeforeRemoveFromMap(finalCleanup);