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
This commit is contained in:
Aokromes committed 2018-02-16 04:05:47 +01:00
1 parent ade258873e
commit ca5e3445b8
4 files changed
+12 -5

No files matched your search

+2 -2
View File
@@ -2176,7 +2176,7 @@ TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, fl
return SummonCreature(id, pos, spwtype, despwtime, 0);
}
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot, uint32 respawnTime)
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, G3D::Quat const& rot, uint32 respawnTime, GOSummonType summonType)
{
if (!IsInWorld())
return nullptr;
@@ -2199,7 +2199,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, G3D
go->CopyPhaseFrom(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);