Skip to content

Commit

Permalink
Registered listeners to strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
schwiti6190 committed Oct 18, 2023
1 parent fdc0440 commit cdf3c22
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/ai/AIDriveStrategyCourse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
---------------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit cdf3c22

Please sign in to comment.