feat: færdige kontrakter indkasseres selv; AD Fold implements slås til ved start (1.62.349)

This commit is contained in:
2026-10-19 00:15:40 +02:00
parent fa67b9247b
commit 9863e311eb
8 changed files with 100 additions and 2 deletions
+6 -1
View File
@@ -33,6 +33,8 @@ function ADFillFold.action(s)
if s.unfoldedByUs then
if s.cpWorking then return "none" end
if not s.loading or (s.distance or math.huge) > ADFillFold.FAR_M then return "fold" end
-- AutoDrives "Fold implements" foldede den sammen igen under læsningen (review 19/10): ud igen
if s.needsUnfold and (s.distance or math.huge) <= ADFillFold.NEAR_M then return "unfold" end
return "none"
end
if s.loading and s.needsUnfold and (s.distance or math.huge) <= ADFillFold.NEAR_M then return "unfold" end
@@ -112,9 +114,12 @@ local function tickVehicle(adEnv, vehicle, now)
local action = ADFillFold.action({loading = loading, distance = distance, needsUnfold = #blocked > 0,
unfoldedByUs = unfolded[vehicle] ~= nil, cpWorking = ADCpBridge ~= nil and ADCpBridge.isWorking(vehicle)})
if action == "unfold" then
local again = unfolded[vehicle] ~= nil
for _, entry in ipairs(blocked) do entry.object:setFoldDirection(entry.direction) end
unfolded[vehicle] = blocked
Logging.info(ADFillFold.LOG_PREFIX .. "'%s' foldes ud, så tanken kan fyldes", tostring(ADRuns.vehicleLabel(vehicle)))
if not again then
Logging.info(ADFillFold.LOG_PREFIX .. "'%s' foldes ud, så tanken kan fyldes", tostring(ADRuns.vehicleLabel(vehicle)))
end
elseif action == "fold" then
foldBack(vehicle)
Logging.info(ADFillFold.LOG_PREFIX .. "'%s' foldes sammen efter påfyldning", tostring(ADRuns.vehicleLabel(vehicle)))