milo wip
This commit is contained in:
@@ -14,21 +14,22 @@ 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)
|
||||||
local count = maxCount - slot.count
|
|
||||||
|
|
||||||
-- something else is in this slot
|
-- is something else is in this slot
|
||||||
if slot.count > 0 and slot.name ~= entry.name then
|
if not slot.name or slot.name == item.name then
|
||||||
count = 0
|
local maxCount = slot.maxCount or itemDB:getMaxCount(item)
|
||||||
end
|
local count = maxCount - slot.count
|
||||||
if count > 0 then
|
|
||||||
local item = Milo:getItemWithQty(entry)
|
if count > 0 then
|
||||||
if item.count > 0 then
|
item = Milo:getItemWithQty(item)
|
||||||
context.inventoryAdapter:provide(
|
if item and count > 0 then
|
||||||
itemDB:splitKey(entry.name),
|
context.inventoryAdapter:provide(
|
||||||
math.min(count, item.count),
|
itemDB:splitKey(entry.name),
|
||||||
entry.slot,
|
math.min(count, item.count),
|
||||||
target)
|
entry.slot,
|
||||||
|
target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user