Advertisement
BlueMond

Felling

Jan 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local slot = 16
  2. turtle.select(1)
  3. local go = true
  4.  
  5. local function plant()
  6.     if turtle.getItemCount(slot) > 1 then
  7.         turtle.select(slot)
  8.         turtle.place()
  9.         turtle.select(1)
  10.        
  11.         return true
  12.     end
  13.    
  14.     return false
  15. end
  16.  
  17. local function done()
  18.     while turtle.down() do end
  19.     turtle.drop()
  20. end
  21.  
  22. local function fell()
  23.     while turtle.dig() do
  24.         turtle.digUp()
  25.         turtle.up()
  26.     end
  27.    
  28.     done()
  29. end
  30.  
  31. local function check()
  32.     turtle.select(slot)
  33.     local test = turtle.compare()
  34.     turtle.select(1)
  35.     if not test then
  36.        
  37.         return true
  38.     end
  39.     return false
  40. end
  41.  
  42. while go do
  43.    
  44.     sleep(10)
  45.     if check() then
  46.         fell()
  47.         go = plant()
  48.     end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement