From cdf3c224c71f6956783c7faca3eb3760af605ace Mon Sep 17 00:00:00 2001 From: schwiti6190 <58079399+schwiti6190@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:37:14 +0200 Subject: [PATCH] Registered listeners to strategy --- scripts/ai/AIDriveStrategyCourse.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/ai/AIDriveStrategyCourse.lua b/scripts/ai/AIDriveStrategyCourse.lua index 6b467c1ec..1849d55d6 100644 --- a/scripts/ai/AIDriveStrategyCourse.lua +++ b/scripts/ai/AIDriveStrategyCourse.lua @@ -113,6 +113,7 @@ function AIDriveStrategyCourse:setAIVehicle(vehicle, jobParameters) self.ppc:registerListeners(self, 'onWaypointPassed', 'onWaypointChange') self.pathfinderController = PathfinderController(vehicle) + self.pathfinderController:registerListeners(self, self.onPathfindingFinished, self.onPathfindingRetry) self.storage = vehicle.spec_cpAIWorker @@ -583,6 +584,24 @@ end function AIDriveStrategyCourse:onWaypointPassed(ix, course) end +--- Pathfinding has finished +---@param controller PathfinderController +---@param success boolean +---@param course Course|nil +---@param goalNodeInvalid boolean|nil +function AIDriveStrategyCourse:onPathfindingFinished(controller, success, course, goalNodeInvalid) + -- override +end + +--- Pathfinding failed, but a retry attempt is leftover. +---@param controller PathfinderController +---@param lastContext PathfinderControllerContext +---@param wasLastRetry boolean +---@param currentRetryAttempt number +function AIDriveStrategyCourse:onPathfindingRetry(controller, lastContext, wasLastRetry, currentRetryAttempt) + -- override +end + ------------------------------------------------------------------------------------------------------------------------ --- Pathfinding ---------------------------------------------------------------------------------------------------------------------------