This commit is contained in:
kepler155c
2018-10-24 09:00:06 -04:00
parent eb3cdad008
commit 55653aa494

View File

@@ -14,16 +14,16 @@ function ExportTask:cycle(context)
if machine and machine.getItemMeta then if machine and machine.getItemMeta then
for _, entry in pairs(v.exports) do for _, entry in pairs(v.exports) do
local slot = machine.getItemMeta(entry.slot) or { count = 0 } local slot = machine.getItemMeta(entry.slot) or { count = 0 }
local maxCount = slot.maxCount or itemDB:getMaxCount(entry.name) local item = itemDB:splitKey(entry.name)
-- is something else is in this slot
if not slot.name or slot.name == item.name then
local maxCount = slot.maxCount or itemDB:getMaxCount(item)
local count = maxCount - slot.count local count = maxCount - slot.count
-- something else is in this slot
if slot.count > 0 and slot.name ~= entry.name then
count = 0
end
if count > 0 then if count > 0 then
local item = Milo:getItemWithQty(entry) item = Milo:getItemWithQty(item)
if item.count > 0 then if item and count > 0 then
context.inventoryAdapter:provide( context.inventoryAdapter:provide(
itemDB:splitKey(entry.name), itemDB:splitKey(entry.name),
math.min(count, item.count), math.min(count, item.count),
@@ -32,6 +32,7 @@ function ExportTask:cycle(context)
end end
end end
end end
end
else else
debug('Invalid export target: ' .. target) debug('Invalid export target: ' .. target)
end end