fix(Core/SmartScripts): Allow SAI_ACTION_DIE to accept params (#16411)

This commit is contained in:
Angelo Venturini
2023-05-31 23:32:15 -03:00
committed by GitHub
parent 44e461ce6f
commit d204eccdea
4 changed files with 28 additions and 3 deletions

View File

@@ -1139,7 +1139,22 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_DIE:
{
if (me && !me->isDead())
if (e.action.die.milliseconds)
{
if (me && !me->isDead())
{
me->m_Events.AddEventAtOffset([&]
{
// We need to check again to see if we didn't die in the process.
if (me && !me->isDead())
{
me->KillSelf();
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature {}", me->GetGUID().ToString());
}
}, Milliseconds(e.action.die.milliseconds));
}
}
else if (me && !me->isDead())
{
me->KillSelf();
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature {}", me->GetGUID().ToString());