druidbruce

OC robot runic altar

Feb 23rd, 2020
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. local component = require("component")
  2. local sides = require("sides")
  3. local os = require("os")
  4. local robot = require("robot")
  5. local inv = component.inventory_controller
  6. local red = component.redstone
  7. local pulsetime = 0.25
  8.  
  9. local function pulse(PT)
  10. red.setOutput(sides.back,15)
  11. os.sleep(PT)
  12. red.setOutput(sides.back,0)
  13. end
  14. local function dropcomparenot(slot)
  15. robot.select(slot)
  16. N = robot.count(slot)
  17. if not robot.compareTo(16) and N>0 then
  18. inv.equip()
  19. for i = 1, N do
  20. robot.useDown()
  21. end
  22. end
  23. end
  24. local function dropcompare(slot)
  25. robot.select(slot)
  26. if robot.compareTo(16) then
  27. robot.dropDown(1)
  28. end
  29. end
  30. local function activatealtar()
  31. for i = 2, 15 do --dropping living rock
  32. dropcompare(i)
  33. end
  34. robot.down()
  35. robot.select(1)
  36. robot.placeDown()
  37. end
  38. while true do
  39.  
  40. if robot.count(2) and robot.count(3) > 0 and red.getComparatorInput(sides.down) == 0 then
  41. os.sleep(0.1)
  42. for i = 2, 15 do --use all items except living rock
  43. dropcomparenot(i)
  44. end
  45. while true do
  46.  
  47. if red.getComparatorInput(sides.down) == 2 then
  48. break
  49. end
  50. os.sleep(0.2)
  51. end
  52. robot.up()
  53. activatealtar()
  54. os.sleep(0.1)
  55. for i = 2, 15 do
  56. robot.select(i)
  57. robot.drop()
  58. end
  59. pulse(pulsetime)
  60.  
  61. end
  62. os.sleep(0.2)
  63.  
  64.  
  65. end
Advertisement
Add Comment
Please, Sign In to add comment