feat(fields): Pleje har Automatisk/Manuelt som Klargøring — Automatisk = gødning, ukrudt og kalk; resuméet viser 'Automatisk' (v1.59.8.0)

This commit is contained in:
2026-09-29 18:21:29 +02:00
parent fc646ab00b
commit f893b5e8ca
5 changed files with 40 additions and 9 deletions
+21 -4
View File
@@ -97,6 +97,12 @@ local function isPrepAuto(plan)
return (plan.soil or "auto") == "auto" and plan.mulch ~= true and plan.lime ~= false and plan.roll ~= true return (plan.soil or "auto") == "auto" and plan.mulch ~= true and plan.lime ~= false and plan.roll ~= true
end end
-- Pleje "Automatisk" = al pleje slået til (gødning, ukrudt, kalk). Kalk tæller kun her når den ikke hører
-- under klargøring — ellers afgør klargøringens valg den.
local function isCareAuto(plan)
return plan.fertilize ~= false and plan.weed ~= false and plan.lime ~= false
end
local function storeModeOf(ids, fieldSilos) local function storeModeOf(ids, fieldSilos)
if #ids == 0 then return "auto" end if #ids == 0 then return "auto" end
local silo = {} local silo = {}
@@ -114,7 +120,7 @@ local function draftFrom(field, context)
local mode = storeModeOf(plan.storeBuildingIds, context.fieldSilos) local mode = storeModeOf(plan.storeBuildingIds, context.fieldSilos)
return { return {
fieldId = field.id, plan = plan, originalTarget = plan.targetFruit or "", fieldId = field.id, plan = plan, originalTarget = plan.targetFruit or "",
prepAuto = isPrepAuto(plan), useDedicated = #plan.rigIds > 0, prepAuto = isPrepAuto(plan), careAuto = isCareAuto(plan), useDedicated = #plan.rigIds > 0,
storeMode = mode, storeIds = mode == "manual" and ADGuide.deepCopy(plan.storeBuildingIds) or {}, storeMode = mode, storeIds = mode == "manual" and ADGuide.deepCopy(plan.storeBuildingIds) or {},
} }
end end
@@ -149,7 +155,7 @@ function ADFieldGuide.choose(guide, id, value)
draft.plan[id] = value draft.plan[id] = value
elseif id == "product" then elseif id == "product" then
draft.plan.product = value and "hay" or "silage" draft.plan.product = value and "hay" or "silage"
elseif id == "prepAuto" or id == "useDedicated" then elseif id == "prepAuto" or id == "careAuto" or id == "useDedicated" then
draft[id] = value == true draft[id] = value == true
elseif id == "rigIds" then elseif id == "rigIds" then
draft.plan.rigIds = ADGuide.toggleItem(draft.plan.rigIds, value.item, value.on) draft.plan.rigIds = ADGuide.toggleItem(draft.plan.rigIds, value.item, value.on)
@@ -242,8 +248,14 @@ local function rowsPrep(guide)
end end
local function rowsCare(guide) local function rowsCare(guide)
local plan = guide.draft.plan local draft, plan = guide.draft, guide.draft.plan
local rows = {toggle("fertilize", L("spu_field_fertilize"), plan.fertilize ~= false)} local rows = {choice("careAuto", L("spu_guide_care"), {
{label = L("spu_guide_auto"), value = true}, {label = L("spu_guide_manual"), value = false}}, draft.careAuto)}
if draft.careAuto then
table.insert(rows, {type = "text", label = L("spu_guide_care_autoText")})
return rows
end
table.insert(rows, toggle("fertilize", L("spu_field_fertilize"), plan.fertilize ~= false))
if weedVisible(guide) then table.insert(rows, toggle("weed", L("spu_field_weed"), plan.weed ~= false)) end if weedVisible(guide) then table.insert(rows, toggle("weed", L("spu_field_weed"), plan.weed ~= false)) end
if not prepVisible(guide) then table.insert(rows, toggle("lime", L("spu_field_lime"), plan.lime ~= false)) end if not prepVisible(guide) then table.insert(rows, toggle("lime", L("spu_field_lime"), plan.lime ~= false)) end
return rows return rows
@@ -388,6 +400,7 @@ local SUMMARY = {
return parts return parts
end, end,
care = function(guide) care = function(guide)
if guide.draft.careAuto then return {L("spu_guide_sum_auto")} end
local plan, parts = guide.draft.plan, {} local plan, parts = guide.draft.plan, {}
if plan.fertilize ~= false then table.insert(parts, L("spu_guide_sum_fert")) end if plan.fertilize ~= false then table.insert(parts, L("spu_guide_sum_fert")) end
if weedVisible(guide) and plan.weed ~= false then table.insert(parts, L("spu_guide_sum_weed")) end if weedVisible(guide) and plan.weed ~= false then table.insert(parts, L("spu_guide_sum_weed")) end
@@ -438,6 +451,10 @@ function ADFieldGuide.result(guide, start)
if draft.prepAuto and ADFieldGuide.isVisible("prep", guide) then if draft.prepAuto and ADFieldGuide.isVisible("prep", guide) then
plan.soil, plan.mulch, plan.lime, plan.roll = "auto", false, true, false plan.soil, plan.mulch, plan.lime, plan.roll = "auto", false, true, false
end end
if draft.careAuto and ADFieldGuide.isVisible("care", guide) then
plan.fertilize, plan.weed = true, true
if not prepVisible(guide) then plan.lime = true end
end
if ADFieldGuide.isVisible("store", guide) then if ADFieldGuide.isVisible("store", guide) then
if draft.storeMode == "fieldSilo" then if draft.storeMode == "fieldSilo" then
local ids = {} local ids = {}
+2
View File
@@ -437,6 +437,8 @@
<text name="spu_guide_crop_sowAgain" text="Så samme afgrøde igen efter høst"/> <text name="spu_guide_crop_sowAgain" text="Så samme afgrøde igen efter høst"/>
<text name="spu_guide_prep" text="Klargøring"/> <text name="spu_guide_prep" text="Klargøring"/>
<text name="spu_guide_prep_autoText" text=" Pløjer når jorden trænger, ellers kultiverer; kalker ved lav pH."/> <text name="spu_guide_prep_autoText" text=" Pløjer når jorden trænger, ellers kultiverer; kalker ved lav pH."/>
<text name="spu_guide_care" text="Pleje"/>
<text name="spu_guide_care_autoText" text=" Gøder op til max når afgrøden vokser, sprøjter/harver ukrudt væk og kalker ved lav pH."/>
<text name="spu_guide_rigs" text="Maskiner ad gangen (multi-tool)"/> <text name="spu_guide_rigs" text="Maskiner ad gangen (multi-tool)"/>
<text name="spu_guide_dedicated" text="Faste maskiner til marken?"/> <text name="spu_guide_dedicated" text="Faste maskiner til marken?"/>
<text name="spu_guide_useFieldSilo" text="Brug marksiloen?"/> <text name="spu_guide_useFieldSilo" text="Brug marksiloen?"/>
+2
View File
@@ -437,6 +437,8 @@
<text name="spu_guide_crop_sowAgain" text="Sow the same crop again after harvest"/> <text name="spu_guide_crop_sowAgain" text="Sow the same crop again after harvest"/>
<text name="spu_guide_prep" text="Preparation"/> <text name="spu_guide_prep" text="Preparation"/>
<text name="spu_guide_prep_autoText" text=" Plows when the soil needs it, otherwise cultivates; limes at low pH."/> <text name="spu_guide_prep_autoText" text=" Plows when the soil needs it, otherwise cultivates; limes at low pH."/>
<text name="spu_guide_care" text="Crop care"/>
<text name="spu_guide_care_autoText" text=" Fertilizes up to max while the crop grows, removes weeds and limes at low pH."/>
<text name="spu_guide_rigs" text="Machines at a time (multi-tool)"/> <text name="spu_guide_rigs" text="Machines at a time (multi-tool)"/>
<text name="spu_guide_dedicated" text="Dedicated machines for this field?"/> <text name="spu_guide_dedicated" text="Dedicated machines for this field?"/>
<text name="spu_guide_useFieldSilo" text="Use the field silo?"/> <text name="spu_guide_useFieldSilo" text="Use the field silo?"/>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107"> <modDesc descVersion="107">
<author>masterdraco</author> <author>masterdraco</author>
<version>1.59.7.0</version> <version>1.59.8.0</version>
<title> <title>
<en>AD Smart Pickup</en> <en>AD Smart Pickup</en>
</title> </title>
+14 -4
View File
@@ -122,10 +122,19 @@ check("FG6 vælg selv: kalk", findRow(prepManual, "lime") ~= nil, true)
check("FG6 vælg selv: mulch", findRow(prepManual, "mulch") ~= nil, true) check("FG6 vælg selv: mulch", findRow(prepManual, "mulch") ~= nil, true)
check("FG6 vælg selv: ingen tromle uden såning", findRow(prepManual, "roll"), nil) check("FG6 vælg selv: ingen tromle uden såning", findRow(prepManual, "roll"), nil)
local careGrass = FG.rows(G.jump(FG.open(field(1), ctx(GRASS)), "care", "close")) -- pleje: Automatisk/Manuelt som klargøring (brugerønske 29/9); knapperne vises under Manuelt
local careAutoRows = FG.rows(G.jump(g, "care", "close"))
check("FG7 pleje: valg auto/manuel", findRow(careAutoRows, "careAuto").type, "choice")
check("FG7 pleje auto: ingen knapper", findRow(careAutoRows, "fertilize"), nil)
check("FG7 standard: pleje auto", g.draft.careAuto, true)
check("FG7 uden gødning -> manuel", FG.open(field(2, {fertilize = false}), ctx(WHEAT)).draft.careAuto, false)
local autoCare = FG.result(FG.choose(FG.open(field(2, {fertilize = false, weed = false}), ctx(WHEAT)), "careAuto", true), true).plan
check("FG7 auto slår gødning til", autoCare.fertilize, true)
check("FG7 auto slår ukrudt til", autoCare.weed, true)
local careGrass = FG.rows(G.jump(FG.choose(FG.open(field(1), ctx(GRASS)), "careAuto", false), "care", "close"))
check("FG7 græs: ingen ukrudt", findRow(careGrass, "weed"), nil) check("FG7 græs: ingen ukrudt", findRow(careGrass, "weed"), nil)
check("FG7 græs: kalk i pleje", findRow(careGrass, "lime") ~= nil, true) check("FG7 græs: kalk i pleje", findRow(careGrass, "lime") ~= nil, true)
local careWheat = FG.rows(G.jump(g, "care", "close")) local careWheat = FG.rows(G.jump(FG.choose(g, "careAuto", false), "care", "close"))
check("FG7 hvede: ukrudt", findRow(careWheat, "weed") ~= nil, true) check("FG7 hvede: ukrudt", findRow(careWheat, "weed") ~= nil, true)
check("FG7 hvede: kalk ikke i pleje", findRow(careWheat, "lime"), nil) check("FG7 hvede: kalk ikke i pleje", findRow(careWheat, "lime"), nil)
@@ -215,7 +224,8 @@ check("FG16 linjer for synlige trin", #sum, 6)
check("FG16 afgrøde behold", partKeys(lineFor(sum, "crop")), "spu_guide_crop_keep") check("FG16 afgrøde behold", partKeys(lineFor(sum, "crop")), "spu_guide_crop_keep")
check("FG16 halm", partKeys(lineFor(sum, "cropChoice")), "spu_guide_sum_straw_chop") check("FG16 halm", partKeys(lineFor(sum, "cropChoice")), "spu_guide_sum_straw_chop")
check("FG16 klargøring auto", partKeys(lineFor(sum, "prep")), "spu_guide_sum_auto") check("FG16 klargøring auto", partKeys(lineFor(sum, "prep")), "spu_guide_sum_auto")
check("FG16 pleje", partKeys(lineFor(sum, "care")), "spu_guide_sum_fert,spu_guide_sum_weed") check("FG16 pleje auto", partKeys(lineFor(sum, "care")), "spu_guide_sum_auto")
check("FG16 pleje manuel", partKeys(lineFor(FG.summary(FG.choose(g, "careAuto", false)), "care")), "spu_guide_sum_fert,spu_guide_sum_weed")
check("FG16 maskiner", partKeys(lineFor(sum, "machines")), "spu_guide_sum_freeRigs,spu_guide_sum_rigs,spu_guide_sum_unloaders") check("FG16 maskiner", partKeys(lineFor(sum, "machines")), "spu_guide_sum_freeRigs,spu_guide_sum_rigs,spu_guide_sum_unloaders")
check("FG16 lager auto", partKeys(lineFor(sum, "store")), "spu_guide_sum_auto") check("FG16 lager auto", partKeys(lineFor(sum, "store")), "spu_guide_sum_auto")
check("FG16 ingen mark/summary-linje", lineFor(sum, "summary"), nil) check("FG16 ingen mark/summary-linje", lineFor(sum, "summary"), nil)
@@ -231,7 +241,7 @@ check("FG17 lager valgt silo", partKeys(lineFor(FG.summary(manual), "store")), "
check("FG17 lager marksilo", partKeys(lineFor(FG.summary(useSilo), "store")), "spu_guide_sum_fieldSilo") check("FG17 lager marksilo", partKeys(lineFor(FG.summary(useSilo), "store")), "spu_guide_sum_fieldSilo")
local sumHay = FG.summary(FG.choose(FG.choose(FG.open(field(1), ctx(GRASS)), "product", true), "rake", true)) local sumHay = FG.summary(FG.choose(FG.choose(FG.open(field(1), ctx(GRASS)), "product", true), "rake", true))
check("FG17 hø + river", partKeys(lineFor(sumHay, "cropChoice")), "spu_field_plan_hay,spu_guide_sum_rake") check("FG17 hø + river", partKeys(lineFor(sumHay, "cropChoice")), "spu_field_plan_hay,spu_guide_sum_rake")
local sumNoCare = FG.summary(FG.choose(FG.choose(g, "fertilize", false), "weed", false)) local sumNoCare = FG.summary(FG.choose(FG.choose(FG.choose(g, "careAuto", false), "fertilize", false), "weed", false))
check("FG17 ingen pleje", partKeys(lineFor(sumNoCare, "care")), "spu_guide_sum_noCare") check("FG17 ingen pleje", partKeys(lineFor(sumNoCare, "care")), "spu_guide_sum_noCare")
local sumSow = FG.summary(FG.choose(g, "sow", true)) local sumSow = FG.summary(FG.choose(g, "sow", true))
check("FG17 så igen", partKeys(lineFor(sumSow, "crop")), "spu_guide_crop_keep,spu_guide_sum_sowAgain") check("FG17 så igen", partKeys(lineFor(sumSow, "crop")), "spu_guide_crop_keep,spu_guide_sum_sowAgain")