Core/SAI: Remove completed timed action lists even while evading

Fixes #25294

(cherry picked from commit 03eb0886a8b0e192d3c299d72ef223d30495c534)
This commit is contained in:
jackpoz
2022-02-04 00:27:12 +01:00
committed by Shauren
parent 1a6564f42f
commit 1f2c48f8bb
@@ -3946,8 +3946,26 @@ void SmartScript::OnUpdate(uint32 const diff)
&& !GetBaseObject())
return;
// Don't run any action while evading
if (me && me->IsInEvadeMode())
{
// Check if the timed action list finished and clear it if so.
// This is required by SMART_ACTION_CALL_TIMED_ACTIONLIST failing if mTimedActionList is not empty.
if (!mTimedActionList.empty())
{
bool needCleanup = true;
for (SmartScriptHolder& scriptholder : mTimedActionList)
{
if (scriptholder.enableTimed)
needCleanup = false;
}
if (needCleanup)
mTimedActionList.clear();
}
return;
}
InstallEvents();//before UpdateTimers