Core/GameObjects: Fix infinite respawning of chest gameobjects that are summoned trough spells with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD

Closes #1618
Closes #2486
This commit is contained in:
Machiavelli
2011-10-08 13:13:09 +02:00
parent 7b0bff3f7b
commit 680fce6fd8

View File

@@ -545,14 +545,12 @@ void GameObject::Update(uint32 diff)
loot.clear();
if (GetOwnerGUID())
//! If this is summoned by a spell with ie. SPELL_EFFECT_SUMMON_OBJECT_WILD, with or without owner, we check respawn criteria based on spell
//! The GetOwnerGUID() check is mostly for compatibility with hacky scripts - 99% of the time summoning should be done trough spells.
if (GetSpellId() || GetOwnerGUID())
{
if (Unit* owner = GetOwner())
{
owner->RemoveGameObject(this, false);
SetRespawnTime(0);
Delete();
}
SetRespawnTime(0);
Delete();
return;
}