feat: kæder respekterer fabrikkens udgang (Fordel = intet flow, Sælg på mellemvare -> Behold)

This commit is contained in:
2026-09-30 22:01:42 +02:00
parent 21b48d7664
commit 1bda82a270
9 changed files with 120 additions and 14 deletions
+5 -4
View File
@@ -244,12 +244,13 @@ function ADChain.stillNeeded(runView, edges)
return nil
end
-- {[forbruger|vare] = "ok"|"missing"|"stopped"|"noVehicle"|"pallet"} for hver kant.
-- {[forbruger|vare] = "ok"|"auto"|"missing"|"stopped"|"noVehicle"|"pallet"} for hver kant.
function ADChain.flowStatus(edges, runs, noVehicle)
local result = {}
for _, edge in ipairs(edges or {}) do
local status = "missing"
for _, run in ipairs(runs or {}) do
-- udgangen står på Fordel: spillet leverer selv, intet flow
local status = edge.delivery == "auto" and "auto" or "missing"
for _, run in ipairs(edge.delivery == "auto" and {} or runs or {}) do
if run.kind == "supply" and covers(run, edge) then
if not run.stopped then status = "ok"; break end
local reason = (noVehicle or {})[run.id]
@@ -318,7 +319,7 @@ local function plan(data, state)
end
-- de ægte opskrifter (ikke kopien): en pauset rod er stadig tændt og må ikke "tændes" og overtages af kæden
local prod = ADChainActions.productions(data.recipes, chain.needRecipes, protected)
return {chain = chain, shortages = shortages, actions = actions, prod = prod, edges = ADChainActions.edges(chain)}
return {chain = chain, shortages = shortages, actions = actions, prod = prod, edges = ADChainActions.edges(chain, data.recipes)}
end
local function logInfo(fmt, ...) Logging.info(ADChain.LOG_PREFIX .. fmt, ...) end