Advertisement
legg0028

log

Sep 20th, 2013
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local tArgs = { ... }
  2.  
  3. if tArgs[1] ~= "star" then
  4.   wide = tonumber(tArgs[1])
  5.   if not wide then
  6.     print("log <tree width>")
  7.     return
  8.   end
  9. else
  10.   wide = "star"
  11. end
  12.  
  13. function cut()
  14.   repeat
  15.     turtle.dig()
  16.     turtle.digUp()
  17.     turtle.up()
  18.   until turtle.dig() == false
  19.   repeat
  20.     sleep(0)
  21.   until (not turtle.down())
  22. end
  23.  
  24. if wide == "star" then
  25.   turtle.dig()
  26.   turtle.forward()
  27.   turtle.dig()
  28.   turtle.forward()
  29.   repeat
  30.     for x = 1,4 do
  31.       turtle.up()
  32.       turtle.dig()
  33.       turtle.turnLeft()
  34.     end
  35.   until not turtle.digUp()
  36.   repeat
  37.   until not turtle.down()
  38. elseif wide == 1 then
  39.     cut()
  40. elseif wide == 2 then
  41.     turtle.dig()
  42.     turtle.forward()
  43.     cut()
  44.     turtle.forward()
  45.     turtle.turnLeft()
  46.     turtle.dig()
  47.     turtle.forward()
  48.     turtle.turnLeft()
  49.     cut()
  50.     for x = 1,2 do
  51.         turtle.forward()
  52.         turtle.turnLeft()
  53.     end
  54. else
  55.     turtle.dig()
  56.     turtle.forward()
  57.     for x = 1,4 do
  58.         for x = 1,(wide-1) do
  59.             cut()
  60.             turtle.forward()
  61.         end
  62.         turtle.turnLeft()
  63.     end
  64. end
  65. turtle.back()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement