commit
37bcfea10d
@ -0,0 +1,48 @@
|
||||
local component = require('component')
|
||||
local event = require('event')
|
||||
local serialization = require('serialization')
|
||||
local sides = require('sides')
|
||||
|
||||
local transposer = component.proxy(component.get("260", "transposer"))
|
||||
|
||||
IN_DIR = sides.south
|
||||
OUT_DIR = sides.north
|
||||
|
||||
while true do
|
||||
|
||||
local up = transposer.getAllStacks(IN_DIR)
|
||||
local stack = up()
|
||||
local slot = 1
|
||||
while stack do
|
||||
if stack.name then
|
||||
print(serialization.serialize(stack))
|
||||
|
||||
-- find the first empty slot
|
||||
local output = transposer.getAllStacks(OUT_DIR)
|
||||
local output_stack = output()
|
||||
local dest_slot = 1
|
||||
while output_stack do
|
||||
-- find stack that matches item
|
||||
if not output_stack.name then
|
||||
break
|
||||
end
|
||||
dest_slot = dest_slot + 1
|
||||
output_stack = output()
|
||||
end
|
||||
if dest_slot > transposer.getInventorySize(OUT_DIR) then
|
||||
print("Bottom inventory full")
|
||||
break
|
||||
end
|
||||
local result = transposer.transferItem(IN_DIR, OUT_DIR, stack.size, slot, dest_slot)
|
||||
print(result)
|
||||
-- todo handle if not everything was transfered
|
||||
end
|
||||
stack = up()
|
||||
slot = slot + 1
|
||||
end
|
||||
|
||||
-- "sleep"
|
||||
if event.pull(2, "interrupted") then
|
||||
break
|
||||
end
|
||||
end
|
Loading…
Reference in new issue