mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 03:42:37 +01:00
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
(cherry picked from commit 7e9bc9599b)
This commit is contained in:
@@ -247,6 +247,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)
|
||||
@@ -1030,10 +1034,6 @@ void GameObject::DespawnOrUnsummon(Milliseconds delay, Seconds forceRespawnTime)
|
||||
|
||||
void GameObject::Delete()
|
||||
{
|
||||
// If nearby linked trap exists, despawn it
|
||||
if (GameObject* linkedTrap = GetLinkedTrap())
|
||||
linkedTrap->DespawnOrUnsummon();
|
||||
|
||||
SetLootState(GO_NOT_READY);
|
||||
RemoveFromOwner();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user