mailmanq

[CC][Turtle]ChopTree

Apr 19th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. local wood = 1
  2. local wood2 = 2
  3. local wood3 = 3
  4. local wood4 = 4
  5. local sapling = 13
  6. local sapling2 = 14
  7. local sapling3 = 15
  8. local bonemeal = 16
  9.  
  10. local function chopTree()
  11.     turtle.select(1)
  12.     turtle.dig()
  13.     turtle.forward()
  14.     while turtle.detectUp() do
  15.         turtle.digUp()
  16.         turtle.up()
  17.     end
  18.     repeat
  19.         turtle.down()
  20.     until turtle.detectDown()
  21. end
  22.  
  23. local function plantTree()
  24.     turtle.select(sapling)
  25.     turtle.place()
  26.     repeat
  27.         turtle.select(bonemeal)
  28.         turtle.place()
  29.         turtle.select(wood)
  30.     until turtle.compare()
  31. end
  32.  
  33. local tArgs = {...}
  34.  
  35. if type(tArgs[1]) == "number" then
  36.     for i = 1, tArgs[1] do
  37.         plantTree()
  38.         chopTree()
  39.     end
  40. else
  41.     while true do
  42.         plantTree()
  43.         chopTree()
  44.     end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment