Advertisement
wartz62

ay_coupe

Nov 23rd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. slotCharbon = 7
  2. slotWood = 1
  3. slotPlastic = 2
  4. slotTree = 3
  5. slotWaypoint = 8
  6. slotChest = 9
  7. slotBonemeal = 10
  8.  
  9.  
  10. function reEnergy()
  11. turtle.select(slotCharbon)
  12. if turtle.getFuelLevel() < 800 then
  13. turtle.suck()
  14. turtle.refuel()
  15. end
  16. end
  17.  
  18.  
  19. function deposeItem(itemSlotName)
  20. turtle.select(itemSlotName)
  21. turtle.drop(turtle.getItemCount(itemSlotName)-1)
  22. end
  23.  
  24.  
  25. function reItem(itemSlotName, count, suckType)
  26. turtle.select(itemSlotName)
  27. if turtle.getItemCount(itemSlotName) < count then
  28. if suckType == "suckUp" then
  29. turtle.suckUp()
  30. else
  31. turtle.suck()
  32. end
  33. end
  34. end
  35.  
  36.  
  37.  
  38.  
  39. function isBlockType(type)
  40. turtle.select(type)
  41. return turtle.compare()
  42. end
  43.  
  44. --Replante un arbre
  45. function rePlant()
  46. turtle.select(slotTree)
  47. turtle.place()
  48. end
  49.  
  50.  
  51. function reAndFill(init)
  52. if not init then
  53. turtle.turnLeft()
  54. turtle.turnLeft()
  55. while true do
  56. turtle.forward()
  57. end
  58. end
  59. turtle.turnLeft()
  60. reEnergy()
  61. turtle.turnRight()
  62. deposeItem(slotWood)
  63. deposeItem(slotPlastic)
  64. turtle.turnRight()
  65. reItem(slotTree, 2, "suck")
  66. turtle.turnRight()
  67. reItem(slotBonemeal, 5, "suckUp")
  68. i = 0
  69. while isBlockType(slotWaypoint) do
  70. i = i+1
  71. turtle.forward()
  72. if i > 10 then
  73. break
  74. end
  75. else
  76. turtle.back()
  77. end
  78.  
  79. rePlant()
  80. os.sleep(200)
  81. turtle.select(slotBonemeal)
  82. for i=0,4 do
  83. turtle.place()
  84. end
  85. end
  86.  
  87.  
  88. function decoupeArbre()
  89. turtle.select(slotWood)
  90. while turtle.detect() do
  91. turtle.dig()
  92. turtle.digUp()
  93. turtle.up()
  94. end
  95. while not isBlockType(slotWaypoint) do
  96. turtle.down()
  97. end
  98. end
  99.  
  100.  
  101. function init()
  102. turtle.select(slotCharbon)
  103. turtle.refuel(1)
  104.  
  105. while true do
  106. if not isBlockType(slotWaypoint) then
  107. if not turtle.down() then
  108. break
  109. end
  110. else
  111. break
  112. end
  113. end
  114.  
  115. while true do
  116. if not turtle.forward() then
  117. if isBlockType(slotChest) then
  118. break
  119. else
  120. turtle.turnLeft()
  121. end
  122. else
  123. if isBlockType(slotWaypoint) then
  124. break
  125. else
  126. turtle.back()
  127. turtle.turnLeft()
  128. end
  129. end
  130. end
  131. while turtle.forward() do
  132. if not isBlockType(slotWaypoint) then
  133. turtle.turnLeft()
  134. turtle.turnLeft()
  135. turtle.forward()
  136. end
  137. end
  138. tourne()
  139. end
  140.  
  141.  
  142. function tourne()
  143. reAndFill(true)
  144. while true do
  145. decoupeArbre()
  146. reAndFill()
  147. end
  148. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement