aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-09-19 23:32:12 +0200
committerShauren <shauren.trinity@gmail.com>2022-02-27 20:08:41 +0100
commit60519e947f634f12aa93a1871d53e012ed9e57d2 (patch)
treeb995de59862fedf7c6ef3090a40a76a297f34748 /src
parent1a073e2df05c8ded3ce8afc89eaf29c7f5d506ce (diff)
Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update (#25471)
* Core/SAI: Fix SMART_ACTION_WP_PAUSE with 0 delay pausing the path only for 1 world loop update * Add code comments * Remove special handling of SMART_ACTION_WP_PAUSE in SMART_EVENT_WAYPOINT_REACHED (cherry picked from commit 7dd51ae6d98cf6dd8ac71412aa689f888c7bf369)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp3
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index fd5720d2eb1..666f19074e9 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -928,7 +928,8 @@ void SmartAI::UpdatePath(uint32 diff)
// handle pause
if (HasEscortState(SMART_ESCORT_PAUSED) && (_waypointReached || _waypointPauseForced))
{
- if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING))
+ // Resume only if there was a pause timer set
+ if (_waypointPauseTimer && !me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING))
{
if (_waypointPauseTimer <= diff)
ResumePath();
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index d8787c64e7b..1eed9259906 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1469,7 +1469,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
uint32 delay = e.action.wpPause.delay;
- ENSURE_AI(SmartAI, me->AI())->PausePath(delay, e.GetEventType() == SMART_EVENT_WAYPOINT_REACHED ? false : true);
+ ENSURE_AI(SmartAI, me->AI())->PausePath(delay, true);
break;
}
case SMART_ACTION_WP_STOP:
@@ -1488,7 +1488,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsSmart())
break;
- ENSURE_AI(SmartAI, me->AI())->SetWPPauseTimer(0);
+ // Set the timer to 1 ms so the path will be resumed on next update loop
+ ENSURE_AI(SmartAI, me->AI())->SetWPPauseTimer(1);
break;
}
case SMART_ACTION_SET_ORIENTATION: