feat(bomuld): moduler samles op efter høst og køres til spinderiet; rørløs høster uden tømmevogn (v1.62.266)

This commit is contained in:
2026-10-16 14:18:58 +02:00
parent 5530220092
commit dad9f8210a
6 changed files with 79 additions and 8 deletions
+14 -4
View File
@@ -123,8 +123,17 @@ function ADFieldModel.prepStages(plan, needs)
return stages
end
-- Afgrøder hvis høster laver baller/moduler på marken: de samles op efter høsten (brugerønske 16/10: bomulds-
-- modulerne "skal hentes hjem eller sælges"; F39 gik ellers direkte fra høst til kultivering). Ingen halm.
ADFieldModel.BALE_HARVEST_FRUITS = {COTTON = true}
function ADFieldModel.isBaleHarvest(fruit)
return fruit ~= nil and ADFieldModel.BALE_HARVEST_FRUITS[string.upper(tostring(fruit))] == true
end
-- Hele kæden for markens art. kind nil = slåafgrøde (bagudkompatibelt med etape 1).
function ADFieldModel.workStages(plan, kind, needs)
-- fruit (valgfri) = afgrøden der høstes (field.lastFruit): bomuld får balleopsamling i stedet for halmtrin.
function ADFieldModel.workStages(plan, kind, needs, fruit)
kind = kind or "mowable"
if kind == "bare" then
return ADFieldModel.prepStages(plan, needs)
@@ -132,7 +141,8 @@ function ADFieldModel.workStages(plan, kind, needs)
local product = ADFieldModel.product(plan, kind)
if product == "harvest" then
local stages = {"harvesting"}
for _, stage in ipairs(STRAW_STAGES[plan.straw or "chop"] or {}) do table.insert(stages, stage) end
local afterHarvest = ADFieldModel.isBaleHarvest(fruit) and {"baleCollecting"} or STRAW_STAGES[plan.straw or "chop"]
for _, stage in ipairs(afterHarvest or {}) do table.insert(stages, stage) end
for _, stage in ipairs(ADFieldModel.prepStages(plan, needs)) do table.insert(stages, stage) end
return stages
end
@@ -300,7 +310,7 @@ function ADFieldModel.start(field, kind, needs, currentFruit)
local copy = copyField(field)
copy.held = nil
copy.plan = ADFieldModel.applyTarget(copy.plan, kind, currentFruit)
local stages = ADFieldModel.workStages(copy.plan, kind, needs)
local stages = ADFieldModel.workStages(copy.plan, kind, needs, currentFruit)
copy.stage = stages[1] or "done"
copy.kind = kind or "mowable"
freshCycle(copy)
@@ -317,7 +327,7 @@ function ADFieldModel.advance(field, needs)
copy.stage = "idle"
return copy
end
local stages = ADFieldModel.workStages(field.plan, field.kind, needs)
local stages = ADFieldModel.workStages(field.plan, field.kind, needs, field.lastFruit)
copy.stage = "done"
local passed = false
local order = {"mowing", "tedding", "raking", "collecting", "harvesting", "strawCollecting", "baling", "baleCollecting", "mulching", "liming", "plowing", "cultivating", "stonePicking", "sowing", "rolling"}