feat(kæde): læs i køretøjer tæller som lager, ingen skift under høst, varelinje åbner flow (v1.61.8.0)

This commit is contained in:
2026-09-30 18:03:56 +02:00
parent 2290bdde95
commit 47afdebf64
9 changed files with 70 additions and 6 deletions
+3 -2
View File
@@ -46,7 +46,8 @@ local function isCandidate(field, used, dismissedFruit, fruit)
end
-- prices: {[afgrøde] = pris} eller en funktion afgrøde -> pris (slås kun op for kandidaternes afgrøder).
function ADCropPlan.choose(shortages, fields, usedFruits, yields, prices, dismissed)
-- harvesting = {[afgrøde] = true}: afgrøder der høstes lige nu — ingen forslag/skift for dem (læssene er på vej).
function ADCropPlan.choose(shortages, fields, usedFruits, yields, prices, dismissed, harvesting)
local actions, taken = {}, {}
local used = usedFruits or {}
local priceOf = type(prices) == "function" and prices or function(fruit) return (prices or {})[fruit] or 0 end
@@ -57,7 +58,7 @@ function ADCropPlan.choose(shortages, fields, usedFruits, yields, prices, dismis
return priceCache[fruit]
end
for _, shortage in ipairs(shortages or {}) do
local remaining = shortage.missingHa
local remaining = (harvesting or {})[shortage.fruit] and 0 or shortage.missingHa
local candidates = {}
for _, field in ipairs(fields or {}) do
if not taken[field.id] and isCandidate(field, used, (dismissed or {})[field.id], shortage.fruit) then