Guest User

ccrraazzyyman's Direwolf20 9x9 House Builder

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