diff options
| author | jackpoz <giacomopoz@gmail.com> | 2020-08-22 22:55:16 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-02-04 00:27:12 +0100 |
| commit | 1f2c48f8bb2396995c1e37e914ef2f3fa6bca490 (patch) | |
| tree | 286655810757832c6a115c29a6fc669f7f55c1b5 | |
| parent | 1a6564f42fbd941d98c19dc46e5afb853f713843 (diff) | |
Core/SAI: Remove completed timed action lists even while evading
Fixes #25294
(cherry picked from commit 03eb0886a8b0e192d3c299d72ef223d30495c534)
| -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 d1ab3e5932f..4dce17ab33a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -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 |
