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

Co-authored-by: Treeston <treeston.mmoc@gmail.com>
This commit is contained in:
Andrew 2026-08-24 20:20:47 -03:00 committed by GitHub
parent ca8e6d78de
commit cf2c99f8a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

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)
*/

View file

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