Advertisement
jschuldes

rig

Jan 17th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. -- oil rig robot
  2.  
  3. -- pastebin -f get kZz5xtJg rig
  4.  
  5. local component = require("component")
  6. local robot = require("robot")
  7. local computer = require("computer")
  8.  
  9. function chargeup()
  10.   robot.use()
  11.   robot.turnLeft()
  12.   robot.forward()
  13.   os.sleep(10)
  14.   robot.back()
  15.   robot.turnRight()
  16.   robot.use()
  17. end
  18.  
  19. function turnR()
  20.   robot.turnRight()
  21. end
  22.  
  23. function turnL()
  24.   robot.turnLeft()
  25. end
  26.  
  27. function goFwd(x)
  28.   for i = 1, x do
  29.     robot.forward()
  30.   end
  31. end
  32.  
  33. function wait(x)
  34.   os.sleep(x)
  35. end
  36.  
  37. function beep(z)
  38.   for i = 1, z do
  39.     computer.beep()
  40.   end
  41. end
  42. -- charge up for 10 secs
  43. chargeup()
  44.  
  45. -- route after charging
  46. turnL()
  47. turnL()
  48.  
  49. goFwd(31)
  50. turnL()
  51.  
  52. goFwd(11)
  53. wait(3)
  54. -- inspecting the reactor
  55. beep(2)
  56. wait(2)
  57. beep(1)
  58. wait(1)
  59. turnL()
  60.  
  61. goFwd(7)
  62. turnR()
  63.  
  64. goFwd(7)
  65. wait(5)
  66. -- checking the capacitor bank
  67. beep(2)
  68. wait(1)
  69. turnL()
  70. turnL()
  71.  
  72. goFwd(5)
  73. turnR()
  74.  
  75. goFwd(4)
  76. robot.up()
  77. goFwd(10)
  78. turnL()
  79. goFwd(2)
  80. turnR()
  81. goFwd(2)
  82. robot.up()
  83. goFwd(1)
  84. wait(1)
  85. -- adjusting the drill pipe
  86. beep(1)
  87. wait(1)
  88. turnL()
  89. goFwd(3)
  90. robot.down()
  91. goFwd(5)
  92. turnR()
  93. goFwd(4)
  94. robot.down()
  95. goFwd(3)
  96. turnL()
  97. goFwd(3)
  98. turnR()
  99. -- parked at the charger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement