diff --git a/FS25_ADSmartPickup/adChainModel.lua b/FS25_ADSmartPickup/adChainModel.lua index 44bdb83..0342000 100644 --- a/FS25_ADSmartPickup/adChainModel.lua +++ b/FS25_ADSmartPickup/adChainModel.lua @@ -106,6 +106,9 @@ function ADChainModel.build(recipes, husbandry, crops) problem("bottleneck", name, rootKey, rest) node.shortPerMonth = rest end + if rest > 1e-9 and #node.producers == 0 then + node.source = nil + end end -- b) stalde 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 rest = 0 end - -- d) ingen kilde (eller rest efter stald) - if rest > 1e-9 and (node.source == nil or node.source == "husbandry") then + -- d) ingen kilde (eller rest efter stald), eller exhausted producers + 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 node.shortPerMonth = rest problem("buy", name, rootKey, rest)