Advertisement
Guest User

Untitled

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