fix: høster med anden afgrøde i tanken vises som 'tøm den' i stedet for 'ingen kan' (1.62.350)

This commit is contained in:
2026-10-19 00:21:01 +02:00
parent 9863e311eb
commit f832652dd4
9 changed files with 47 additions and 7 deletions
+2 -1
View File
@@ -80,7 +80,8 @@ local function collect()
local env = ADFieldJobs.environment ~= nil and ADFieldJobs.environment() or nil
if target ~= nil and target ~= "" and env ~= nil and env.plantable ~= nil and not env.plantable(target) then waitFruit = target end
end
local waitMachine = not active and reason ~= nil and (reason.key == "spu_field_reason_allBusy" or reason.key == "spu_field_reason_cannotDo")
local waitMachine = not active and reason ~= nil and (reason.key == "spu_field_reason_allBusy" or reason.key == "spu_field_reason_cannotDo"
or reason.key == "spu_field_reason_tankBlocked")
table.insert(s.working, {fieldId = info.id, stage = field.stage, active = active, waitFruit = waitFruit, waitMachine = waitMachine})
if reason ~= nil and reason.key == "spu_field_reason_noRig" and reason.role ~= nil then
if missingByRole[reason.role] == nil then
+34 -4
View File
@@ -946,7 +946,29 @@ end
-- Også i loggen (én gang pr. ændring): før stod grunden kun i fanen, og loggen var tavs (in-game 27/9).
-- Hvem har rollen, og hvorfor kan de ikke bruges (in-game 27/9: "allBusy" uden at sige hvem)
local function logNoRig(field, role, why, candidates, roleAccept)
-- Høster med en anden afgrøde i tanken (dispatchAccept afviser den): sig det i stedet for "ledig" (in-game 19/10: Mejetærsker 6
-- med 149.431 l majs stod som "ledig" ved spinatkontrakten F83). -> tekst eller nil
function ADFieldWork.tankBlockText(role, tankFillType, harvestFillType)
if role ~= "harvester" or tankFillType == nil or harvestFillType == nil or tankFillType == harvestFillType then return nil end
local name = g_fillTypeManager ~= nil and g_fillTypeManager.getFillTypeNameByIndex ~= nil and g_fillTypeManager:getFillTypeNameByIndex(tankFillType) or tostring(tankFillType)
return string.format("har %s i tanken — tøm den først", tostring(name))
end
-- Den eneste grund til "ingen kan" er en høster med en anden afgrøde i tanken? -> dens navn (kø "tøm den", ikke "mangler
-- på gården"; review 19/10). Ellers nil.
function ADFieldWork.tankBlockedHarvester(role, candidates, roleAccept, harvestFillType)
if role ~= "harvester" then return nil end
for _, candidate in ipairs(candidates or {}) do
if (candidate.role == role or (candidate.roles ~= nil and candidate.roles[role])) and candidate.enabled ~= false
and not candidate.busy and not candidate.controlled and (roleAccept == nil or roleAccept(candidate))
and ADFieldWork.tankBlockText(role, candidate.tankFillType, harvestFillType) ~= nil then
return candidate.label
end
end
return nil
end
local function logNoRig(field, role, why, candidates, roleAccept, info)
local noRigKey = tostring(role) .. ":" .. tostring(why)
if lastNoRig[field.id] == noRigKey then return end
lastNoRig[field.id] = noRigKey
@@ -954,7 +976,8 @@ local function logNoRig(field, role, why, candidates, roleAccept)
for _, candidate in ipairs(candidates) do
if candidate.role == role or (candidate.roles ~= nil and candidate.roles[role]) then
local state = candidate.controlled and "spiller i førersædet" or candidate.busyWhy
or (not candidate.enabled and "ikke i flåden") or (roleAccept ~= nil and not roleAccept(candidate) and "kan ikke (afgrøde/frø)") or "ledig"
or (not candidate.enabled and "ikke i flåden") or (roleAccept ~= nil and not roleAccept(candidate) and "kan ikke (afgrøde/frø)")
or ADFieldWork.tankBlockText(role, candidate.tankFillType, info ~= nil and info.harvestFillType or nil) or "ledig"
table.insert(who, string.format("'%s': %s", tostring(candidate.label), state))
end
end
@@ -983,8 +1006,15 @@ local function dispatchNoRig(adEnv, field, info, role, decision, candidates, req
tostring(role), tostring(info.markerName), table.concat(offNetwork, ", "))}, retryAt = ADPool.alignedRetry(now(), ADFieldWork.NO_RIG_RETRY_MS)})
return
end
note(field.id, {reason = {key = "spu_field_reason_" .. tostring(why), role = role, args = args}, retryAt = ADPool.alignedRetry(now(), ADFieldWork.NO_RIG_RETRY_MS)})
logNoRig(field, role, why, candidates, roleAccept)
local blockedName = why == "cannotDo" and ADFieldWork.tankBlockedHarvester(role, candidates, roleAccept, info.harvestFillType) or nil
if blockedName ~= nil then
why = "tankBlocked"
note(field.id, {reason = {key = "spu_field_reason_tankBlocked", name = tostring(blockedName), role = role},
retryAt = ADPool.alignedRetry(now(), ADFieldWork.NO_RIG_RETRY_MS)})
else
note(field.id, {reason = {key = "spu_field_reason_" .. tostring(why), role = role, args = args}, retryAt = ADPool.alignedRetry(now(), ADFieldWork.NO_RIG_RETRY_MS)})
end
logNoRig(field, role, why, candidates, roleAccept, info)
end
-- Mejetærskeren henter sit skærebord på transporthjul (som puljens "fetching": samme fejl- og karantænevej) og
+1 -1
View File
@@ -39,7 +39,7 @@ ADStatusView.HOLD_PROBLEM_MS = 30 * 60 * 1000 -- et flow der har været gult (
-- Markårsager der kræver spillerens handling. Resten (ikke såtid, genvækst, tørvejr, henter redskab) er bare ventetid.
ADStatusView.PROBLEM_FIELD_REASONS = {
allBusy = true, noPoolTractor = true, noSowFruit = true, tooWide = true, tooNarrow = true, widthUnknown = true,
notEnough = true, noRig = true, cannotDo = true, text = true,
notEnough = true, noRig = true, cannotDo = true, text = true, tankBlocked = true,
}
local ALWAYS_PROBLEM = {missing = true, chains = true, warnings = true}
+2
View File
@@ -84,6 +84,7 @@
<text name="spu_field_reasonShort_widthUnknown" text="bredde ukendt"/>
<text name="spu_field_reasonShort_tooNarrow" text="for smal"/>
<text name="spu_field_reasonShort_cannotDo" text="ingen kan"/>
<text name="spu_field_reasonShort_tankBlocked" text="tøm høsteren"/>
<text name="spu_field_reasonShort_noSowFruit" text="vælg afgrøde"/>
<text name="spu_field_reasonShort_notEnough" text="for få ledige"/>
<text name="spu_field_reasonShort_notPlantable" text="ikke såtid nu"/>
@@ -190,6 +191,7 @@
<text name="spu_field_plan_prep" text="Klargøring"/>
<text name="spu_field_plan_sow" text="så"/>
<text name="spu_field_reason_cannotDo" text="ingen %s i markflåden kan tage opgaven (afgrøde/frø/ukrudt)"/>
<text name="spu_field_reason_tankBlocked" text="venter på at '%s' bliver tømt (en anden afgrøde i tanken)"/>
<text name="spu_field_reason_noSowFruit" text="vælg en afgrøde at så"/>
<text name="spu_field_reason_notEnough" text="multi-tool: %s — kun %d af %d ledige"/>
<text name="spu_field_reason_notPlantable" text="%s kan ikke sås i denne periode"/>
+2
View File
@@ -84,6 +84,7 @@
<text name="spu_field_reasonShort_widthUnknown" text="width unknown"/>
<text name="spu_field_reasonShort_tooNarrow" text="too narrow"/>
<text name="spu_field_reasonShort_cannotDo" text="none can do it"/>
<text name="spu_field_reasonShort_tankBlocked" text="empty the harvester"/>
<text name="spu_field_reasonShort_noSowFruit" text="choose crop"/>
<text name="spu_field_reasonShort_notEnough" text="too few free"/>
<text name="spu_field_reasonShort_notPlantable" text="not sowing time"/>
@@ -190,6 +191,7 @@
<text name="spu_field_plan_prep" text="Preparation"/>
<text name="spu_field_plan_sow" text="sow"/>
<text name="spu_field_reason_cannotDo" text="no %s in the field fleet can do the job (crop/seeds/weeds)"/>
<text name="spu_field_reason_tankBlocked" text="waiting for '%s' to be emptied (another crop in the tank)"/>
<text name="spu_field_reason_noSowFruit" text="choose a crop to sow"/>
<text name="spu_field_reason_notEnough" text="multi-tool: %s — only %d of %d free"/>
<text name="spu_field_reason_notPlantable" text="%s cannot be sown in this period"/>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.62.349.0</version>
<version>1.62.350.0</version>
<title>
<en>AD Smart Pickup</en>
</title>