Advertisement
CainDonaghey

Tree Turtle Initial Release v1.0 - Base Builder

Jun 21st, 2013
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.67 KB | None | 0 0
  1. if turtle.detectDown() then
  2. print("A base has already been built.")
  3. return
  4. end
  5.  
  6. function checkFuel()
  7. if turtle.getFuelLevel() < 1 then
  8. print("Turtle does not have enough fuel!")
  9. return
  10. else
  11. print("Beginning to build base!")
  12. end
  13. end
  14.  
  15. function checkStoneBricks()
  16. if turtle.getItemCount(1) < 1 then
  17. turtle.select(2)
  18. turtle.transferTo(1, 64)
  19. end
  20. if turtle.getItemCount(1) < 1 then
  21. turtle.select(3)
  22. turtle.transferTo(1, 64)
  23. end
  24. if turtle.getItemCount(1) < 1 then
  25. turtle.select(4)
  26. turtle.transferTo(1, 64)
  27. end
  28. if turtle.getItemCount(1) < 1 then
  29. turtle.select(5)
  30. turtle.transferTo(1, 64)
  31. end
  32. if turtle.getItemCount(1) < 1 then
  33. turtle.select(6)
  34. turtle.transferTo(1, 64)
  35. end
  36. turtle.select(1)
  37. end
  38.  
  39. function buildBottom()
  40. turtle.forward()
  41. turtle.turnRight()
  42. turtle.forward()
  43. turtle.down()
  44. for i=1,4 do
  45. for i2=1,20 do
  46. turtle.placeDown()
  47. turtle.forward()
  48. checkStoneBricks()
  49. end
  50. turtle.turnLeft()
  51. end
  52. turtle.up()
  53. turtle.back()
  54. turtle.turnLeft()
  55. turtle.back()
  56. end
  57.  
  58. function quickLoop()
  59. for i=1,15 do
  60. turtle.placeDown()
  61. turtle.forward()
  62. checkStoneBricks()
  63. end
  64. end
  65.  
  66. function buildFinal()
  67. for i=1,2 do turtle.forward() end
  68. turtle.turnRight()
  69. for i=1,2 do turtle.forward() end
  70. for i=1,2 do turtle.down() end
  71. for i=1,7 do
  72. quickLoop()
  73. turtle.turnLeft()
  74. turtle.forward()
  75. turtle.turnLeft()
  76. quickLoop()
  77. turtle.turnRight()
  78. turtle.forward()
  79. turtle.turnRight()
  80. end
  81.  
  82. for i=1,2 do turtle.up() end
  83. for i=1,2 do turtle.back() end
  84. turtle.turnLeft()
  85. for i=1,15 do turtle.back() end
  86. end
  87.  
  88. function buildTurtleBase()
  89. turtle.select(16)
  90. turtle.placeUp()
  91. turtle.turnLeft()
  92. turtle.place()
  93. turtle.turnRight()
  94. turtle.turnRight()
  95. turtle.place()
  96. turtle.turnLeft()
  97. for i=1,2 do turtle.back() end
  98. turtle.down()
  99. turtle.select(14)
  100. turtle.place()
  101. turtle.up()
  102. for i=1,2 do turtle.forward() end
  103. turtle.select(16)
  104. turtle.turnLeft()
  105. turtle.turnLeft()
  106. turtle.place()
  107. turtle.turnLeft()
  108. turtle.turnLeft()
  109. end
  110.  
  111. function dirtSetup()
  112. for i=1,8 do turtle.forward() end
  113. turtle.turnRight()
  114. for i=1,8 do turtle.forward() end
  115. turtle.select(15)
  116. turtle.placeDown()
  117. turtle.turnLeft()
  118. turtle.forward()
  119. turtle.placeDown()
  120. turtle.turnRight()
  121. turtle.forward()
  122. turtle.placeDown()
  123. turtle.turnRight()
  124. turtle.forward()
  125. turtle.placeDown()
  126. turtle.turnRight()
  127. for i=1,9 do turtle.forward() end
  128. turtle.turnRight()
  129. for i=1,8 do turtle.back() end
  130. end
  131.  
  132. function pipeSetup()
  133. turtle.forward()
  134. turtle.up()
  135. turtle.turnLeft()
  136. turtle.forward()
  137. turtle.turnRight()
  138. turtle.select(9)
  139. for i=1,8 do
  140. turtle.placeDown()
  141. turtle.forward()
  142. end
  143. turtle.turnRight()
  144. turtle.back()
  145. turtle.down()
  146. for i=1,4 do
  147. turtle.digDown()
  148. turtle.place()
  149. turtle.down()
  150. end
  151. turtle.digDown()
  152. turtle.down()
  153. for i=1,2 do
  154. turtle.forward()
  155. end
  156. for i=1,8 do
  157. turtle.digUp()
  158. turtle.placeUp()
  159. turtle.dig()
  160. turtle.forward()
  161. end
  162. turtle.dig()
  163. turtle.forward()
  164. for i=1,2 do
  165. turtle.digUp()
  166. turtle.up()
  167. end
  168. for i=1,2 do
  169. turtle.placeDown()
  170. turtle.up()
  171. end
  172. turtle.select(10)
  173. turtle.up()
  174. turtle.back()
  175. turtle.place()
  176. for i=1,2 do
  177. turtle.up()
  178. end
  179. for i=1,8 do turtle.back() end
  180. turtle.turnLeft()
  181. for i=1,8 do turtle.back() end
  182. print("Pipes placed.")
  183.  
  184. end
  185. checkFuel()
  186. checkStoneBricks()
  187. for i=1,17 do
  188. turtle.placeDown()
  189. turtle.forward()
  190. checkStoneBricks()
  191. end
  192. turtle.turnRight()
  193. for i=1,17 do
  194. turtle.placeDown()
  195. turtle.forward()
  196. checkStoneBricks()
  197. end
  198. turtle.turnRight()
  199. for i=1,17 do
  200. turtle.placeDown()
  201. turtle.forward()
  202. checkStoneBricks()
  203. end
  204. turtle.turnRight()
  205. for i=1,17 do
  206. turtle.placeDown()
  207. turtle.forward()
  208. checkStoneBricks()
  209. end
  210. turtle.turnRight()
  211. print("Frame built.")
  212. print("Awaiting next process.")
  213. buildBottom()
  214. buildFinal()
  215. buildTurtleBase()
  216. dirtSetup()
  217. -- pipeSetup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement