This commit is contained in:
kepler155c
2018-10-23 03:04:34 -04:00
parent f40f7ae7a8
commit a19960959b
22 changed files with 965 additions and 651 deletions

View File

@@ -1,5 +1,5 @@
local itemDB = require('itemDB')
local Lora = require('lora/lora')
local Lora = require('lora')
local device = _G.device
@@ -12,19 +12,20 @@ function ExportTask:cycle(context)
if v.exports then
local machine = device[target]
if machine and machine.getItemMeta then
for slotNo, item in pairs(v.exports) do
local slot = machine.getItemMeta(slotNo) or { count = 0 }
local maxCount = slot.maxCount or itemDB:getMaxCount(item)
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
if count > 0 then
context.inventoryAdapter:provide(itemDB:splitKey(item), count, slotNo, target)
context.inventoryAdapter:provide(
itemDB:splitKey(entry.name), count, entry.slot, target)
end
end
else
debug('Invalid export target: ' .. target)
end
end
end
end
end
Lora:registerTask(ExportTask)