Core/GameObject: Remove linked traps when the main GameObject is remo… (#24480)

* Core/GameObject: Remove linked traps when the main GameObject is removed from from the world

* Indentation
This commit is contained in:
Eridium authored and Ovahlord committed 2020-09-11 15:24:21 +02:00
1 parent e871d2f0eb
commit 2aa05b951b
1 file changed
+4 -4
@@ -248,6 +248,10 @@ void GameObject::RemoveFromWorld()
if (GetMap()->ContainsGameObjectModel(*m_model))
GetMap()->RemoveGameObjectModel(*m_model);
// If linked trap exists, despawn it
if (GameObject* linkedTrap = GetLinkedTrap())
linkedTrap->DespawnOrUnsummon();
WorldObject::RemoveFromWorld();
if (m_spawnId)
@@ -848,10 +852,6 @@ void GameObject::DespawnOrUnsummon(Milliseconds const& delay, Seconds const& for
void GameObject::Delete()
{
// If nearby linked trap exists, despawn it
if (GameObject* linkedTrap = GetLinkedTrap())
linkedTrap->DespawnOrUnsummon();
SetLootState(GO_NOT_READY);
RemoveFromOwner();