Skip to content

Commit

Permalink
Pet: Tryfix double unsummon crash due to visibility
Browse files Browse the repository at this point in the history
Close #508

Credit @insunaa for the general idea
  • Loading branch information
killerwife committed Mar 14, 2024
1 parent 6202f30 commit faa3d96
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/game/Entities/Pet.cpp
Expand Up @@ -2441,7 +2441,17 @@ void Pet::ForcedDespawn(uint32 timeMSToDespawn, bool onlyAlive)
if (IsAlive())
SetDeathState(JUST_DIED);

RemoveCorpse(true); // force corpse removal in the same grid
if (GetDeathState() == CORPSE) // rest of despawn cleanup meant to be done by Unsummon
{
if (AI())
{
uint32 respawnDelay = 0;
AI()->CorpseRemoved(respawnDelay);
}

if (InstanceData* mapInstance = GetInstanceData())
mapInstance->OnCreatureDespawn(this);
}

Unsummon(PET_SAVE_NOT_IN_SLOT, owner);
}
Expand Down

0 comments on commit faa3d96

Please sign in to comment.