Core/SAI: Add an action_param3 to "summon gob" to control when the object will despawn

0 - For despawn when creature dies or time runs out
1 - For despawn after time
Closes #11601

(cherry picked from commit ca4f1e334a)
This commit is contained in:
Killyana
2018-02-16 02:19:19 +01:00
committed by Shauren
parent f0823eb048
commit 4b6e76a5ef
4 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -1876,7 +1876,7 @@ TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, fl
return SummonCreature(id, { x,y,z,o }, despawnType, despawnTime, 0, privateObjectOwner);
}
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime)
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime, GOSummonType summonType)
{
if (!IsInWorld())
return nullptr;
@@ -1896,7 +1896,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, Qua
PhasingHandler::InheritPhaseShift(go, this);
go->SetRespawnTime(respawnTime);
if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this
if (GetTypeId() == TYPEID_PLAYER || (GetTypeId() == TYPEID_UNIT && summonType == GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)) //not sure how to handle this
ToUnit()->AddGameObject(go);
else
go->SetSpawnedByDefault(false);