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:
@@ -153,6 +153,12 @@ namespace Game.Entities
|
|||||||
if (m_model != null)
|
if (m_model != null)
|
||||||
if (GetMap().ContainsGameObjectModel(m_model))
|
if (GetMap().ContainsGameObjectModel(m_model))
|
||||||
GetMap().RemoveGameObjectModel(m_model);
|
GetMap().RemoveGameObjectModel(m_model);
|
||||||
|
|
||||||
|
// If linked trap exists, despawn it
|
||||||
|
GameObject linkedTrap = GetLinkedTrap();
|
||||||
|
if (linkedTrap != null)
|
||||||
|
linkedTrap.DespawnOrUnsummon();
|
||||||
|
|
||||||
base.RemoveFromWorld();
|
base.RemoveFromWorld();
|
||||||
|
|
||||||
if (m_spawnId != 0)
|
if (m_spawnId != 0)
|
||||||
@@ -938,11 +944,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void Delete()
|
public void Delete()
|
||||||
{
|
{
|
||||||
// If nearby linked trap exists, despawn it
|
|
||||||
GameObject linkedTrap = GetLinkedTrap();
|
|
||||||
if (linkedTrap != null)
|
|
||||||
linkedTrap.DespawnOrUnsummon();
|
|
||||||
|
|
||||||
SetLootState(LootState.NotReady);
|
SetLootState(LootState.NotReady);
|
||||||
RemoveFromOwner();
|
RemoveFromOwner();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user