feat(Core/AI): add the UnitAI::OnDespawn hook (#27285)

Co-authored-by: Treeston <[email protected]>
This commit is contained in:
Andrew
2026-08-24 20:20:47 -03:00
committed by GitHub
co-authored by Treeston
parent ca8e6d78de
commit cf2c99f8a8
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -355,6 +355,11 @@ public:
*/
virtual void JustExitedCombat() { }
/**
* @brief Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing, player logging out etc.)
*/
virtual void OnDespawn() { }
/**
* @brief Called when evade timer expires (target unreachable for too long)
*/
+3
View File
@@ -12561,6 +12561,9 @@ void Unit::RemoveFromWorld()
if (IsInWorld())
{
m_duringRemoveFromWorld = true;
if (IsAIEnabled)
GetAI()->OnDespawn();
if (IsVehicle())
RemoveVehicleKit();