fix(Scripts/Midsummer): correctly despawn gameobjects (#19387)

This commit is contained in:
sudlud
2024-07-14 17:24:06 +02:00
committed by GitHub
parent c1649193ac
commit 7b8e2514bf
3 changed files with 15 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
-- delete SAI of firework objects
UPDATE `gameobject_template` SET `AIName` = '' WHERE (`entry` IN (180703, 180704, 180707, 180708, 180720, 180721, 180722, 180723, 180724, 180725, 180726, 180727, 180728, 180729, 180730, 180731, 180733, 180736, 180737, 180738, 180739, 180740, 180741));
DELETE FROM `smart_scripts` WHERE (`source_type` = 1 AND `id` IN (0, 1) AND `entryorguid` IN (180703, 180704, 180707, 180708, 180720, 180721, 180722, 180723, 180724, 180725, 180726, 180727, 180728, 180729, 180730, 180731, 180733, 180736, 180737, 180738, 180739, 180740, 180741));

View File

@@ -164,7 +164,7 @@ struct go_firework_show : public GameObjectAI
uint32 posIdx = _show->schedule.entries[_curIdx].spawnIndex;
if (posIdx < _show->spawns.size)
{
me->SummonGameObject(_show->schedule.entries[_curIdx].gameobjectId,
GameObject* go = me->SummonGameObject(_show->schedule.entries[_curIdx].gameobjectId,
_show->spawns.entries[posIdx].x,
_show->spawns.entries[posIdx].y,
_show->spawns.entries[posIdx].z,
@@ -174,6 +174,13 @@ struct go_firework_show : public GameObjectAI
_show->spawns.entries[posIdx].rot2,
_show->spawns.entries[posIdx].rot3,
0);
// trigger despawn animation for firework explosion
if (go)
{
go->DespawnOrUnsummon();
go->AddObjectToRemoveList();
}
}
uint32 ts = _show->schedule.entries[_curIdx].timestamp;

View File

@@ -243,6 +243,7 @@ struct npc_midsummer_bonfire : public ScriptedAI
if (_spellFocus)
{
_spellFocus->DespawnOrUnsummon();
_spellFocus->AddObjectToRemoveList();
_spellFocus = nullptr;
}
@@ -378,7 +379,10 @@ struct npc_midsummer_bonfire_despawner : public ScriptedAI
{
// spawnID is 0 for temp spawns
if (0 == (*itr)->GetSpawnId())
{
(*itr)->DespawnOrUnsummon();
(*itr)->AddObjectToRemoveList();
}
}
me->DespawnOrUnsummon();