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)
This commit is contained in:
Giacomo Pozzoni
2022-02-27 20:08:41 +01:00
committed by Shauren
parent 1a073e2df0
commit 60519e947f
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -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();
@@ -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: