fix(Core/Creature): Allow temp summons to respawn when despawning on … (#21363)

This commit is contained in:
Andrew
2025-02-10 04:46:31 -03:00
committed by GitHub
parent b0a45c98c2
commit 7e29e023e8
6 changed files with 9 additions and 30 deletions

View File

@@ -2198,7 +2198,7 @@ void Creature::DespawnOnEvade(Seconds respawnDelay)
if (TempSummon* whoSummon = ToTempSummon())
{
LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
GetMap()->ScheduleCreatureRespawn(GetGUID(), respawnDelay, GetHomePosition());
whoSummon->UnSummon();
return;
}

View File

@@ -310,13 +310,9 @@ void TempSummon::UnSummon(uint32 msTime)
if (WorldObject* owner = GetSummoner())
{
if (owner->IsCreature() && owner->ToCreature()->IsAIEnabled)
{
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
}
else if (owner->IsGameObject() && owner->ToGameObject()->AI())
{
owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
}
}
AddObjectToRemoveList();