Core/AI: Add a new LeavingWorld AI hook
Port From (https://github.com/TrinityCore/TrinityCore/commit/2642fb1a489e4b79a17bbb63127c8b3ce2823e1e)
This commit is contained in:
@@ -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) { }
|
||||
|
||||
@@ -435,6 +435,9 @@ namespace Game.Entities
|
||||
if (IsInWorld)
|
||||
{
|
||||
m_duringRemoveFromWorld = true;
|
||||
if (IsAIEnabled)
|
||||
GetAI().LeavingWorld();
|
||||
|
||||
if (IsVehicle())
|
||||
RemoveVehicleKit(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user