Advertisement
DaikiKaminari

CircleKettleWitchery

Jul 14th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. --- CONFIG ---
  2. local inputChestSide = "top" -- string : side where is the input chest
  3. local inputChest -- table : peripheral, input chest
  4. local outputChestSide = "up" -- string : side where is the output chest compared to input chest
  5. local redstoneSide = "back" -- string : side where redstone should be output
  6.  
  7. --- FUNCTIONS ---
  8. local function loadAPI()
  9. if not fs.exists("lib/inventory") then
  10. error("File not found : [lib/inventory]")
  11. end
  12. os.loadAPI("lib/inventory")
  13. end
  14.  
  15. local function init()
  16. redstone.setOutput(redstoneSide, false)
  17. inputChest = peripheral.wrap(inputChestSide)
  18. if inputChest == nil then
  19. error("No container found on side : [" .. inputChestSide .. "]")
  20. end
  21. end
  22.  
  23. local function process()
  24. if inventory.containsItem(inputChest) then
  25. inventory.moveAllItems(inputChest, outputChestSide)
  26. redstone.setOutput(redstoneSide, true)
  27. sleep(1)
  28. redstone.setOutput(redstoneSide, false)
  29. sleep(10)
  30. end
  31. end
  32.  
  33. --- MAIN ---
  34. local function main()
  35. loadAPI()
  36. init()
  37. while true do
  38. process()
  39. sleep(1)
  40. end
  41. end
  42.  
  43. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement