fix: salgsmarkør skal køre gennem stationens trigger (v1.62.50)
This commit is contained in:
@@ -654,15 +654,34 @@ function ADSources.getSellMarkers(adEnv, farmId)
|
||||
return cacheGet("sellMarkers", tostring(farmId), 10000, function() return ADSources.findSellMarkers(adEnv, farmId) end)
|
||||
end
|
||||
|
||||
function ADSources.findSellMarkers(adEnv, farmId)
|
||||
-- entries = {{marker, station, through}} -> samme liste, men har en station flere markører, beholdes kun dem
|
||||
-- hvis AD-vej kører gennem stationens trigger (findes nogen). In-game 6/10: mælkebilerne solgte ved væske-
|
||||
-- markedet via "Palleskur 2 load" på nabosporet (lavere waypoint-id end "Buy All") og holdt ved palleskuret.
|
||||
function ADSources.pickStationMarkers(entries)
|
||||
local hasThrough = {}
|
||||
for _, entry in ipairs(entries) do
|
||||
if entry.through then hasThrough[entry.station] = true end
|
||||
end
|
||||
local result = {}
|
||||
for _, entry in ipairs(entries) do
|
||||
if entry.through or not hasThrough[entry.station] then table.insert(result, entry) end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function ADSources.findSellMarkers(adEnv, farmId)
|
||||
local entries = {}
|
||||
for _, marker in pairs(adEnv.ADGraphManager:getMapMarkers()) do
|
||||
local station = ADSmartPickup.getUnloadStationAtWayPointId(adEnv, marker.id, farmId)
|
||||
if station ~= nil and ADPrices.isSellingStation(station) and not ADSources.isSellBlocked(station) then
|
||||
table.insert(result, {marker = marker, station = station})
|
||||
local okThrough, through = pcall(function()
|
||||
return ADFieldWork.drivesThrough({approach = ADFieldWork.approachPoints(adEnv, marker.id)},
|
||||
ADSmartPickup.unloadTriggerPoints(station))
|
||||
end)
|
||||
table.insert(entries, {marker = marker, station = station, through = okThrough and through == true})
|
||||
end
|
||||
end
|
||||
return result
|
||||
return ADSources.pickStationMarkers(entries)
|
||||
end
|
||||
|
||||
-- ---- paller til lager: objektlager (palleskur) som mål ----
|
||||
|
||||
Reference in New Issue
Block a user