SHOW:
|
|
- or go back to the newest paste.
| 1 | local extractor = peripheral.wrap("back")
| |
| 2 | - | local storageChest = peripheral.wrap("container_chest_0")
|
| 2 | + | local storageChest = peripheral.wrap("container_chest_1")
|
| 3 | ||
| 4 | local function tableCount(inputTable) | |
| 5 | local count = 0 | |
| 6 | for _ in pairs(inputTable) do count = count + 1 end | |
| 7 | return count | |
| 8 | end | |
| 9 | ||
| 10 | while true do | |
| 11 | print("sleeping")
| |
| 12 | sleep(1) | |
| 13 | - | print("processing redstone") -- This takes a comparitor input (from an industrial coil) from the right,
|
| 13 | + | print("exporting stuffed items to chest")
|
| 14 | - | -- lets the extractor run if the value is 2+, forces it to run if it is |
| 14 | + | storageChest.pullItem("west", 2)
|
| 15 | - | -- 4+ (to prevent explosions) and will stop the extractor if it drops below 1 |
| 15 | + | storageChest.pullItem("east", 4)
|
| 16 | - | -- It also checks to see if any actual work needs doing |
| 16 | + | storageChest.pullItem("west", 2)
|
| 17 | - | --if redstone.getAnalogInput("right") == 0 then
|
| 17 | + | storageChest.pullItem("east", 4)
|
| 18 | - | -- redstone.setOutput("left",false)
|
| 18 | + | |
| 19 | - | --else |
| 19 | + | |
| 20 | - | if redstone.getAnalogInput("right") > 4 then
|
| 20 | + | |
| 21 | - | redstone.setOutput("left",true)
|
| 21 | + | |
| 22 | - | elseif tableCount(extractor.getAllStacks()) ~= 0 --[[ and redstone.getAnalogInput("right") > 2 ]] then
|
| 22 | + | |
| 23 | - | redstone.setOutput("left",true)
|
| 23 | + | |
| 24 | - | else |
| 24 | + | |
| 25 | - | redstone.setOutput("left",false)
|
| 25 | + | if j == 4 then |
| 26 | storageChest.pushItemIntoSlot("west",i,j)
| |
| 27 | - | print("exporting stuffed items to chest") -- Grab items from the bottom left 3 slots of the extractor
|
| 27 | + | |
| 28 | - | for i = 2,4,1 do |
| 28 | + | storageChest.pushItemIntoSlot("east",i,j)
|
| 29 | - | print("slot "..i)
|
| 29 | + | |
| 30 | - | storageChest.pullItem("west", i)
|
| 30 | + | |
| 31 | end | |
| 32 | end |