feat(markarbejde): bygget-over marker (groundType NONE / ingen markjord — stald, biogas, gårdsplads) er ikke med i oversigten eller arbejdet (v1.29.0.0)

This commit is contained in:
2026-09-26 12:59:43 +02:00
parent 5d06c46fa9
commit e02d8af3d5
3 changed files with 27 additions and 3 deletions
+14 -2
View File
@@ -159,7 +159,17 @@ function ADFields.readFieldState(field)
local state = field ~= nil and field.fieldState or nil
if type(state) ~= "table" or type(state.fruitTypeIndex) ~= "number" then return nil end
local fruitIndex = state.fruitTypeIndex > 0 and state.fruitTypeIndex or nil
return {fruitIndex = fruitIndex, growthState = fruitIndex ~= nil and state.growthState or nil}
local groundNone = type(FieldGroundType) == "table" and FieldGroundType.NONE or 0
return {fruitIndex = fruitIndex, growthState = fruitIndex ~= nil and state.growthState or nil,
noFieldGround = type(state.groundType) == "number" and state.groundType == groundNone}
end
-- Kan marken dyrkes? Nej hvis spillet siger "ingen markjord" (groundType NONE: bygget over — gårdsplads,
-- stald, biogasanlæg), eller hvis intet prøvepunkt ligger på markjord. En markensilo i et hjørne ændrer
-- intet: resten af marken er stadig markjord.
function ADFields.isCultivable(state, onFieldPoints)
if state ~= nil and state.noFieldGround then return false end
return (onFieldPoints or 0) > 0
end
-- Markens omrids som {{x, z}, ...}. FS25: field:getDensityMapPolygon():getVerticesList() (flad liste
@@ -302,6 +312,7 @@ function ADFields.scanPerFruit(scan)
-- (getFieldDataAtWorldPosition giver isOnField, densityBits, groundType — IKKE vækststadie)
local state = ADFields.readFieldState(info.field)
info.growthState = state ~= nil and state.growthState or nil
info.cultivable = ADFields.isCultivable(state, #scan.points)
if state ~= nil then
info.fruitIndex = state.fruitIndex
else
@@ -486,7 +497,8 @@ function ADFields.list()
local infos = {}
for _, entry in ipairs(ADFields.order) do
local info = ADFields.cache[entry.id]
if info ~= nil then table.insert(infos, info) end
-- bygget-over marker (stald, biogas, gårdsplads) kan ikke dyrkes: ikke med i oversigt/arbejde
if info ~= nil and info.cultivable ~= false then table.insert(infos, info) end
end
ADFields.listCache = infos
return infos
+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.28.9.0</version>
<version>1.29.0.0</version>
<title>
<en>AD Smart Pickup</en>
</title>