Core/AI: Add a new LeavingWorld AI hook

This commit is contained in:
Treeston authored and Aokromes committed 2018-06-26 14:54:25 +02:00
1 parent 557c212885
commit 60fd73b18c
2 files changed
+6

No files matched your search

+3
View File
@@ -249,6 +249,9 @@ class TC_GAME_API UnitAI
// Called when the unit leaves combat // Called when the unit leaves combat
virtual void JustExitedCombat() { } 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) // Called at any Damage to any victim (before damage apply)
virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { } virtual void DamageDealt(Unit* /*victim*/, uint32& /*damage*/, DamageEffectType /*damageType*/) { }
+3
View File
@@ -10038,6 +10038,9 @@ void Unit::RemoveFromWorld()
if (IsInWorld()) if (IsInWorld())
{ {
m_duringRemoveFromWorld = true; m_duringRemoveFromWorld = true;
if (IsAIEnabled)
GetAI()->LeavingWorld();
if (IsVehicle()) if (IsVehicle())
RemoveVehicleKit(); RemoveVehicleKit();