Advertisement
LeviathanV

FirTreeFellerTurtle

Jan 14th, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. while true do
  2.  
  3.     local function cutUp()
  4.         if turtle.detect() then
  5.             turtle.up()
  6.             turtle.up()
  7.             turtle.dig()
  8.             turtle.forward()
  9.         end
  10.         while turtle.detect() do
  11.             turtle.dig()
  12.             turtle.digUp()
  13.             turtle.up()
  14.         end
  15.     end
  16.    
  17.     local function moveLeft()
  18.         if not turtle.detect() then
  19.             turtle.turnLeft()
  20.             turtle.dig()
  21.             turtle.forward()
  22.             turtle.turnRight()
  23.         end
  24.     end
  25.    
  26.     local function cutDown()
  27.         while turtle.detectDown() do
  28.             turtle.dig()
  29.             turtle.digDown()
  30.             turtle.down()
  31.         end
  32.         if not turtle.detectDown() then
  33.             turtle.up()
  34.             turtle.select(15)
  35.             turtle.placeDown()
  36.         end
  37.     end
  38.    
  39.     local function reset()
  40.         turtle.turnRight()
  41.         turtle.forward()
  42.         turtle.turnLeft()
  43.         turtle.back()
  44.         turtle.down()
  45.         turtle.down()
  46.     end
  47.    
  48.     local function drop()
  49.         for i = 1, 12 do
  50.             turtle.select(i)
  51.             turtle.drop()
  52.         end
  53.     end
  54.    
  55.     local function run()
  56.         cutUp()
  57.         moveLeft()
  58.         cutDown()
  59.         reset()
  60.         turtle.turnRight()
  61.         turtle.turnRight()
  62.         drop()
  63.         turtle.turnLeft()
  64.         turtle.turnLeft()
  65.     end
  66.    
  67.     local function plantTree()
  68.         turtle.select(13)
  69.         turtle.up()
  70.         turtle.up()
  71.         turtle.forward()
  72.         turtle.forward()
  73.         turtle.turnLeft()
  74.         turtle.place()
  75.         turtle.turnRight()
  76.         turtle.back()
  77.         turtle.place()
  78.         turtle.turnLeft()
  79.         turtle.place()
  80.         turtle.turnRight()
  81.         turtle.back()
  82.         turtle.place()
  83.         turtle.down()
  84.         turtle.down()
  85.         turtle.select(1)
  86.     end
  87.    
  88.     local function checkTree()
  89.         turtle.up()
  90.         turtle.up()
  91.         turtle.up()
  92.         if not turtle.detect() then
  93.         turtle.down()
  94.         turtle.down()
  95.         turtle.down()
  96.         sleep(60)
  97.         checkTree()
  98.         else
  99.         turtle.down()
  100.         turtle.down()
  101.         turtle.down()
  102.         sleep(1)
  103.         run()
  104.         end
  105.     end
  106.    
  107.     checkTree()
  108.     plantTree()
  109.     sleep(90)
  110.    
  111.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement