Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Mode 1 with overloader swerve fix #6814 #6801
Browse files Browse the repository at this point in the history
See if the other vehicle as an overloader, potentially waiting
for us (is near the overload point). We should not swerve as we
need to drive under the pipe of the overloader wagon.
  • Loading branch information
pvaiko committed Feb 17, 2021
1 parent 6bebec5 commit c4a75e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions AIDriver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ end
function AIDriver:getIsInFilltrigger()
return self.vehicle.cp.fillTrigger ~= nil or self:isNearFillPoint()
end

--- Is an alignment course needed to reach waypoint ix in the current course?
-- override in derived classes as needed
---@param course Course
Expand Down
10 changes: 10 additions & 0 deletions GrainTransportAIDriver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,13 @@ function GrainTransportAIDriver:delete()
end
AIDriver.delete(self)
end

function GrainTransportAIDriver:isProximitySwerveEnabled(vehicle)
if vehicle.cp and vehicle.cp.driver and vehicle.cp.driver.is_a(OverloaderAIDriver) then
-- the other vehicle as an overloader, potentially waiting for us. We should not swerve
-- as we need to drive under the pipe of the overloader wagon
return not vehicle.cp.driver:isNearOverloadPoint()
else
return true
end
end
5 changes: 5 additions & 0 deletions OverloaderAIDriver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,8 @@ end
function OverloaderAIDriver:enableFillTypeUnloading()

end

--- Is around the overload point?
function OverloaderAIDriver:isNearOverloadPoint()
return self.nearOverloadPoint
end

0 comments on commit c4a75e6

Please sign in to comment.