Hoff

Tree cutter

Jul 27th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movetotree()
  2. for i=1,7 do
  3. turtle.forward()
  4. end
  5. end
  6.  
  7. function drop()
  8. for d=1,15 do
  9. turtle.select(i)
  10. turtle.dropDown()
  11. end
  12. end
  13.  
  14. function cut()
  15. turtle.dig()
  16. turtle.forward()
  17. while true do
  18. if turtle.digUp() then
  19. turtle.up()
  20. else if not turtle.down() then
  21. turtle.back()
  22. break
  23. end
  24. end
  25. end
  26. end
  27.  
  28. function movetodrop()
  29. for g=1,7 do
  30. turtle.back()
  31. end
  32. end
  33.  
  34. function refuel()
  35. if (turtle.getFuelLevel()!="Unlimited") then
  36. if(turtle.getFuelLevel()>=600) then
  37. refuel2()
  38. end
  39. end
  40. end
  41.  
  42. function refuel2()
  43. if (turtle.getFuelLevel()=="Unlimited") then
  44. return true
  45. else if (turtle.getFuelLevel()>=600) then
  46. turtle.select(16)
  47. turtle.turnRight()
  48. turtle.turnRight()
  49. turtle.suck()
  50. turtle.refuel(64)
  51. turtle.select(1)
  52. turtle.turnLeft()
  53. turtle.turnLeft()
  54. end
  55. end
  56. end
  57.  
  58. function plant()
  59. turtle.select(14)
  60. turtle.place()
  61. turtle.select(1)
  62. end
  63.  
  64. function saplings()
  65. turtle.select(14)
  66. turtle.turnRight()
  67. turtle.suck()
  68. turtle.select(1)
  69. turtle.turnLeft()
  70. end
  71.  
  72. function getbonemeal()
  73. turtle.select(15)
  74. turtle.up()
  75. turtle.turnRight()
  76. turtle.suck()
  77. turtle.select(1)
  78. turtle.turnLeft()
  79. turtle.down()
  80. end
  81.  
  82. function bonemeal()
  83. turtle.select(15)
  84. turtle.place()
  85. turtle.place()
  86. turtle.place()
  87. turtle.place()
  88. turtle.select(1)
  89. end
  90. while true do
  91. refuel()
  92. saplings()
  93. getbonemeal()
  94. movetotree()
  95. for z=1,16 do
  96. plant()
  97. bonemeal()
  98. cut()
  99. end
  100. movetodrop()
  101. drop()
  102. end
Advertisement
Add Comment
Please, Sign In to add comment