fix: vækststadie fra prøvepunkternes stemmer, ikke spillets ene punkt (v1.62.22)

This commit is contained in:
2026-10-04 23:35:00 +02:00
parent e15809e4e6
commit b21e948792
3 changed files with 18 additions and 1 deletions
+16
View File
@@ -42,6 +42,17 @@ function ADFields.buildMowable(mowerConverter, tedderConverter, fillTypeName)
end
-- Markens art: slåafgrøde, høstafgrøde eller bar (ingen afgrøde). Vokser = afgrøde der ikke er klar endnu.
-- Markens vækststadie: prøvepunkternes stemmer (vægtet med areal) frem for spillets ene punkt ved markskiltet
-- (in-game 4/10: F14 stod som "høstet" (10), men 76 % stod endnu på 8 — guiden skjulte aflæsningsvogne)
function ADFields.pickGrowthState(fieldState, votes)
local best, bestWeight = nil, 0
for state, weight in pairs(votes or {}) do
if weight > bestWeight then best, bestWeight = state, weight end
end
if best ~= nil then return best end
return fieldState
end
function ADFields.classify(fruitIndex, isMowable, readyRatio)
if fruitIndex == nil then return "bare", false end
local kind = isMowable and "mowable" or "harvest"
@@ -469,6 +480,10 @@ function ADFields.scanPerFruit(scan)
if okA and type(totalPixels) == "number" then scan.totalSum = scan.totalSum + totalPixels end
if okA and anyPixels then
scan.anySum = scan.anySum + anyPixels
if type(pointState) == "number" and pointState > 0 then
scan.stateVotes = scan.stateVotes or {}
scan.stateVotes[pointState] = (scan.stateVotes[pointState] or 0) + math.max(anyPixels, 1)
end
if not ADFields.isPrime(pointState, prime) then scan.immatureSum = scan.immatureSum + anyPixels end
end
local okR, _, readyPixels = pcall(FSDensityMapUtil.getFruitArea, fruitIndex, x - 2, z - 2, x + 2, z, x, z + 2, false, false)
@@ -529,6 +544,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)
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)
-- høstet stub eller visnet afgrøde er i praksis en bar mark (klargøring/såning)
+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.21.0</version>
<version>1.62.22.0</version>
<title>
<en>AD Smart Pickup</en>
</title>