Core/AI: Add a new LeavingWorld AI hook

Port From (https://github.com/TrinityCore/TrinityCore/commit/2642fb1a489e4b79a17bbb63127c8b3ce2823e1e)
This commit is contained in:
hondacrx
2021-10-08 10:33:53 -04:00
parent f8990e440b
commit 72018b983c
2 changed files with 7 additions and 0 deletions
+4
View File
@@ -480,6 +480,10 @@ namespace Game.AI
// Called when the unit leaves combat
public virtual void JustExitedCombat() { }
// Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing, player logging out etc.)
public virtual void LeavingWorld() { }
// Called at any Damage to any victim (before damage apply)
public virtual void DamageDealt(Unit victim, ref uint damage, DamageEffectType damageType) { }
public virtual void DamageTaken(Unit attacker, ref uint damage) { }
public virtual void HealReceived(Unit by, uint addhealth) { }
+3
View File
@@ -435,6 +435,9 @@ namespace Game.Entities
if (IsInWorld)
{
m_duringRemoveFromWorld = true;
if (IsAIEnabled)
GetAI().LeavingWorld();
if (IsVehicle())
RemoveVehicleKit(true);