fix(kæde): opbrugt fælles kapacitet meldes som flaskehals

This commit is contained in:
2026-09-30 13:26:51 +02:00
parent f813d4b3d8
commit 27017c0f62
+9 -2
View File
@@ -106,6 +106,9 @@ function ADChainModel.build(recipes, husbandry, crops)
problem("bottleneck", name, rootKey, rest) problem("bottleneck", name, rootKey, rest)
node.shortPerMonth = rest node.shortPerMonth = rest
end end
if rest > 1e-9 and #node.producers == 0 then
node.source = nil
end
end end
-- b) stalde -- b) stalde
if rest > 1e-9 and #node.producers == 0 and herds[name] ~= nil then if rest > 1e-9 and #node.producers == 0 and herds[name] ~= nil then
@@ -125,8 +128,12 @@ function ADChainModel.build(recipes, husbandry, crops)
chain.fieldDemand[node.fruit] = (chain.fieldDemand[node.fruit] or 0) + rest chain.fieldDemand[node.fruit] = (chain.fieldDemand[node.fruit] or 0) + rest
rest = 0 rest = 0
end end
-- d) ingen kilde (eller rest efter stald) -- d) ingen kilde (eller rest efter stald), eller exhausted producers
if rest > 1e-9 and (node.source == nil or node.source == "husbandry") then if rest > 1e-9 and makers ~= nil and #node.producers == 0 and #node.herds == 0 then
node.source = "production"
node.shortPerMonth = rest
problem("bottleneck", name, rootKey, rest)
elseif rest > 1e-9 and (node.source == nil or node.source == "husbandry") then
if node.source == nil then node.source = "buy" end if node.source == nil then node.source = "buy" end
node.shortPerMonth = rest node.shortPerMonth = rest
problem("buy", name, rootKey, rest) problem("buy", name, rootKey, rest)