SkiFire13

9x9 UnderGround Room Maker

Jun 5th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.81 KB | None | 0 0
  1. print("SkiFire13 underground room maker")
  2. print("Insert 9 coal in the first slot")
  3. print("Insert 10 glass in the second slot")
  4. print("Insert 10 glowstone in the third slot")
  5. print("Press ENTER to start")
  6. io.read()
  7.  
  8. local Start, Finished
  9. Start = 1
  10. Finished = 1
  11.  
  12. function digThreeForOne()
  13.         turtle.dig()
  14.         turtle.forward()
  15.         turtle.turnLeft()
  16.         turtle.dig()
  17.         turtle.turnLeft()
  18.         turtle.turnLeft()
  19.         turtle.dig()
  20.         turtle.turnLeft()
  21.         turtle.back()
  22. end
  23.  
  24. function digThreeForThree()
  25.         for i=0,2,1 do
  26.         digThreeForOne()
  27.         turtle.forward()
  28.         end
  29.         for i=0,2,1 do
  30.         turtle.back()
  31.         end
  32. end
  33.  
  34. function placeGlowDown()
  35.         if turtle.detectDown() then
  36.                 turtle.digDown()
  37.                 turtle.down()
  38.                 turtle.digDown()
  39.                 turtle.select(3)
  40.                 turtle.placeDown()
  41.                 turtle.up()
  42.                 turtle.select(2)
  43.                 turtle.placeDown()
  44.         end
  45. end
  46.  
  47. function placeGlowUp()
  48.         if turtle.detectUp() then
  49.                 turtle.digUp()
  50.                 turtle.up()
  51.                 turtle.digUp()
  52.                 turtle.select(3)
  53.                 turtle.placeUp()
  54.                 turtle.down()
  55.                 turtle.select(2)
  56.                 turtle.placeUp()
  57.         end
  58. end
  59.  
  60. function placeGlow(Start, Finished)
  61.         if Start==0 then
  62.             placeGlowDown()
  63.         end
  64.         if Finished==0 then
  65.             placeGlowUp()
  66.         end
  67. end
  68.  
  69. function Flat()
  70.         digThreeForOne()
  71.         turtle.forward()
  72.        
  73.         turtle.dig()
  74.         turtle.forward()
  75.         placeGlow(Start, Finished)
  76.         turtle.back()
  77.        
  78.         for i=0,2,1 do
  79.                 digThreeForThree()
  80.                 for i=0,2,1 do
  81.                 turtle.forward()
  82.                 end
  83.         end
  84.         digThreeForOne()
  85.         placeGlow(Start, Finished)
  86.         for i=0,1,1 do
  87.                 turtle.turnLeft()
  88.                 turtle.forward()
  89.         end
  90.         turtle.turnRight()
  91.         digThreeForThree()
  92.         for i=0,1,1 do
  93.                 turtle.turnLeft()
  94.                 for i=0,2,1 do
  95.                         turtle.forward()
  96.                 end
  97.                 turtle.turnRight()
  98.                 digThreeForThree()
  99.         end
  100.        
  101.         turtle.turnLeft()
  102.         turtle.turnLeft()
  103.         turtle.forward()
  104.         turtle.forward()
  105.        
  106.         digThreeForThree()
  107.         for i=0,1,1 do
  108.                 turtle.turnLeft()
  109.                 for i=0,2,1 do
  110.                         turtle.forward()
  111.                 end
  112.                 turtle.turnRight()
  113.                 digThreeForThree()
  114.         end
  115.         turtle.forward()
  116.         turtle.forward()
  117.         turtle.forward()
  118.         turtle.turnRight()
  119.         turtle.forward()
  120.         turtle.forward()
  121.         turtle.forward()
  122.         turtle.turnLeft()
  123.        
  124.         digThreeForOne()
  125.         placeGlow(Start, Finished)
  126.        
  127.         turtle.turnLeft()
  128.         turtle.turnLeft()
  129.        
  130.         turtle.forward()
  131.         turtle.forward()
  132.         turtle.forward()
  133.         turtle.forward()
  134.         turtle.forward()
  135.         turtle.forward()
  136.         turtle.forward()
  137.         turtle.forward()
  138.        
  139.         digThreeForOne()
  140.         placeGlow(Start, Finished)
  141.        
  142.         turtle.back()
  143.         turtle.back()
  144.         turtle.back()
  145.         turtle.back()
  146.        
  147.         turtle.turnRight()
  148.         placeGlow(Start, Finished)
  149.        
  150.         turtle.back()
  151.         turtle.back()
  152.         turtle.back()
  153.         turtle.back()
  154.         turtle.back()
  155.         turtle.back()
  156.        
  157. end
  158.  
  159. turtle.refuel(9)
  160.  
  161. Start = 0
  162. Flat()
  163. Start = 1
  164. turtle.digUp()
  165. turtle.up()
  166. Flat()
  167. turtle.digUp()
  168. turtle.up()
  169. Flat()
  170. turtle.digUp()
  171. turtle.up()
  172. Finished = 0
  173. Flat()
  174. Finished = 1
  175.  
  176. turtle.down()
  177. turtle.down()
  178. turtle.down()
  179. turtle.down()
  180.  
  181.  
  182.  
  183. print("Turtle has finished!")
Advertisement
Add Comment
Please, Sign In to add comment