fix(kæde): palle-varer får egen status og linjen med frie marker passer i fanen

This commit is contained in:
2026-09-30 14:27:48 +02:00
parent 83394aabfd
commit 817fc388a2
5 changed files with 34 additions and 11 deletions
+6 -3
View File
@@ -22,7 +22,8 @@ ADChain.last = nil
ADChain.prevEnabled = nil
-- true fra indlæsning til første tick: kædens produktioner der er slukket, glemmes (spillet blev ikke gemt)
ADChain.afterLoad = false
-- run-id -> true: flows kæden oprettede stoppet, fordi der ikke var traktor/vogn (kun i hukommelsen)
-- run-id -> "noVehicle"|"pallet" (true = "noVehicle"): flows kæden oprettede stoppet, fordi der ikke var
-- traktor/vogn eller varen er på paller (kun i hukommelsen)
ADChain.noVehicle = {}
ADChain.switchCount = 0
ADChain.now = 0
@@ -227,7 +228,7 @@ function ADChain.stillNeeded(runView, edges)
return nil
end
-- {[forbruger|vare] = "ok"|"missing"|"stopped"|"noVehicle"} for hver kant.
-- {[forbruger|vare] = "ok"|"missing"|"stopped"|"noVehicle"|"pallet"} for hver kant.
function ADChain.flowStatus(edges, runs, noVehicle)
local result = {}
for _, edge in ipairs(edges or {}) do
@@ -235,7 +236,9 @@ function ADChain.flowStatus(edges, runs, noVehicle)
for _, run in ipairs(runs or {}) do
if run.kind == "supply" and covers(run, edge) then
if not run.stopped then status = "ok"; break end
if (noVehicle or {})[run.id] then status = "noVehicle"
local reason = (noVehicle or {})[run.id]
if reason == "pallet" then status = "pallet"
elseif reason then status = "noVehicle"
elseif status == "missing" then status = "stopped" end
end
end