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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user