Hashtagaming

treeCutting

Dec 28th, 2012
5,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. --Digs block in front, then block above, then moves up. Moves back down when finished
  2. local function column()
  3.   while turtle.detectUp() do
  4.     turtle.dig()
  5.     turtle.digUp()
  6.     turtle.up()
  7.   end
  8.   turtle.dig()
  9.   while not turtle.detectDown() do
  10.     turtle.down()
  11.   end
  12. end
  13.  
  14. --Picks up items on ground
  15. local function suck()
  16.   turtle.suck()
  17. end
  18.  
  19. --Cuts the tree down, column by column
  20. local function fell()
  21.   turtle.dig()
  22.   turtle.forward()
  23.   column()
  24.   turtle.turnRight()
  25.   turtle.dig()
  26.   turtle.forward()
  27.   turtle.turnLeft()
  28.   column()
  29. end
  30.  
  31. --Replants the tee and fills the chest with it's inventory
  32. local function replant()
  33.   turtle.select(15)
  34.   suck()
  35.   turtle.place()
  36.   turtle.turnLeft()
  37.   suck()
  38.   turtle.forward()
  39.   suck()
  40.   turtle.turnRight()
  41.   suck()
  42.   turtle.place()
  43.   turtle.turnRight()
  44.   suck()
  45.   turtle.place()
  46.   turtle.turnRight()
  47.   suck()
  48.   turtle.forward()
  49.   for slot=2,7 do
  50.     turtle.select(slot)
  51.     turtle.drop()
  52.   end
  53.   turtle.turnLeft()
  54.   turtle.turnLeft()
  55.   turtle.select(15)
  56.   turtle.place()
  57.   turtle.select(1)
  58.   while not turtle.compare() do
  59.     turtle.select(16)
  60.     turtle.place()
  61.     turtle.select(1)
  62.   end
  63. end
  64.  
  65. --Executes until told to stop
  66. while true do
  67.   fell()
  68.   replant()
  69. end
Advertisement
Add Comment
Please, Sign In to add comment