Advertisement
Guest User

ChooperV3.1

a guest
Jul 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. --TreeChooper
  2. --fuel
  3. if turtle.getFuelLevel()==0 then
  4. turtle.select(3)
  5. turtle.refuel(10)
  6. end
  7.  
  8. --fuel test
  9. function fuelChecker()
  10. if turtle.getFuelLevel() < 10 then
  11. turtle.select(3)
  12. turtle.refuel(10)
  13. end
  14. end
  15.  
  16. --leafs checker
  17. function leafs()
  18. --leafs checker
  19. turtle.select(6)
  20. if turtle.compare() then
  21. turtle.dig()
  22. end
  23. end
  24.  
  25. --detect saplings
  26. function sapDec()
  27. turtle.select(1)
  28. if turtle.compare() then
  29. --repostion
  30. turtle.up()
  31. turtle.forward()
  32. turtle.forward()
  33. turtle.down()
  34. end
  35. end
  36.  
  37. --detectUp
  38. function seeUp()
  39. if turtle.detectUp() then
  40. turtle.digUp()
  41. turtle.down()
  42. end
  43. end
  44.  
  45. --choop function
  46. function choop()
  47.  
  48. --fuel test
  49. fuelChecker()
  50.  
  51. --for loop
  52. for i = 0,6 do
  53. print(i)
  54.  
  55. --position
  56. turtle.forward()
  57. turtle.forward()
  58. turtle.forward()
  59. turtle.forward()
  60.  
  61. --chop tree
  62. turtle.select(2)
  63. --if the tree has grown
  64. if turtle.compare() then
  65. turtle.dig()
  66. turtle.forward()
  67. --harvest the tree
  68. while turtle.detectUp() do
  69. turtle.digUp()
  70. turtle.up()
  71. end
  72. --return to the ground
  73. while not turtle.detectDown() do
  74. turtle.down()
  75. end
  76. --plant a new sapling
  77. turtle.back()
  78. turtle.select(1)
  79. turtle.place()
  80. --repostion
  81. turtle.up()
  82. turtle.forward()
  83. turtle.forward()
  84. turtle.down()
  85. end
  86. end
  87. end
  88.  
  89. --postitioning
  90. function initPosition()
  91. turtle.turnLeft()
  92. turtle.forward()
  93. turtle.turnLeft()
  94. end
  95.  
  96. --Back to Base
  97. function BackBase()
  98. turtle.turnRight()
  99. for i=0,2 do
  100. turtle.forward()
  101. end
  102. end
  103.  
  104. --run the empty way without chooping
  105. function run()
  106. --fuel test
  107. fuelChecker()
  108.  
  109. for i=0,6 do
  110. turtle.forward()
  111. turtle.forward()
  112. turtle.forward()
  113. turtle.forward()
  114. end
  115. end
  116. --turn function
  117. function turn()
  118. --Check for Walls
  119. turtle.select(4)
  120. if turtle.compare() then
  121. turtle.turnRight()
  122. turtle.forward()
  123. turtle.forward()
  124. turtle.turnRight()
  125. end
  126. end
  127.  
  128. for i=0,1 do
  129. choop()
  130. turn()
  131. run()
  132. --initPosition()
  133. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement