fix: stald-siloer regnes ikke som marksiloer (v1.62.146)

This commit is contained in:
2026-10-10 03:58:54 +02:00
parent 795c9ff7a1
commit 04a7aa8008
6 changed files with 33 additions and 5 deletions
+3 -1
View File
@@ -142,7 +142,9 @@ function ADNames.autoName(adEnv, buildings)
if existing[building.id] == nil then
local x, z = position(building.placeable)
local nearest = nil
if x ~= nil and building.kind == "silo" then
-- stald-siloer får ikke marknavn ("F12 marksilo"), selv om de står ved en mark: de hører til stalden
local isStableSilo = building.kind == "silo" and ADFields ~= nil and ADFields.isStableSilo ~= nil and ADFields.isStableSilo(building, buildings)
if x ~= nil and building.kind == "silo" and not isStableSilo then
for _, field in ipairs(fields) do
local distance = math.sqrt((field.x - x) ^ 2 + (field.z - z) ^ 2)
if nearest == nil or distance < nearest.distance then nearest = {name = field.name, distance = distance} end