Leonardvdj

Treefarm

Nov 16th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. turtle.select(1)
  2. function cutTree()
  3.     turtle.select(2)
  4.     turtle.dig()
  5.     turtle.forward()
  6.     turtle.digDown()
  7.     while turtle.detectUp() do
  8.         if turtle.detect() then
  9.             for i=1,4 do
  10.                 turtle.dig()
  11.                 turtle.turnLeft()
  12.             end
  13.         end
  14.         turtle.digUp()
  15.         turtle.up()
  16.     end
  17.     while not turtle.detectDown() do
  18.         turtle.down()
  19.     end
  20.     turtle.back()
  21.     turtle.select(1)
  22.     loop()
  23. end
  24.  
  25. function checkGrowth()
  26.     turtle.up()
  27.     if turtle.detect() then
  28.         cutTree()
  29.     else
  30.         turtle.down()
  31.     end
  32. end
  33.  
  34. function loop()
  35.     if not turtle.detect() then
  36.         turtle.place()
  37.     end
  38.     checkGrowth()
  39.     sleep(10)
  40.     loop()
  41. end
  42.  
  43. loop()
Add Comment
Please, Sign In to add comment