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

Port From (https://github.com/TrinityCore/TrinityCore/commit/88b898b92c9b2cc885b4c7371192a8aef9ebda85)
This commit is contained in:
hondacrx
2022-02-18 13:26:17 -05:00
parent 5d8b77b440
commit 6cc694f990
@@ -153,6 +153,12 @@ namespace Game.Entities
if (m_model != null)
if (GetMap().ContainsGameObjectModel(m_model))
GetMap().RemoveGameObjectModel(m_model);
// If linked trap exists, despawn it
GameObject linkedTrap = GetLinkedTrap();
if (linkedTrap != null)
linkedTrap.DespawnOrUnsummon();
base.RemoveFromWorld();
if (m_spawnId != 0)
@@ -938,11 +944,6 @@ namespace Game.Entities
public void Delete()
{
// If nearby linked trap exists, despawn it
GameObject linkedTrap = GetLinkedTrap();
if (linkedTrap != null)
linkedTrap.DespawnOrUnsummon();
SetLootState(LootState.NotReady);
RemoveFromOwner();