Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local transposer = component.transposer
- local thread = require("thread")
- local chestSlots = transposer.getInventorySize(sides.front)
- local activeSlot = 1
- local allowedStackSize = 9
- print("Input chest has " .. chestSlots .. " slots")
- print("Allowed stack size: " .. allowedStackSize)
- while(true) do
- if(activeSlot > chestSlots) then activeSlot = 1 end
- --Check if less than transferStackSize -- if so, increment activeSlot by 1 and loop
- --Else check destination is ready
- --Once ready, send stack
- --Loop
- local activeSlotStackSize = transposer.getSlotStackSize(sides.front,activeSlot)
- local continue = true
- print("Active Slot Stack Size: " .. activeSlotStackSize)
- if(activeSlotStackSize < allowedStackSize) then
- activeSlot = activeSlot + 1
- continue = false
- end
- while(continue) do
- if(transposer.getSlotStackSize(sides.back,1) == 0) then
- transposer.transferItem(sides.front, sides.back, allowedStackSize,activeSlot,1)
- continue = false
- print("Compressed 1 stack from slot " .. activeSlot)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement