Orcinuss

2x2

Jun 17th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. local function refuel()
  2.     local fuelLevel = turtle.getFuelLevel()
  3.     if fuelLevel == "unlimited" or fuelLevel > 0 then
  4.         return
  5.     end
  6.  
  7.     local function tryRefuel()
  8.         for n=1,16 do
  9.             if turtle.getItemCount(n) > 0 then
  10.                 turtle.select(n)
  11.                 if turtle.refuel(1) then
  12.                     turtle.select(15)
  13.                     return true
  14.                 end
  15.             end
  16.         end
  17.         turtle.select(1)
  18.         return false
  19.     end
  20.  
  21.     if not tryRefuel() then
  22.         print( "Add more fuel to continue." )
  23.         while not tryRefuel() do
  24.             sleep(1)
  25.         end
  26.         print( "Resuming Chopping." )
  27.     end
  28. end
  29.  
  30. function cutdown()
  31.     refuel()
  32.     turtle.dig()
  33.     turtle.digdown()
  34.     turtle.down()
  35. end
  36.  
  37. function cutup()
  38.     refuel()
  39.     turtle.dig()
  40.     turtle.digUp()
  41.     turtle.up()
  42. end
  43.  
  44. refuel()
  45. turtle.dig()
  46. turtle.transferTo(15)
  47. turtle.forward()
  48. turtle.select(15)
  49. while turtle.compareUp() do
  50.     cutup()
  51. end
  52. turtle.dig()
  53. refuel()
  54. turtle.forward()
  55. turtle.turnRight()
  56. turtle.dig()
  57. turtle.forward()
  58. turtle.turnRight()
  59. turtle.select(15)
  60. while turtle.compareDown()
  61.     cutdown()
  62. end
  63. print( "Tree Finished" )
Advertisement
Add Comment
Please, Sign In to add comment