Advertisement
LastElf

9by9 Builder

Nov 21st, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.87 KB | None | 0 0
  1. print("Direwolf20's 9x9 House builder")
  2. print("Slots 1-4 = Walls (32 per slot)")
  3. print("Slot 5 = Floor (49 blocks)")
  4. print("Slot 6 = Ceiling (65 blocks)")
  5. print("Slot 7 = Glass (16 blocks)")
  6. print("Press any key to start")
  7. io.read()
  8.  
  9. --New Forward to stop turtle getting stuck on blocks--
  10. function buildForward()
  11.     while turtle.detect() == true do
  12.     turtle.dig()
  13.     sleep(0.4)
  14.     end
  15. turtle.forward()
  16. end
  17.  
  18. --New Place that digs anything below to ensure the right block is placed--
  19. function buildPlaceDown()
  20.     if turtle.detectDown() == true then
  21.     turtle.digDown()
  22.     turtle.placeDown()
  23.     else
  24.     turtle.placeDown()
  25.     end
  26. end
  27.  
  28. --Build a layer of the room--
  29. function buildLayer()
  30.     turtle.up()
  31.     turtle.back()
  32.     for i=1, 9, 1 do
  33.         buildForward()
  34.         buildPlaceDown()
  35.     end
  36.     turtle.turnRight()
  37.     for i=1, 8, 1 do
  38.         buildForward()
  39.         buildPlaceDown()
  40.     end
  41.     turtle.turnRight()
  42.     for i=1, 8, 1 do
  43.         buildForward()
  44.         buildPlaceDown()
  45.     end
  46.     turtle.turnRight()
  47.     for i=1, 7, 1 do
  48.         buildForward()
  49.         buildPlaceDown()
  50.     end
  51.     buildForward()
  52.     turtle.turnRight()
  53. end
  54.  
  55. --Build ceiling row--
  56. function ceilingRow()
  57.     turtle.select(6)
  58.     for i=1, 9, 1 do
  59.         buildPlaceDown()
  60.         buildForward()
  61.     end
  62. end
  63.  
  64. --Build ceiling row with glass--
  65. function ceilingGlass()
  66.     turtle.select(6)
  67.     for i=1, 2, 1 do
  68.         buildPlaceDown()
  69.         buildForward()
  70.     end
  71.     turtle.select(7)
  72.     for i=1, 2, 1 do
  73.         buildPlaceDown()
  74.         buildForward()
  75.     end
  76.     turtle.select(6)
  77.     buildPlaceDown()
  78.     buildForward()
  79.     turtle.select(7)
  80.     for i=1, 2, 1 do
  81.         buildPlaceDown()
  82.         buildForward()
  83.     end
  84.     turtle.select(6)
  85.     for i=1, 2, 1 do
  86.         buildPlaceDown()
  87.         buildForward()
  88.     end
  89. end
  90.  
  91. --Ceiling turning functions--
  92. function turnRight()
  93.     turtle.turnRight()
  94.     buildForward()
  95.     turtle.turnRight()
  96.     buildForward() 
  97. end
  98.  
  99. function turnLeft()
  100.     turtle.turnLeft()
  101.     buildForward()
  102.     turtle.turnLeft()
  103.     buildForward()
  104. end
  105.  
  106. --Ceiling combined--
  107. function buildCeiling()
  108.     turtle.up()
  109.     ceilingRow()
  110.     turnRight()
  111.     ceilingRow()
  112.     turnLeft()
  113.     ceilingGlass()
  114.     turnRight()
  115.     ceilingGlass()
  116.     turnLeft()
  117.     ceilingRow()
  118.     turnRight()
  119.     ceilingGlass()
  120.     turnLeft()
  121.     ceilingGlass()
  122.     turnRight()
  123.     ceilingRow()
  124.     turnLeft()
  125.     ceilingRow()
  126. end
  127.  
  128. --Build the floor--
  129. function buildFloorRow()
  130.     for i=1, 7, 1 do
  131.         buildPlaceDown()
  132.         buildForward()
  133.     end
  134. end
  135.  
  136. function buildFloor()
  137.     turtle.select(5)
  138.     buildFloorRow()
  139.     turnRight()
  140.     buildFloorRow()
  141.     turnLeft()
  142.     buildFloorRow()
  143.     turnRight()
  144.     buildFloorRow()
  145.     turnLeft()
  146.     buildFloorRow()
  147.     turnRight()
  148.     buildFloorRow()
  149.     turnLeft()
  150.     buildFloorRow()
  151. end
  152.  
  153. --All of it together--
  154. buildForward()
  155. turtle.turnRight()
  156. buildForward()
  157. turtle.turnLeft()
  158. buildFloor()
  159. turtle.turnRight()
  160. buildForward()
  161. turtle.turnRight()
  162. turtle.select(1)
  163. buildLayer()
  164. turtle.select(2)
  165. buildLayer()
  166. turtle.select(3)
  167. buildLayer()
  168. turtle.select(4)
  169. buildLayer()
  170. buildCeiling()
  171.  
  172. print("---9x9 Completed---")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement