Advertisement
phredeye

lumberjack

Sep 1st, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1.  
  2. local args = {...}
  3. if args[1] == nil then
  4.     print(args[0].." <radius>")
  5.     exit()
  6. end
  7.  
  8. function FellTree()
  9.     while turtle.detect() do
  10.         turtle.dig()
  11.         if turtle.detectUp() then
  12.             turtle.digUp()
  13.         end
  14.         turtle.up()
  15.     end
  16.  
  17.     while not turtle.detect() do
  18.         turtle.down()
  19.     end
  20. end
  21.  
  22. function DetectInSpiral(radius)
  23.  
  24.     for i = 1, radius do
  25.         for j = 1, i do
  26.             if turtle.detect() then
  27.                 FellTree()
  28.             else
  29.                 turtle.forward()
  30.             end
  31.         end
  32.     end
  33.     turtle.turnRight()
  34. end
  35.  
  36. DetectInSpiral(args[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement