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

View File

@@ -14,21 +14,22 @@ function ExportTask:cycle(context)
if machine and machine.getItemMeta then
for _, entry in pairs(v.exports) do
local slot = machine.getItemMeta(entry.slot) or { count = 0 }
local maxCount = slot.maxCount or itemDB:getMaxCount(entry.name)
local count = maxCount - slot.count
local item = itemDB:splitKey(entry.name)
-- something else is in this slot
if slot.count > 0 and slot.name ~= entry.name then
count = 0
end
if count > 0 then
local item = Milo:getItemWithQty(entry)
if item.count > 0 then
context.inventoryAdapter:provide(
itemDB:splitKey(entry.name),
math.min(count, item.count),
entry.slot,
target)
-- 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
if count > 0 then
item = Milo:getItemWithQty(item)
if item and count > 0 then
context.inventoryAdapter:provide(
itemDB:splitKey(entry.name),
math.min(count, item.count),
entry.slot,
target)
end
end
end
end