Advertisement
TyanColte

DW20 9x9

Mar 4th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.89 KB | None | 0 0
  1. --coded by ccrraazzyyman.
  2. --Do what you want with this code, just give me credit if you
  3. --use it :D/>/>
  4. slot = 1
  5. print("Direwolf20's 9x9 House builder")
  6. print("Slots 1-3 = Walls (2.5 Stacks)")
  7. print("Slot 4 = Floor (49 blocks)")
  8. print("Slot 5 = Ceiling Middle (33 blocks)")
  9. print("Slot 6 = Glass (16 blocks)")
  10. print("Press any key to start")
  11. io.read()
  12. function wall9()
  13. digg()
  14. for x=1, 9, 1 do
  15.   turtle.forward()
  16.   digDown()
  17.   placeDown()
  18.   digg()
  19. end
  20. end
  21. function wall8()
  22. digg()
  23. for x=1, 8, 1 do
  24.   turtle.forward()
  25.   digDown()
  26.   placeDown()
  27.   digg()
  28. end
  29. end
  30. function wall7()
  31. digg()
  32. for x=1, 7, 1 do
  33.   turtle.forward()
  34.   digDown()
  35.   placeDown()
  36.   digg()
  37. end
  38. end
  39. function layer()
  40. turtle.up()
  41. wall9()
  42. turtle.turnRight()
  43. wall8()
  44. turtle.turnRight()
  45. wall8()
  46. turtle.turnRight()
  47. wall7()
  48. turtle.forward()
  49. turtle.turnRight()
  50. turtle.back()
  51. print("Layer completed")
  52. end
  53.  
  54. function ceiling()
  55. turtle.select(5)
  56. turtle.forward()
  57. ceilingRow()
  58. rightTurn()
  59. ceilingRowGlass()
  60. leftTurn()
  61. ceilingRowGlass()
  62. rightTurn()
  63. ceilingRow()
  64. leftTurn()
  65. ceilingRowGlass()
  66. rightTurn()
  67. ceilingRowGlass()
  68. leftTurn()
  69. ceilingRow()
  70. print("Ceiling Completed")
  71. end
  72. function ceilingRow()
  73. for x=1, 7, 1 do
  74.   turtle.placeDown()
  75.   if x==7 then
  76.    break end
  77.   turtle.forward()
  78. end
  79. end
  80. function ceilingRowGlass()
  81. turtle.placeDown()
  82. turtle.forward()
  83. turtle.select(6)
  84. for x=1, 2, 1 do
  85.   turtle.placeDown()
  86.   turtle.forward()
  87. end
  88. turtle.select(5)
  89. turtle.placeDown()
  90. turtle.forward()
  91. turtle.select(6)
  92. for x=1, 2, 1 do
  93.   turtle.placeDown()
  94.   turtle.forward()
  95. end
  96. turtle.select(5)
  97. turtle.placeDown()
  98. end
  99. function floor()
  100. turtle.select(4)
  101. turtle.forward()
  102. turtle.forward()
  103. turtle.turnRight()
  104. turtle.forward()
  105. turtle.turnLeft()
  106. for x=1, 5, 1 do
  107.   turtle.down()
  108. end
  109. for x=1, 3, 1 do
  110.   floorRow()
  111.   rightTurn()
  112.   floorRow()
  113.   leftTurn()
  114. end
  115. floorRow()
  116. for x=1, 5, 1 do
  117.   turtle.up()
  118. end
  119. turtle.forward()
  120. turtle.turnLeft()
  121. turtle.turnLeft()
  122. print("Floor Completed")
  123. end
  124. function floorRow()
  125. for x=1, 7, 1 do
  126.   digDown()
  127.   turtle.placeDown()
  128.   turtle.forward()
  129. end
  130. end
  131. function rightTurn()
  132. turtle.turnRight()
  133. turtle.forward()
  134. turtle.turnRight()
  135. end
  136. function leftTurn()
  137. turtle.turnLeft()
  138. turtle.forward()
  139. turtle.turnLeft()
  140. end
  141. function digg()
  142. while turtle.detect() do
  143.   turtle.dig()
  144.   sleep(.4)
  145. end
  146. end
  147. function digDown()
  148. if turtle.detectDown() then
  149.   turtle.digDown() end
  150. end
  151. function detect()
  152. turtle.select(slot)
  153. if turtle.getItemCount(slot) == 0 then
  154.   slot = slot + 1
  155. end
  156. end
  157. function place()
  158. detect()
  159. turtle.place()
  160. end
  161. function placeDown()
  162. detect()
  163. turtle.placeDown()
  164. end
  165. function goHome()
  166. turtle.turnRight()
  167. turtle.forward()
  168. turtle.turnLeft()
  169. turtle.forward()
  170. turtle.forward()
  171. for x=1, 5, 1 do
  172.   turtle.down()
  173. end
  174. print("Arriving at starting point")
  175. end
  176. for x=1, 5, 1 do
  177. layer()
  178. end
  179. floor()
  180. ceiling()
  181. goHome()
  182. print("---9x9 Completed---")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement