feat: bulk-vare der også står på paller (sukkerfabrik) tages som paller af en UAL-vogn, som bulk af en tipvogn (v1.12.3.0)
This commit is contained in:
@@ -195,17 +195,24 @@ function ADOutbound.buildPlanInput(adEnv, run, vehicle)
|
||||
for _, source in ipairs(sources) do
|
||||
for _, item in ipairs(ADSources.getProducts(adEnv, source, farmId)) do
|
||||
local policy = ADRuns.getProductPolicy(run, item.name)
|
||||
local canCarry = (item.isPallet and hasAutoload) or (not item.isPallet and carriable[item.fillType] == true)
|
||||
-- bulk hvis vognen kan bære varen; ellers paller hvis varen står på paller og vognen har UAL
|
||||
-- (en pallebil ved sukkerfabrikken tager sukkerpallerne, en tipvogn tager bulk)
|
||||
local usePallets = item.isPallet or (carriable[item.fillType] ~= true and hasAutoload and item.canPallet == true)
|
||||
local canCarry = usePallets and hasAutoload or (not usePallets and carriable[item.fillType] == true)
|
||||
local available = item.available
|
||||
if usePallets and not item.isPallet then
|
||||
available = item.palletLiters or 0
|
||||
end
|
||||
local emptyKey = tostring(source.wayPointId) .. ":" .. tostring(item.fillType)
|
||||
local isMarkedEmpty = emptyUntil[emptyKey] ~= nil and emptyUntil[emptyKey] > time
|
||||
if policy ~= "off" and canCarry and not isMarkedEmpty then
|
||||
local product = byName[item.name]
|
||||
if product == nil then
|
||||
product = {fillType = item.fillType, name = item.name, policy = policy, isPallet = item.isPallet, sources = {}}
|
||||
product = {fillType = item.fillType, name = item.name, policy = policy, isPallet = usePallets, sources = {}}
|
||||
byName[item.name] = product
|
||||
table.insert(products, product)
|
||||
end
|
||||
table.insert(product.sources, {wayPointId = source.wayPointId, available = item.available, level = item.level, capacity = item.capacity})
|
||||
table.insert(product.sources, {wayPointId = source.wayPointId, available = available, level = item.level, capacity = item.capacity})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -327,7 +327,7 @@ function ADRunsController.getRunProducts(adEnv, run)
|
||||
for _, item in ipairs(ADSources.getProducts(adEnv, source, farmId)) do
|
||||
local product = byName[item.name]
|
||||
if product == nil then
|
||||
product = {fillType = item.fillType, name = item.name, title = item.title or item.name, policy = ADRuns.getProductPolicy(run, item.name), isPallet = item.isPallet, available = 0, level = 0, capacity = 0}
|
||||
product = {fillType = item.fillType, name = item.name, title = item.title or item.name, policy = ADRuns.getProductPolicy(run, item.name), isPallet = item.isPallet, canPallet = item.canPallet, available = 0, level = 0, capacity = 0}
|
||||
byName[item.name] = product
|
||||
table.insert(result, product)
|
||||
end
|
||||
@@ -356,6 +356,9 @@ local function getOutboundFillTypes(adEnv, run, vehicle)
|
||||
if canLoadPallets then table.insert(result, product.fillType) end
|
||||
elseif carriable[product.fillType] then
|
||||
table.insert(result, product.fillType)
|
||||
elseif product.canPallet and canLoadPallets then
|
||||
-- bulk-vare der også står på paller (sukkerfabrik): pallebilen tager pallerne
|
||||
table.insert(result, product.fillType)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -184,10 +184,12 @@ local function getPalletsNearSpawner(placeable, fillType, farmId)
|
||||
return total
|
||||
end
|
||||
|
||||
-- canPallet: varen er en palletype (kan stå på paller); palletLiters: liter på paller ved
|
||||
-- kilden når varen ELLERS læsses som bulk (fabrik med både læssestation og pallespawner).
|
||||
local function newProduct(fillType, available, level, capacity, isPallet)
|
||||
local name = g_fillTypeManager ~= nil and g_fillTypeManager:getFillTypeNameByIndex(fillType) or tostring(fillType)
|
||||
local title = g_fillTypeManager ~= nil and g_fillTypeManager.getFillTypeTitleByIndex ~= nil and g_fillTypeManager:getFillTypeTitleByIndex(fillType) or nil
|
||||
return {fillType = fillType, name = name, title = title or name, available = available, level = level, capacity = capacity, isPallet = isPallet}
|
||||
return {fillType = fillType, name = name, title = title or name, available = available, level = level, capacity = capacity, isPallet = isPallet, canPallet = isPallet or ADSources.isPalletFillType(fillType), palletLiters = 0}
|
||||
end
|
||||
|
||||
local function getFactoryProducts(source, farmId)
|
||||
@@ -202,8 +204,11 @@ local function getFactoryProducts(source, farmId)
|
||||
local level = storage ~= nil and storage.getFillLevel ~= nil and (storage:getFillLevel(fillType) or 0) or 0
|
||||
local capacity = storage ~= nil and storage.getCapacity ~= nil and (storage:getCapacity(fillType) or 0) or 0
|
||||
local isPallet = ADSources.isPalletAt(source, fillType)
|
||||
local available = level + (isPallet and getPalletsNearSpawner(source.placeable, fillType, farmId) or 0)
|
||||
table.insert(products, newProduct(fillType, available, level, capacity, isPallet))
|
||||
local palletLiters = ADSources.isPalletFillType(fillType) and getPalletsNearSpawner(source.placeable, fillType, farmId) or 0
|
||||
local available = level + (isPallet and palletLiters or 0)
|
||||
local product = newProduct(fillType, available, level, capacity, isPallet)
|
||||
product.palletLiters = palletLiters
|
||||
table.insert(products, product)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.12.2.0</version>
|
||||
<version>1.12.3.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user