From 1e80eb21f0e649f4ca3e3e10c8d684d481536e5c Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 24 May 2022 12:57:10 -0400 Subject: [PATCH] Core/SAI: Fix SMART_ACTION_WP_RESUME actually pausing next waypoint if the current path was not paused Port From (https://github.com/TrinityCore/TrinityCore/commit/eb17e94b2e0059edeb747cb03e6828a746a2c0b8) --- Source/Game/AI/SmartScripts/SmartAI.cs | 11 +++++++++++ Source/Game/AI/SmartScripts/SmartScript.cs | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 8f4ed30c4..3c973739b 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -181,6 +181,17 @@ namespace Game.AI GetScript().ProcessEventsFor(SmartEvents.WaypointPaused, null, _currentWaypointNode, GetScript().GetPathId()); } + public bool CanResumePath() + { + if (!HasEscortState(SmartEscortState.Escorting)) + { + // The whole resume logic doesn't support this case + return false; + } + + return HasEscortState(SmartEscortState.Paused); + } + public void StopPath(uint despawnTime = 0, uint quest = 0, bool fail = false) { if (!HasEscortState(SmartEscortState.Escorting)) diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index ace84da46..4fdc46992 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -1403,7 +1403,8 @@ namespace Game.AI break; // Set the timer to 1 ms so the path will be resumed on next update loop - ((SmartAI)_me.GetAI()).SetWPPauseTimer(1); + if (((SmartAI)_me.GetAI()).CanResumePath()) + ((SmartAI)_me.GetAI()).SetWPPauseTimer(1); break; } case SmartActions.SetOrientation: