mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Movement: Fixed pauses on waypoint movement happening at wrong times when FollowPathBackwardsFromEndToStart is set and creature is going from end to start
(cherry picked from commit c5097114d1)
This commit is contained in:
@@ -284,10 +284,23 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* owner)
|
||||
|
||||
ASSERT(_currentNode < GetPath()->Nodes.size(), "WaypointMovementGenerator::OnArrived: tried to reference a node id (%u) which is not included in path (%u)", _currentNode, GetPath()->Id);
|
||||
WaypointNode const& waypoint = GetPath()->Nodes[_currentNode];
|
||||
if (waypoint.Delay)
|
||||
|
||||
Milliseconds delay = [&]
|
||||
{
|
||||
if (!_isReturningToStart)
|
||||
return Milliseconds(waypoint.Delay);
|
||||
|
||||
// when traversing the path backwards, use delays from "next" waypoint to make sure pauses happen between the same points as in forward direction
|
||||
if (_currentNode > 0)
|
||||
return Milliseconds(GetPath()->Nodes[_currentNode - 1].Delay);
|
||||
|
||||
return 0ms;
|
||||
}();
|
||||
|
||||
if (delay > 0ms)
|
||||
{
|
||||
owner->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
|
||||
_nextMoveTime.Reset(waypoint.Delay);
|
||||
_nextMoveTime.Reset(delay);
|
||||
}
|
||||
|
||||
if (_waitTimeRangeAtPathEnd && IsFollowingPathBackwardsFromEndToStart()
|
||||
|
||||
Reference in New Issue
Block a user