fix: kun fulde paller tæller for UAL-bil med fuld-filter (v1.62.131)
This commit is contained in:
@@ -287,10 +287,22 @@ local function findStoreMarker(adEnv, vehicle, product, capacity, sources, liter
|
||||
return {wayPointId = marker.id, name = tostring(marker.name), free = liters}
|
||||
end
|
||||
|
||||
-- Tager bilens autoload kun fulde paller (Universal Autoload "Loading filter: full only")? Så tæller kun fulde
|
||||
-- paller som tilgængelige — ellers kører bilen forgæves til hønsehuse med halvfyldte paller (in-game 9/10: Dragon kørte
|
||||
-- alle seks huse rundt og kom hjem med 1 l).
|
||||
function ADOutbound.loadsFullPalletsOnly(trailers)
|
||||
for _, trailer in ipairs(trailers or {}) do
|
||||
local spec = trailer.spec_universalAutoload
|
||||
if spec ~= nil and spec.currentLoadingFilter == true then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- input til ADOutboundPlanner.plan + kilder pr. waypoint-id.
|
||||
function ADOutbound.buildPlanInput(adEnv, run, vehicle)
|
||||
local farmId = ADSmartPickup.getFarmId(vehicle)
|
||||
local capacity, hasAutoload = getVehicleCapacity(adEnv, vehicle)
|
||||
local capacity, hasAutoload, trailers = getVehicleCapacity(adEnv, vehicle)
|
||||
local fullOnly = hasAutoload and ADOutbound.loadsFullPalletsOnly(trailers)
|
||||
local carriable = {}
|
||||
for _, fillType in ipairs(ADRunsController.getCarriableFillTypes(adEnv, vehicle)) do
|
||||
carriable[fillType] = true
|
||||
@@ -324,6 +336,10 @@ function ADOutbound.buildPlanInput(adEnv, run, vehicle)
|
||||
if usePallets and not item.isPallet then
|
||||
available = item.palletLiters or 0
|
||||
end
|
||||
local palletCount = usePallets and (item.palletCount or 0) or 0
|
||||
if usePallets and fullOnly then
|
||||
available, palletCount = item.fullPalletLiters or 0, item.fullPalletCount or 0
|
||||
end
|
||||
-- andre køretøjer der allerede er på vej efter varen ved samme kilde: deres læs er taget (in-game 9/10:
|
||||
-- begge mælkebiler planlagde samme sekund på de samme 30.000 l; den anden stod ved triggeren uden mælk)
|
||||
if not usePallets then available = math.max(0, available - claimedLiters(vehicle, source.wayPointId, item.fillType)) end
|
||||
@@ -336,7 +352,7 @@ function ADOutbound.buildPlanInput(adEnv, run, vehicle)
|
||||
byName[item.name] = product
|
||||
table.insert(products, product)
|
||||
end
|
||||
table.insert(product.sources, {wayPointId = source.wayPointId, available = available, level = item.level, capacity = item.capacity, palletCount = usePallets and (item.palletCount or 0) or 0})
|
||||
table.insert(product.sources, {wayPointId = source.wayPointId, available = available, level = item.level, capacity = item.capacity, palletCount = palletCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -751,7 +767,7 @@ local function describeLoadFailure(adEnv, vehicle, task, state, source)
|
||||
for _, fillType in ipairs(state.trip.fillTypes) do wanted[fillType] = true end
|
||||
for _, item in ipairs(ok and products or {}) do
|
||||
if wanted[item.fillType] then
|
||||
table.insert(parts, string.format("%s i kilden %.0f l", fillTypeName(item.fillType), item.available or item.level or 0))
|
||||
table.insert(parts, string.format("%s i kilden %.0f l (%d paller, %d fulde)", fillTypeName(item.fillType), item.available or item.level or 0, item.palletCount or 0, item.fullPalletCount or 0))
|
||||
end
|
||||
end
|
||||
local trailer = task.trailers ~= nil and task.trailers[1] or vehicle
|
||||
|
||||
Reference in New Issue
Block a user