fix: Autoload-vogn sendes ikke efter korn via fabrikkens varevalg-fallback; vækst-diagnose i markscanning (1.62.341)

This commit is contained in:
2026-10-18 22:11:54 +02:00
parent 2eeb0d7810
commit babd961e4e
6 changed files with 53 additions and 8 deletions
+23 -2
View File
@@ -60,6 +60,22 @@ function ADFields.classify(fruitIndex, isMowable, readyRatio)
return kind, (readyRatio or 0) < 0.9
end
-- Diagnose til scanningsloggen: hvilket vækststadie blev valgt, og hvorfra (spillets marktilstand vs. punkternes
-- stemmer), og afgrødens grænser. In-game 18/10: visnet havre (F96) blev læst som "growing" — stadiet skal kunne ses.
-- -> fx "vækst 4 (spil 6, stemmer 4:120 5:3), høst 5-5, visnet 6, fase growing, art harvest"
function ADFields.growthDiag(gameState, votes, fruit, chosen, phase, kind)
local states = {}
for state in pairs(votes or {}) do table.insert(states, state) end
table.sort(states)
local parts = {}
for _, state in ipairs(states) do table.insert(parts, string.format("%d:%d", state, math.floor(votes[state]))) end
local minReady = fruit ~= nil and (fruit.minHarvestingGrowthState or fruit.minHarvestGrowthState) or nil
local maxReady = fruit ~= nil and (fruit.maxHarvestingGrowthState or fruit.maxHarvestGrowthState) or minReady
return string.format("vækst %s (spil %s, stemmer %s), høst %s-%s, visnet %s, fase %s, art %s",
tostring(chosen), tostring(gameState), #parts > 0 and table.concat(parts, " ") or "-",
tostring(minReady), tostring(maxReady), tostring(fruit ~= nil and fruit.witheredState or nil), tostring(phase), tostring(kind))
end
-- Vækststadie -> fase ud fra afgrødens grænser (FS25-felter hedder minHarvestingGrowthState eller
-- minHarvestGrowthState afhængigt af version).
function ADFields.growthPhase(state, fruit)
@@ -592,6 +608,7 @@ local function finishScan(adEnv, scan)
info.cropTitle = fillType ~= nil and fillType.title or (fruit ~= nil and fruit.name) or "?"
end
info.kind = ADFields.classify(info.fruitIndex, info.mowable, info.readyRatio)
local gameGrowth = info.growthState
info.growthState = ADFields.pickGrowthState(info.growthState, scan.stateVotes)
info.phase = fruit ~= nil and ADFields.growthPhase(info.growthState, fruit) or nil
info.growing = info.fruitIndex ~= nil and ADFields.isGrowing(info.phase, info.anyPixels, info.readyRatio)
@@ -633,9 +650,13 @@ local function finishScan(adEnv, scan)
tostring(info.id), #scan.points, scan.candidates or 0, scan.soil.prepared[2], scan.cropPoints or 0, #(info.verts or {}),
state == nil and "ukendt" or (state.noFieldGround and "groundType NONE" or "markjord"),
tostring(info.fruitName or "-"), info.cultivable == false and "NEJ" or "ja")
if fruit ~= nil then
summary = summary .. ", " .. ADFields.growthDiag(gameGrowth, scan.stateVotes, fruit, info.growthState, info.phase, info.kind)
end
ADFields.scanLog = ADFields.scanLog or {}
-- også når marken får/mister sin markjord (afgrøde uden markjord-lag -> rigtig mark), in-game 10/10 F2
local key = tostring(info.cultivable ~= false) .. "/" .. tostring(info.cropOnly == true)
-- også når marken får/mister sin markjord (afgrøde uden markjord-lag -> rigtig mark), in-game 10/10 F2,
-- og når fasen skifter (visnet havre på F96 blev læst som "growing" 18/10 — stadiets kilde skal kunne ses)
local key = tostring(info.cultivable ~= false) .. "/" .. tostring(info.cropOnly == true) .. "/" .. tostring(info.phase)
if ADFields.scanLog[info.id] ~= key then
ADFields.scanLog[info.id] = key
Logging.info("ADSmartPickup: " .. summary)