aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d1c80e1a52a..9fc455bdf8e 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -124,6 +124,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_respawnDelayTime = 300;
m_despawnDelay = 0;
m_despawnRespawnTime = 0s;
+ m_restockTime = 0;
m_lootState = GO_NOT_READY;
m_spawnedByDefault = true;
m_usetimes = 0;
@@ -906,9 +907,9 @@ void GameObject::Update(uint32 diff)
loot.clear();
- // Do not delete gameobjects that are not consumed on loot, while still allowing them to despawn when they expire if summoned
+ // Do not delete chests or goobers that are not consumed on loot, while still allowing them to despawn when they expire if summoned
bool isSummonedAndExpired = (GetOwner() || GetSpellId()) && m_respawnTime == 0;
- if (!GetGOInfo()->IsDespawnAtAction() && !isSummonedAndExpired)
+ if ((GetGoType() == GAMEOBJECT_TYPE_CHEST || GetGoType() == GAMEOBJECT_TYPE_GOOBER) && !GetGOInfo()->IsDespawnAtAction() && !isSummonedAndExpired)
{
if (GetGoType() == GAMEOBJECT_TYPE_CHEST && GetGOInfo()->chest.chestRestockTime > 0)
{
@@ -922,10 +923,11 @@ void GameObject::Update(uint32 diff)
UpdateObjectVisibility();
return;
}
- else if (GetOwner() || GetSpellId())
+ else if (!GetOwnerGUID().IsEmpty() || GetSpellId())
{
SetRespawnTime(0);
Delete();
+ return;
}
SetLootState(GO_NOT_READY);