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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user