fix: kæden skifter aldrig til eng (kan ikke sås); eng tæller som udbud; ugyldige kædemål ryddes (v1.62.31)

This commit is contained in:
2026-10-05 16:00:13 +02:00
parent 5d7b3bebca
commit defbf136f4
7 changed files with 79 additions and 16 deletions
+9 -8
View File
@@ -134,18 +134,19 @@ function ADChainModel.build(recipes, husbandry, crops, fieldGoods, goodCrops)
end
end
end
-- c) mark
if rest > 1e-9 and #node.producers == 0 and #node.herds == 0 and crops ~= nil and crops[name] ~= nil then
node.source, node.fruit = "field", crops[name]
chain.fieldDemand[node.fruit] = (chain.fieldDemand[node.fruit] or 0) + rest
rest = 0
end
-- c2) markvare fra en afgrøde med produkt (hø = græs/hø): markbehov pr. vare, så kæden planlægger marken
-- c0) markvare fra en afgrøde med produkt (hø = græs/hø): markbehov pr. vare, så kæden planlægger marken;
-- før afgrøde-stien, så et vindue der også er en afgrødes hovedvare (eng: GRASS_WINDROW) får sit produkt
local goodCrop = goodCrops ~= nil and goodCrops[name] or nil
if rest > 1e-9 and #node.producers == 0 and #node.herds == 0 and goodCrop ~= nil then
node.source, node.fruit, node.product, node.shortKey = "field", goodCrop.fruit, goodCrop.product, name
chain.fieldDemand[name] = (chain.fieldDemand[name] or 0) + rest
chain.fieldProducts[name] = {fruit = goodCrop.fruit, product = goodCrop.product}
chain.fieldProducts[name] = {fruit = goodCrop.fruit, product = goodCrop.product, fruits = goodCrop.fruits}
rest = 0
end
-- c) mark
if rest > 1e-9 and #node.producers == 0 and #node.herds == 0 and crops ~= nil and crops[name] ~= nil then
node.source, node.fruit = "field", crops[name]
chain.fieldDemand[node.fruit] = (chain.fieldDemand[node.fruit] or 0) + rest
rest = 0
end
-- c3) markvare uden egen afgrøde (fx hakkelse, halm): kommer fra markerne, ingen afgrødeplan