milo wip
This commit is contained in:
@@ -11,11 +11,34 @@ function ImportTask:cycle(context)
|
||||
for source, v in pairs(context.config.remoteDefaults) do
|
||||
if v.imports then
|
||||
local inventory = device[source]
|
||||
if inventory and inventory.getItemMeta then
|
||||
for slot in pairs(v.imports) do
|
||||
local item = inventory.getItemMeta(slot)
|
||||
if item then
|
||||
context.storage:import(source, slot, item.count, item)
|
||||
if inventory then
|
||||
for _, entry in pairs(v.imports) do
|
||||
|
||||
local function matchesFilter(item)
|
||||
if not entry.filter then
|
||||
return true
|
||||
end
|
||||
|
||||
local key = Milo:uniqueKey(item)
|
||||
if entry.blacklist then
|
||||
return not entry.filter[key]
|
||||
end
|
||||
return entry.filter[key]
|
||||
end
|
||||
|
||||
local function importSlot(slotNo)
|
||||
local item = inventory.getItemMeta(slotNo)
|
||||
if item and matchesFilter(item) then
|
||||
context.storage:import(source, slotNo, item.count, item)
|
||||
end
|
||||
end
|
||||
|
||||
if type(entry.slot) == 'number' then
|
||||
importSlot(entry.slot)
|
||||
else
|
||||
for i = 1, inventory.size() do
|
||||
importSlot(i)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user