From d5aade41efd9163317b73fa01a22ff465497f9c6 Mon Sep 17 00:00:00 2001 From: Peter Vaiko Date: Mon, 28 Oct 2024 18:23:07 -0400 Subject: [PATCH] fix: added forgotten wait for pathfinder Stop and wait for pathfinder when finding path to the next waypoint. #3563 --- scripts/ai/AIDriveStrategyFieldWorkCourse.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/ai/AIDriveStrategyFieldWorkCourse.lua b/scripts/ai/AIDriveStrategyFieldWorkCourse.lua index b20382e17..d822be2bc 100644 --- a/scripts/ai/AIDriveStrategyFieldWorkCourse.lua +++ b/scripts/ai/AIDriveStrategyFieldWorkCourse.lua @@ -626,12 +626,14 @@ function AIDriveStrategyFieldWorkCourse:startPathfindingToNextWaypoint(ix) self.pathfinderController:registerListeners(self, self.onPathfindingDoneToNextWaypoint, self.onPathfindingFailedToNextWaypoint) self:debug('Start pathfinding to target waypoint %d, zOffset %.1f', ix + 1, zOffset) + self.state = self.states.WAITING_FOR_PATHFINDER + -- to have a course set while waiting for the pathfinder + self:startCourse(self.fieldWorkCourse, self.waypointToContinueOnFailedPathfinding) self.pathfinderController:findPathToNode(context, targetNode, 0, zOffset) end function AIDriveStrategyFieldWorkCourse:onPathfindingFailedToNextWaypoint() - self:debug('Pathfinding to next waypoint failed, use alignment course instead') - self:createAlignmentCourse(self.fieldWorkCourse, ix) + self:debug('Pathfinding to next waypoint failed, continue directly at waypoint %d', self.waypointToContinueOnFailedPathfinding) self.state = self.states.WORKING self:startCourse(self.fieldWorkCourse, self.waypointToContinueOnFailedPathfinding) end