mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
feat(Core/AI): add the UnitAI::OnDespawn hook (#27285)
Co-authored-by: Treeston <[email protected]>
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user