Core/AI: Add a new LeavingWorld AI hook

This commit is contained in:
Treeston
2018-06-26 12:15:57 +02:00
parent d4beeb875f
commit c0a7274ff1
2 changed files with 6 additions and 0 deletions

View File

@@ -283,6 +283,9 @@ class TC_GAME_API UnitAI
// Called when the unit leaves combat
virtual void JustExitedCombat() { }
// Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing, player logging out etc.)
virtual void LeavingWorld() { }
// Called at any Damage to any victim (before damage apply)
virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { }

View File

@@ -9424,6 +9424,9 @@ void Unit::RemoveFromWorld()
if (IsInWorld())
{
m_duringRemoveFromWorld = true;
if (IsAIEnabled)
GetAI()->LeavingWorld();
if (IsVehicle())
RemoveVehicleKit();