arbarr3

lumberjack

Nov 18th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. function fuel ()
  2.     if turtle.getFuelLevel() == 0 then
  3.         turtle.select(1)
  4.         turtle.refuel(1)
  5.     end
  6. end
  7.  
  8. function chopUp ()
  9.     height = 0
  10.     while turtle.detectUp() do
  11.         fuel()
  12.         turtle.digUp()
  13.         turtle.up()
  14.         height = height+1
  15.     end
  16.     fuel()
  17.     return height
  18. end
  19.  
  20. function killTree()
  21.     fuel()
  22.     turtle.dig()
  23.     turtle.forward()
  24.    
  25.     height = chopUp()
  26.    
  27.     while height > 0 do
  28.         fuel()
  29.         turtle.down()
  30.         height = height-1
  31.     end
  32.    
  33.     fuel()
  34.     turtle.back()
  35.     turtle.select(2)
  36.     turtle.place()
  37. end
  38.  
  39. function chill()
  40.     turtle.select(2)
  41.     while turtle.compare() do --Comparing the sapling in inventory to the sapling in front of it
  42.         turtle.suck()
  43.         turtle.turnRight()
  44.         turtle.suck()
  45.         turtle.turnRight()
  46.         turtle.suck()
  47.         turtle.turnRight()
  48.         turtle.suck()
  49.         turtle.turnRight()
  50.         sleep(10.0)
  51.     end
  52.     killTree()
  53. end
  54.  
  55. while true do
  56.     chill()
  57. end
Advertisement
Add Comment
Please, Sign In to add comment