feat(Core/AI): add the UnitAI::OnDespawn hook (#27285)
Co-authored-by: Treeston <treeston.mmoc@gmail.com>
This commit is contained in:
parent
ca8e6d78de
commit
cf2c99f8a8
2 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12561,6 +12561,9 @@ void Unit::RemoveFromWorld()
|
|||
if (IsInWorld())
|
||||
{
|
||||
m_duringRemoveFromWorld = true;
|
||||
if (IsAIEnabled)
|
||||
GetAI()->OnDespawn();
|
||||
|
||||
if (IsVehicle())
|
||||
RemoveVehicleKit();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue