fix(udsendelse): fælles udsendelsesport for Start alle, markarbejde, marksiloer og flow-genstart; én indstilling under Indstillinger (v1.62.237)

This commit is contained in:
2026-10-16 02:01:12 +02:00
parent 7f063cbb06
commit fbc0b448f5
13 changed files with 97 additions and 69 deletions
+6 -1
View File
@@ -353,6 +353,8 @@ local function restartIdleMember(adEnv, run, byId, now)
end
if restartDue[run.id] == nil then restartDue[run.id] = now + ADFlowSleep.RESTART_STARTUP_DELAY_MS end
if now < restartDue[run.id] then return end
-- fælles udsendelsesport lukket: prøv igen ved næste tick (uden at skubbe minut-tjekket)
if ADLaunchGate ~= nil and not ADLaunchGate.isOpen() then return end
restartDue[run.id] = now + ADFlowSleep.WAKE_CHECK_MS
for _, id in ipairs(run.vehicleIds or {}) do
local vehicle = byId[id]
@@ -361,8 +363,10 @@ local function restartIdleMember(adEnv, run, byId, now)
-- vogn-logikken er i gang (henter, venter på, tømmer eller kører hjem): ikke vores at starte
local wagonBusy = ADFlowWagons ~= nil and ADFlowWagons.statusOf ~= nil and ADFlowWagons.statusOf(vehicle) ~= nil
local recentlyDriven = lastControlled[vehicle] ~= nil and now - lastControlled[vehicle] < ADFlowSleep.MANUAL_GRACE_MS
-- står i "Start alle"-køen: køen starter den (in-game 16/10: Cow Food 3 blev startet uden om køen)
local queued = ADRunsController.isQueuedToStart ~= nil and ADRunsController.isQueuedToStart(id)
table.insert(members, {id = id, active = module ~= nil and module.isActive ~= nil and module:isActive(),
usable = not wagonBusy and isOwnFree(vehicle, id, run), controlled = recentlyDriven})
usable = not wagonBusy and not queued and isOwnFree(vehicle, id, run), controlled = recentlyDriven})
end
end
local id = ADFlowSleep.pickIdleMember(run, members)
@@ -372,6 +376,7 @@ local function restartIdleMember(adEnv, run, byId, now)
Logging.info(ADFlowSleep.LOG_PREFIX .. "'%s': '%s' holder stille i det kørende flow — startes (%s)", tostring(run.name),
tostring(ADRuns.vehicleLabel(byId[id])), tostring(why))
local result = ADRunsController.startVehicle(adEnv, run, byId[id])
if ADLaunchGate ~= nil and result ~= nil and result.ok then ADLaunchGate.markLaunched() end
if ADFlowSleep.restartNeedsBackoff(result) then restartDue[run.id] = now + ADFlowSleep.RESTART_FAILED_BACKOFF_MS end
end