Advertisement
mrkmg

MrKMG Tree

Jan 10th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local saplings = 1 -- the slot where the saplings are
  2. turtle.select(saplings) -- select the saplings
  3. while true do
  4.     turtle.turnLeft()
  5.     turtle.suck()
  6.     turtle.turnRight()
  7.     turtle.select(2)
  8.     turtle.drop()
  9.     turtle.select(saplings)
  10.     if turtle.getFuelLevel() < 4000
  11.     then
  12.         turtle.turnLeft()
  13.         turtle.turnLeft()
  14.         turtle.select(9)
  15.         turtle.suck()
  16.         turtle.refuel(64)
  17.         turtle.select(saplings)
  18.         turtle.turnRight()
  19.         turtle.turnRight()
  20.     end
  21.     for i = 1, 9 do -- plant 8 saplings in a row
  22.         turtle.turnRight()
  23.         if not turtle.compare() then -- if not a sapling, then a tree grew
  24.             turtle.dig()
  25.             turtle.forward()
  26.             while turtle.detectUp() do -- dig tree out
  27.                 turtle.digUp()
  28.                 turtle.up()
  29.             end
  30.             while not turtle.detectDown() do -- back down to ground
  31.                 turtle.down()
  32.             end
  33.             turtle.back()
  34.             turtle.place() -- put down new sapling
  35.         end
  36.         turtle.turnLeft()
  37.         turtle.forward()
  38.     end
  39.     -- turn around and line up for next pass
  40.     turtle.turnLeft()
  41.     turtle.turnLeft()
  42.     turtle.forward()
  43.     turtle.forward()
  44.     turtle.forward()
  45.     turtle.forward()
  46.     turtle.forward()
  47.     turtle.forward()
  48.     turtle.forward()
  49.     turtle.forward()
  50.     turtle.forward()
  51.     turtle.turnLeft()
  52.     turtle.turnLeft()
  53.     os.sleep(30) -- sleep for 30 seconds to allow trees to grow
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement