Advertisement
darthgustav

tinykube.lua

Feb 20th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. -- TinyKube
  2. arg = {...}
  3.  
  4. local robot = require("robot")
  5.  
  6. require("undock")
  7.  
  8. require("machinework")
  9.  
  10. for j = 1,arg[1],1
  11. do
  12. --Move from Workspace toward Starting Corner
  13.  
  14. for i = 1,12,1
  15.  
  16. do
  17. robot.forward()
  18. end
  19.  
  20. --Face Starting Corner
  21. robot.turnRight()
  22.  
  23. --Move to Starting Corner
  24. robot.forward()
  25.  
  26. --Face Project Area
  27. robot.turnRight()
  28.  
  29. --Move into Working Position for placeDown
  30. robot.up()
  31.  
  32. --Work
  33.  
  34. --Select Stack 5
  35. robot.select(5)
  36.  
  37. --Place Walls on First Pass
  38. for i = 1,3,1
  39.  
  40. do
  41. --Move to Place Walls
  42. robot.forward()
  43.  
  44. --Place Wall
  45. robot.placeDown()
  46. end
  47.  
  48. --Select Stack 6
  49. robot.select(6)
  50.  
  51. --Move and Turn for Second Pass
  52. for i = 1,2,1
  53. do
  54. robot.forward()
  55. robot.turnRight()
  56. end
  57.  
  58. --Place Walls on Second Pass
  59.  
  60. for i = 1,3,1
  61. do
  62. --Move Forward
  63. robot.forward()
  64.  
  65. --Place Wall
  66. robot.placeDown()
  67. end
  68.  
  69. --Select Stack 7
  70. robot.select(7)
  71.  
  72. --Move and Turn for Final Pass Floor
  73. for i = 1,2,1
  74. do
  75. --Move Forward
  76. robot.forward()
  77.  
  78. --Turn Left
  79. robot.turnLeft()
  80. end
  81.  
  82. --Place Walls on Final Pass Floor
  83. for i = 1,3,1
  84.  
  85. do
  86. --Move Forward
  87. robot.forward()
  88.  
  89. --Place Wall
  90. robot.placeDown()
  91. end
  92.  
  93. --Select Stack 8
  94. robot.select(8)
  95.  
  96. --Move up for Walls
  97. robot.up()
  98.  
  99. --Build Walls
  100. for x = 1,4,1
  101.  
  102. do
  103. --Place First Wall Block on this Side
  104. robot.placeDown()
  105.  
  106. --Facing for Walls
  107. robot.turnLeft()
  108.  
  109. --Building First Walls
  110. for i = 1,2,1
  111.  
  112. do
  113. --Place Wall
  114. robot.placeDown()
  115.  
  116. --Move Forward
  117. robot.forward()
  118. end
  119. end
  120.  
  121. --Move Up for Ceiling
  122. robot.up()
  123.  
  124. --Select Stack 9
  125. robot.select(9)
  126.  
  127. --Facing Work Area
  128. for i = 1,2,1
  129. do
  130. robot.turnLeft()
  131. end
  132.  
  133. --Build Roof
  134. for i=1,3,1
  135.  
  136. do
  137. --Place Blocks on First Pass Ceiling
  138. robot.placeDown()
  139.  
  140. --Move to Place Next Block
  141. robot.forward()
  142. end
  143.  
  144. --Prepare for Second Pass Ceiling
  145. for i = 1,2,1
  146.  
  147. do
  148. --Turn Right before Next Pass
  149. robot.turnRight()
  150.  
  151. --Move forward before Next Pass
  152. robot.forward()
  153. end
  154.  
  155. --Place Blocks on First Pass Ceiling
  156. for i = 1,3,1
  157.  
  158. do
  159. --Place a Block
  160. robot.placeDown()
  161.  
  162. --Move Forward
  163. robot.forward()
  164. end
  165.  
  166. --Prepare for Final Pass Ceiling
  167. for i = 1,2,1
  168. do
  169.  
  170. --Turn Left for Final Pass Ceiling
  171. robot.turnLeft()
  172. --Move Forward for Final Pass Ceiling
  173. robot.forward()
  174. end
  175.  
  176. --Select Stack 10
  177. robot.select(10)
  178.  
  179. --Build Final Pass Ceiling
  180. for i = 1,3,1
  181.  
  182. do
  183. --Place Block
  184. robot.placeDown()
  185.  
  186. --Move Forward
  187. robot.forward()
  188. end
  189.  
  190. --Return to Shoot Pearl
  191.  
  192. --Turn Around
  193. for i=1,2,1
  194.  
  195. do
  196. robot.turnLeft()
  197. end
  198.  
  199. --Move toward Pearl Dispenser
  200. for i = 1,4,1
  201.  
  202. do
  203. robot.forward()
  204. end
  205.  
  206. --Turn Toward Pearl Dispenser
  207. robot.turnRight()
  208.  
  209. --Move Toward Pearl Dispenser
  210. robot.forward()
  211.  
  212. --Turn Toward Pearl Dispenser
  213. robot.turnLeft()
  214.  
  215. --Move to Pearl Dispenser Y Level
  216. robot.down()
  217.  
  218. --Move Toward Pearl Dispenser
  219. for i = 1,7,1
  220.  
  221. do
  222. robot.forward()
  223. end
  224.  
  225. --Turn to Shoot Pearl
  226. robot.turnLeft()
  227.  
  228. --Select Slot 47
  229. robot.select(47)
  230.  
  231. --Shoot Pearl
  232. robot.use()
  233.  
  234. --Move Down from Button
  235. for i = 1,2,1
  236.  
  237. do
  238. robot.down()
  239. end
  240.  
  241. --Move Toward Work Area
  242. robot.forward()
  243.  
  244. --Face Work Area
  245. robot.turnRight()
  246.  
  247. --Enter Work Area
  248. robot.forward()
  249.  
  250. --Face Field Area
  251. for i = 1,34,1
  252.  
  253. do
  254. robot.turnRight()
  255. end
  256.  
  257. if j % 3 == 0 then
  258. require("machineworkreturn")
  259. require("restock")
  260. require("machinework")
  261.  
  262. end
  263. end
  264.  
  265. require("machineworkreturn")
  266. require("restock")
  267. require("dock")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement