fix: forsyning uden noget at hente bliver ved pålæsningen (ingen AD-mapperotation); behold kun-pålæsning — 1.62.152
This commit is contained in:
@@ -1405,6 +1405,22 @@ local function installLoadWaitHook(adEnv)
|
||||
end
|
||||
end
|
||||
|
||||
-- Forsyningskørsel uden noget at hente: AD's nuværende 1. markør (markørindeks), så AD ikke roterer videre i mappen.
|
||||
-- nil for traktorer uden for en forsyningskørsel (så gælder AD's egen rotation som før).
|
||||
local stayLogged = setmetatable({}, {__mode = "k"})
|
||||
function ADSmartPickup.stayAtCurrentPickup(driver)
|
||||
local run = ADRunsController ~= nil and ADRunsController.getRunForVehicle ~= nil and ADRunsController.getRunForVehicle(driver) or nil
|
||||
if run == nil or (run.kind or "supply") ~= "supply" then return nil end
|
||||
local stateModule = driver.ad ~= nil and driver.ad.stateModule or nil
|
||||
local first = stateModule ~= nil and stateModule.getFirstMarker ~= nil and stateModule:getFirstMarker() or nil
|
||||
if first == nil or first.markerIndex == nil then return nil end
|
||||
if stayLogged[driver] ~= first.markerIndex then
|
||||
stayLogged[driver] = first.markerIndex
|
||||
Logging.info(ADSmartPickup.LOG_PREFIX .. "'%s': intet at hente lige nu — bliver ved '%s' (ikke AutoDrives mappe-rotation)", tostring(ADRuns.vehicleLabel(driver)), tostring(first.name))
|
||||
end
|
||||
return first.markerIndex
|
||||
end
|
||||
|
||||
local function installHook(adEnv)
|
||||
local manager = adEnv.ADMultipleTargetsManager
|
||||
local originalGetNextPickup = manager.getNextPickup
|
||||
@@ -1436,6 +1452,10 @@ local function installHook(adEnv)
|
||||
end
|
||||
if choice == nil then
|
||||
activePickups[driver] = nil
|
||||
-- forsyningskørsel uden noget at hente: bliv ved den nuværende pålæsning i stedet for AD's mappe-rotation,
|
||||
-- der tager næste markør i mappen (in-game 10/10: Fill Cow Silos kørte til Cow 4 Milk/Slurry)
|
||||
local stay = ADSmartPickup.stayAtCurrentPickup(driver)
|
||||
if stay ~= nil then return stay end
|
||||
return originalGetNextPickup(self, driver, forcedSkip)
|
||||
end
|
||||
activePickups[driver] = choice.station ~= nil and {station = choice.station, fillTypes = choice.fillTypes, markerName = choice.markerName, fillType = choice.fillType or choice.fillTypes[1]} or nil
|
||||
|
||||
Reference in New Issue
Block a user