fix: pallevarer accepteres via supportedFillTypes (palletrigger); log med fundne salgsmarkører når ingen tager varen (v1.12.16.0)

This commit is contained in:
2026-09-23 16:03:30 +02:00
parent 02a65b510e
commit 5a910637f7
5 changed files with 66 additions and 5 deletions
+29 -4
View File
@@ -314,14 +314,39 @@ function ADSources.spawnOne(source, objectInfoIndex)
return ok == true
end
-- acceptedFillTypes rummer kun bulk-triggerens varer; palletriggerens varer ligger i
-- supportedFillTypes (det AutoDrive selv slår op i). Begge tæller.
function ADSources.stationAccepts(station, fillType)
if station.acceptedFillTypes ~= nil then
return station.acceptedFillTypes[fillType] == true
if station.acceptedFillTypes ~= nil and station.acceptedFillTypes[fillType] == true then
return true
end
if station.supportedFillTypes ~= nil and station.supportedFillTypes[fillType] == true then
return true
end
if station.getIsFillTypeSupported ~= nil then
return station:getIsFillTypeSupported(fillType) == true
local ok, value = pcall(station.getIsFillTypeSupported, station, fillType)
return ok and value == true
end
return station.supportedFillTypes ~= nil and station.supportedFillTypes[fillType] == true
return false
end
-- Til loggen: navnene på de varer stationen tager (sorteret), fx "SUGAR, STRAW_BASKET".
function ADSources.describeAccepted(station)
local set = {}
for _, field in ipairs({"acceptedFillTypes", "supportedFillTypes"}) do
for fillType, accepted in pairs(station[field] or {}) do
if accepted == true then set[fillType] = true end
end
end
local names = {}
for fillType in pairs(set) do
table.insert(names, g_fillTypeManager ~= nil and g_fillTypeManager:getFillTypeNameByIndex(fillType) or tostring(fillType))
end
table.sort(names, function(a, b)
-- stabil rækkefølge efter indeks hvor det kendes, ellers navn
return tostring(a) < tostring(b)
end)
return table.concat(names, ", ")
end
-- Markører hvis aflæsningsstation er et rigtigt salgssted: { {marker, station} }.