diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-08-22 22:55:16 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2020-08-22 22:55:16 +0200 |
commit | 03eb0886a8b0e192d3c299d72ef223d30495c534 (patch) | |
tree | a24eea33f54608cad4128729be794e3475301b51 /src | |
parent | 5bab0e43c627c949bb5fb1d7fd014855c6c02b8e (diff) |
Core/SAI: Remove completed timed action lists even while evading
Fixes #25294
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index bf38219d4e7..1b447c5b00a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -3650,8 +3650,26 @@ void SmartScript::OnUpdate(uint32 const diff) if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !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 |