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