CrushDust

Tree farm 5x5 (3 blocks between)

Jun 27th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.72 KB | None | 0 0
  1. local h = 9     --treeHeight (spurce9)
  2. h = h - 2
  3.  
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. print("Waiting 20 mins to start operation!")
  7. sleep(1200) --20 min
  8.  
  9. function plant()
  10.     turtle.forward()
  11.     turtle.turnLeft()
  12.     turtle.turnLeft()
  13.     turtle.select(15)
  14.     turtle.place()
  15.     turtle.select(1)
  16.     turtle.turnLeft()
  17.     turtle.turnLeft()
  18. end
  19.  
  20. function plantUp()
  21.     turtle.dig()
  22.     turtle.forward()
  23.     turtle.digUp()
  24.     turtle.up()
  25.     turtle.select(15)
  26.     turtle.placeDown()
  27.     turtle.select(1)
  28. end
  29.  
  30. local s = 0
  31.  
  32. while s == 0 do
  33. print("Operation started")
  34.  
  35. if turtle.getFuelLevel() < 200 then
  36.     turtle.turnLeft()    
  37.     turtle.select(16)
  38.     if turtle.suck(8) == false then
  39.         s = 1
  40.     end
  41.     turtle.refuel(8)
  42.     turtle.select(1)
  43.     turtle.turnRight()
  44. end
  45.    
  46. turtle.select(15)
  47. if turtle.suckUp(16) == false then
  48.     s = 1
  49. end
  50. turtle.select(1)
  51.  
  52. for x = 1, 2 do                     --First row
  53.    
  54.     plantUp()
  55.  
  56.     for x = 1, h do
  57.         turtle.digUp()
  58.         turtle.up()
  59.     end                             --Turtle on top of tree
  60.    
  61.     for x = 1, 4 do
  62.         turtle.dig()
  63.         turtle.forward()
  64.     end                             --Turtle on top of second tree
  65.        
  66.     for x = 1, h+1 do
  67.         turtle.digDown()
  68.         turtle.down()
  69.     end                             --Turtle on bottom of second tree
  70.        
  71.     plant()
  72.  
  73.     for x = 1, 2 do
  74.         turtle.forward()
  75.     end                             --Turtle on bottom of third tree
  76.  
  77. end                                 --End of first row
  78.    
  79. turtle.turnRight()                  --Middle point start
  80.     for x = 1, 4 do
  81.     turtle.forward()
  82. end
  83.  
  84. turtle.turnRight()
  85. for x = 1, 2 do
  86.     turtle.forward()
  87. end                                 --Middle point end
  88.  
  89.  
  90.    
  91. for x = 1, 2 do                     --Second row
  92.    
  93.     plantUp()
  94.  
  95.     for x = 1, h do
  96.         turtle.digUp()
  97.         turtle.up()
  98.     end                             --Turtle on top of tree
  99.    
  100.     for x = 1, 4 do
  101.         turtle.dig()
  102.         turtle.forward()
  103.     end                             --Turtle on top of second tree
  104.        
  105.     for x = 1, h+1 do
  106.         turtle.digDown()
  107.         turtle.down()
  108.     end                             --Turtle on bottom of second tree
  109.    
  110.     plant()
  111.  
  112.     for x = 1, 2 do
  113.         turtle.forward()
  114.     end                             --Turtle on bottom of third tree
  115.            
  116.  
  117. end                                 --End of second row
  118.  
  119.  
  120. turtle.turnLeft()                   --Middle point start
  121.     for x = 1, 4 do
  122.     turtle.forward()
  123. end
  124.  
  125. turtle.turnLeft()
  126. for x = 1, 2 do
  127.     turtle.forward()
  128. end                                 --Middle point end 
  129.  
  130.  
  131. for x = 1, 2 do                     --Third row
  132.    
  133.     plantUp()  
  134.  
  135.     for x = 1, h do
  136.         turtle.digUp()
  137.         turtle.up()
  138.     end                             --Turtle on top of tree
  139.    
  140.     for x = 1, 4 do
  141.         turtle.dig()
  142.         turtle.forward()
  143.     end                             --Turtle on top of second tree
  144.        
  145.     for x = 1, h+1 do
  146.         turtle.digDown()
  147.         turtle.down()
  148.     end                             --Turtle on bottom of second tree
  149.        
  150.     plant()
  151.  
  152.     for x = 1, 2 do
  153.         turtle.forward()
  154.     end                             --Turtle on bottom of third tree
  155.  
  156. end                                 --End of Thrid row
  157.    
  158.    
  159. turtle.turnRight()                  --Middle point start
  160.     for x = 1, 4 do
  161.     turtle.forward()
  162. end
  163.  
  164. turtle.turnRight()
  165. for x = 1, 2 do
  166.     turtle.forward()
  167. end                                 --Middle point end
  168.  
  169.  
  170.  
  171. for x = 1, 2 do                     --Fourth row
  172.    
  173.     plantUp()
  174.  
  175.     for x = 1, h do
  176.         turtle.digUp()
  177.         turtle.up()
  178.     end                             --Turtle on top of tree
  179.    
  180.     for x = 1, 4 do
  181.         turtle.dig()
  182.         turtle.forward()
  183.     end                             --Turtle on top of second tree
  184.        
  185.     for x = 1, h+1 do
  186.         turtle.digDown()
  187.         turtle.down()
  188.     end                             --Turtle on bottom of second tree
  189.        
  190.     plant()
  191.  
  192.     for x = 1, 2 do
  193.         turtle.forward()
  194.     end                             --Turtle on bottom of third tree
  195.  
  196. end                                 --End of Fourth row
  197.  
  198. turtle.turnRight()
  199. for x = 1, 12 do
  200.     turtle.forward()
  201. end
  202. turtle.turnRight()
  203.  
  204. for x = 1, 2 do
  205.     turtle.forward()
  206. end
  207.    
  208. turtle.turnRight()
  209.  
  210.  
  211. for x = 2, 13 do
  212.     if turtle.drop(64) == false then
  213.         s = 1
  214.     end
  215.     turtle.select(x)
  216. end
  217.  
  218. turtle.turnLeft()
  219. print("Operation completed, waiting 20 minutes to start over")
  220. shell.run("startup")
  221. end
  222.  
  223. print("Out of fuel or storage!")
Add Comment
Please, Sign In to add comment