mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
feat(Core/SAI): Allow forcing creatures/gameobjects's respawn timers when using SMART_ACTION_FORCE_DESPAWN (#8714)
This commit is contained in:
@@ -1302,20 +1302,22 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
Milliseconds despawnDelay(e.action.forceDespawn.delay);
|
||||
|
||||
// Wait at least one world update tick before despawn, so it doesn't break linked actions.
|
||||
if (despawnDelay <= 0ms)
|
||||
{
|
||||
despawnDelay = 1ms;
|
||||
}
|
||||
|
||||
Seconds forceRespawnTimer(e.action.forceDespawn.forceRespawnTimer);
|
||||
if (Creature* creature = (*itr)->ToCreature())
|
||||
{
|
||||
creature->DespawnOrUnsummon(e.action.forceDespawn.delay + 1);
|
||||
creature->DespawnOrUnsummon(despawnDelay, forceRespawnTimer);
|
||||
}
|
||||
else if (GameObject* go = (*itr)->ToGameObject())
|
||||
{
|
||||
Milliseconds despawnDelay(e.action.forceDespawn.delay);
|
||||
|
||||
// Wait at least one world update tick before despawn, so it doesn't break linked actions.
|
||||
if (despawnDelay <= 0ms)
|
||||
{
|
||||
despawnDelay = 1ms;
|
||||
}
|
||||
go->DespawnOrUnsummon(despawnDelay);
|
||||
go->DespawnOrUnsummon(despawnDelay, forceRespawnTimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user