fix: kæden kører palle-varer i udkørselsflows (forsyning kan ikke hente paller)
This commit is contained in:
@@ -217,12 +217,13 @@ function ADChain.activeRoots(chain, paused)
|
||||
return result
|
||||
end
|
||||
|
||||
-- Mest brugte Wait-pulje blandt forsyningsflows til bygningen, ellers "".
|
||||
-- Mest brugte Wait-pulje blandt flows der leverer til bygningen (forsyning og kædens palle-flows), ellers "".
|
||||
function ADChain.waitPoolFor(runs, building)
|
||||
local counts, best, bestCount = {}, "", 0
|
||||
for _, run in ipairs(runs or {}) do
|
||||
local group = run.waitPoolGroup
|
||||
if run.kind == "supply" and group ~= nil and group ~= "" and contains(run.targetBuildingIds, building) then
|
||||
-- forsyning (mål) og kædens palle-flows (udkørsel: Lever også til/Lager til)
|
||||
if group ~= nil and group ~= "" and contains(ADChainActions.deliversTo(run), building) then
|
||||
counts[group] = (counts[group] or 0) + 1
|
||||
end
|
||||
end
|
||||
@@ -236,9 +237,9 @@ function ADChain.flowName(fillTitle, buildingName)
|
||||
return "Kæde: " .. tostring(fillTitle) .. " → " .. tostring(buildingName)
|
||||
end
|
||||
|
||||
-- forsyning (mål + varer) og kædens palle-flows som udkørsel ("Lager til" + varer) — ADChainActions.coversEdge
|
||||
local function covers(run, edge)
|
||||
return contains(run.targetBuildingIds, edge.consumer)
|
||||
and (run.ingredientMode ~= "manual" or contains(run.ingredients, edge.fillType))
|
||||
return ADChainActions.coversEdge(run, edge)
|
||||
end
|
||||
|
||||
-- Bruger en af de aktuelle kanter stadig flowet? -> kantens rodnøgle (flowet flyttes dertil), ellers nil.
|
||||
@@ -256,7 +257,7 @@ function ADChain.flowStatus(edges, runs, noVehicle)
|
||||
-- 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 covers(run, edge) then
|
||||
if not run.stopped or run.sleeping then status = "ok"; break end -- sovende flow vågner selv
|
||||
local reason = (noVehicle or {})[run.id]
|
||||
if reason == "pallet" then status = "pallet"
|
||||
@@ -275,6 +276,8 @@ function ADChain.runsView(runs)
|
||||
for _, run in ipairs(runs or {}) do
|
||||
table.insert(list, {id = run.id, name = run.name, kind = run.kind, targetBuildingIds = run.targetBuildingIds,
|
||||
ingredientMode = run.ingredientMode, ingredients = run.ingredients, stopped = run.stopped == true and not run.sleeping,
|
||||
storeBuildingIds = run.storeBuildingIds, feedBuildingIds = run.feedBuildingIds, sourceBuildingIds = run.sourceBuildingIds,
|
||||
products = run.products,
|
||||
chain = run.chain, waitPoolGroup = run.waitPoolGroup,
|
||||
-- traktorerne: uden dem ligner alle kædeflows tomme (sammenlægning/sletning må kun ramme tomme)
|
||||
vehicleIds = run.vehicleIds or {}})
|
||||
|
||||
Reference in New Issue
Block a user