diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-10-04 19:43:49 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-28 14:42:53 +0100 |
commit | eb17e94b2e0059edeb747cb03e6828a746a2c0b8 (patch) | |
tree | 6d601d9b1a13402b02f6d81106413848e1e550f5 /src | |
parent | b059f2f8ee59aa9d937aaa108dfa6dd2bee26735 (diff) |
Core/SAI: Fix SMART_ACTION_WP_RESUME actually pausing next waypoint if the current path was not paused
Fixes #25519
(cherry picked from commit 5be7c2ad4f7cd561951e1285227211e03886703f)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.cpp | 11 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartAI.h | 1 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 666f19074e9..4cf9a93c434 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -136,6 +136,17 @@ void SmartAI::PausePath(uint32 delay, bool forced) GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, _currentWaypointNode, GetScript()->GetPathId()); } +bool SmartAI::CanResumePath() +{ + if (!HasEscortState(SMART_ESCORT_ESCORTING)) + { + // The whole resume logic doesn't support this case + return false; + } + + return HasEscortState(SMART_ESCORT_PAUSED); +} + void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail) { if (!HasEscortState(SMART_ESCORT_ESCORTING)) diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index e2ced61b505..38625f3045c 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -52,6 +52,7 @@ class TC_GAME_API SmartAI : public CreatureAI void StartPath(bool run = false, uint32 pathId = 0, bool repeat = false, Unit* invoker = nullptr, uint32 nodeId = 1); bool LoadPath(uint32 entry); void PausePath(uint32 delay, bool forced = false); + bool CanResumePath(); void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false); void EndPath(bool fail = false); void ResumePath(); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1eed9259906..bdca0258946 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1489,7 +1489,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; // Set the timer to 1 ms so the path will be resumed on next update loop - ENSURE_AI(SmartAI, me->AI())->SetWPPauseTimer(1); + if (ENSURE_AI(SmartAI, me->AI())->CanResumePath()) + ENSURE_AI(SmartAI, me->AI())->SetWPPauseTimer(1); break; } case SMART_ACTION_SET_ORIENTATION: |