diff options
author | Wyrserth <wyrserth@protonmail.com> | 2019-06-26 18:28:08 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-12-13 00:42:17 +0100 |
commit | 836a1bc62272861a595b339345eb1ac67c543c5b (patch) | |
tree | 728802444deb2c5d21411922289afc6e4c7f8bc5 /src | |
parent | 09e849bb69561fe91a9b8c1aa72555eb6c65d0b2 (diff) |
Core/GameObject: don't allow non-consumable goobers to despawn on use (#23469)
Closes #15730.
(cherry picked from commit 2b1e8d135bd3f3a3ddf7f29471cf6116da223175)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index e37da862727..4ed6f10538e 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -892,23 +892,22 @@ void GameObject::Update(uint32 diff) loot.clear(); - //! If this is summoned by a spell with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD, with or without owner, we check respawn criteria based on speSendObjectDeSpawnAnim(GetGUID());ll - //! The GetOwnerGUID() check is mostly for compatibility with hacky scripts - 99% of the time summoning should be done trough spells. - if (GetSpellId() || !GetOwnerGUID().IsEmpty()) + // Do not delete gameobjects that are not consumed on loot, while still allowing them to despawn when they expire if summoned + bool isSummonedAndExpired = (GetOwner() || GetSpellId()) && m_respawnTime == 0; + bool isPermanentSpawn = m_respawnDelayTime == 0; + if (!GetGOInfo()->IsDespawnAtAction() && + ((GetGoType() == GAMEOBJECT_TYPE_GOOBER && (!isSummonedAndExpired || isPermanentSpawn)) || + (GetGoType() == GAMEOBJECT_TYPE_CHEST && !isSummonedAndExpired))) // ToDo: chests with data2 (chestRestockTime) > 0 and data3 (consumable) = 0 should not despawn on loot { - //Don't delete spell spawned chests, which are not consumed on loot - if (m_respawnTime > 0 && GetGoType() == GAMEOBJECT_TYPE_CHEST && !GetGOInfo()->IsDespawnAtAction()) - { - UpdateObjectVisibility(); - SetLootState(GO_READY); - } - else - { - SetRespawnTime(0); - Delete(); - } + SetLootState(GO_READY); + UpdateObjectVisibility(); return; } + else + { + SetRespawnTime(0); + Delete(); + } SetLootState(GO_NOT_READY); |