fix: pålæsning springer unload-markører over når stationen har en anden markør (v1.62.102)

This commit is contained in:
2026-10-08 19:55:47 +02:00
parent 2d6e41f61f
commit a980d89fab
3 changed files with 20 additions and 1 deletions
+18
View File
@@ -320,6 +320,21 @@ end
-- Parrer markører med deres læssestation (markører uden station udelades).
-- excludedPlaceable: aflæsningsmålets egen placeable må ikke være kilde.
-- Flere markører ved samme læssestation: "unload"-markører droppes, når stationen også har en anden markør — der
-- læsses på, ikke af (in-game 8/10: 'Cow Barn 1' skulle hente ensilage i TMR-fabrikken og valgte "TMR Unload",
-- 13,7 m fra læssetriggeren, frem for "TMR Load"). roleOf(navn) -> "load" | "unload" | nil.
function ADSmartPickup.dropUnloadDuplicates(entries, roleOf)
local hasOther = {}
for _, entry in ipairs(entries) do
if roleOf(entry.marker.name) ~= "unload" then hasOther[entry.station] = true end
end
local kept = {}
for _, entry in ipairs(entries) do
if roleOf(entry.marker.name) ~= "unload" or not hasOther[entry.station] then table.insert(kept, entry) end
end
return kept
end
local function collectMarkerStations(adEnv, candidateMarkers, farmId, excludedPlaceable)
local markerStations = {}
for _, marker in pairs(candidateMarkers) do
@@ -330,6 +345,9 @@ local function collectMarkerStations(adEnv, candidateMarkers, farmId, excludedPl
table.insert(markerStations, {marker = marker, station = station})
end
end
if ADBuildings ~= nil and ADBuildings.nameRole ~= nil then
markerStations = ADSmartPickup.dropUnloadDuplicates(markerStations, ADBuildings.nameRole)
end
return markerStations
end
+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.101.0</version>
<version>1.62.102.0</version>
<title>
<en>AD Smart Pickup</en>
</title>