Advertisement
LeviathanV

Single Tree Felling Program -Fixed- Use With Acacia Trees

Dec 8th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. while true do
  2.  
  3. local mf = 100
  4.  
  5. local function checkSaps()
  6.     if turtle.getItemCount(14) <= 1 then
  7.         turtle.select(14)
  8.         turtle.turnLeft()
  9.         turtle.suck()
  10.         turtle.turnRight()
  11.     end
  12. end
  13.  
  14. local function checkBone()
  15.     if turtle.getItemCount(15) <= 1 then
  16.         turtle.select(15)
  17.         turtle.turnRight()
  18.         turtle.suck()
  19.         turtle.turnLeft()
  20.     end
  21. end
  22.  
  23. local function checkFuel()
  24.     if turtle.getItemCount(13) <= 5 then
  25.         turtle.select(13)
  26.         turtle.turnRight()
  27.         turtle.turnRight()
  28.         turtle.suck()
  29.         turtle.turnLeft()
  30.         turtle.turnLeft()
  31.     end
  32. end
  33.  
  34. local function refuel()
  35.     if turtle.getFuelLevel() <= mf then
  36.         turtle.select(13)
  37.         turtle.refuel(1)
  38.     end
  39. end
  40.  
  41.  
  42. local function back()
  43.     while not turtle.detect() do
  44.         turtle.down()
  45.     end
  46. end
  47.  
  48. local function cutTree()
  49.     while turtle.detect(not turtle.compare(16)) do
  50.         turtle.dig()
  51.         turtle.digUp()
  52.         turtle.up()
  53.     end
  54. end
  55.  
  56. local function check()
  57.     if turtle.detect(turtle.compare(16)) then
  58.         turtle.up()
  59.     else
  60.         cutTree()
  61.     end
  62. end
  63.  
  64. local function plantTree()
  65.     if turtle.detect() then
  66.         check()
  67.     else
  68.         turtle.select(14)
  69.         turtle.place()
  70.         turtle.select(15)
  71.         turtle.place()
  72.     end
  73. end
  74.  
  75. local function dumpLoad()
  76.     for i = 1,12 do
  77.         if turtle.detect(turtle.compare(16)) then
  78.             turtle.select(i)
  79.             turtle.dropDown()
  80.         else
  81.             check()
  82.             back()
  83.         end
  84.     end
  85. end
  86.  
  87. local function run()
  88.     checkSaps()
  89.     checkBone()
  90.     checkFuel()
  91.     refuel()
  92.     plantTree()
  93.     cutTree()
  94.     back()
  95.     dumpLoad()
  96.     check()
  97. end
  98.  
  99. run()
  100. sleep(90)
  101.  
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement