Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- CONFIG ---
- local inputChestSide = "top" -- string : side where is the input chest
- local inputChest -- table : peripheral, input chest
- local outputChestSide = "up" -- string : side where is the output chest compared to input chest
- local redstoneSide = "back" -- string : side where redstone should be output
- --- FUNCTIONS ---
- local function loadAPI()
- if not fs.exists("lib/inventory") then
- error("File not found : [lib/inventory]")
- end
- os.loadAPI("lib/inventory")
- end
- local function init()
- redstone.setOutput(redstoneSide, false)
- inputChest = peripheral.wrap(inputChestSide)
- if inputChest == nil then
- error("No container found on side : [" .. inputChestSide .. "]")
- end
- end
- local function process()
- if inventory.containsItem(inputChest) then
- inventory.moveAllItems(inputChest, outputChestSide)
- redstone.setOutput(redstoneSide, true)
- sleep(1)
- redstone.setOutput(redstoneSide, false)
- sleep(10)
- end
- end
- --- MAIN ---
- local function main()
- loadAPI()
- init()
- while true do
- process()
- sleep(1)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement