thaile4ever

tree

Nov 13th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. local tArgs = { ... }
  2.  
  3. local size = 4
  4.  
  5. local height = 0
  6.  
  7. local function unload()
  8. print( "Unloading items..." )
  9. for n=2, 16 do
  10. turtle.select(n)
  11. turtle.drop()
  12. end
  13. turtle.select(1)
  14. end
  15.  
  16. local function done()
  17. if size == 1 then
  18. for i=height, 1, -1 do
  19. turtle.down()
  20. end
  21. turtle.back()
  22. turtle.turnLeft()
  23. turtle.turnLeft()
  24. unload()
  25. turtle.turnLeft()
  26. turtle.turnLeft()
  27. else
  28. turtle.back()
  29. turtle.turnLeft()
  30. turtle.forward()
  31. turtle.turnLeft()
  32. unload()
  33. turtle.turnLeft()
  34. turtle.turnLeft()
  35. end
  36. end
  37.  
  38.  
  39. -- Check for fuel (use charcoal in first slot)
  40. local fuelLevel = turtle.getFuelLevel()
  41. if fuelLevel == "unlimited" then
  42. return true
  43. elseif fuelLevel < 96 then
  44. turtle.refuel(1)
  45. end
  46.  
  47. -- Start the harvest
  48. turtle.dig()
  49. turtle.forward()
  50.  
  51. if size == 1 then
  52. while turtle.detectUp() do
  53. turtle.digUp()
  54. turtle.up()
  55. height = height + 1
  56. end
  57. done()
  58. else
  59. turtle.dig()
  60. while turtle.detectUp() do
  61. turtle.digUp()
  62. turtle.up()
  63. turtle.dig()
  64. height = height + 1
  65. end
  66.  
  67. turtle.turnRight()
  68. turtle.dig()
  69. turtle.forward()
  70. turtle.turnLeft()
  71. turtle.dig()
  72. for i=height, 1, -1 do
  73. turtle.digDown()
  74. turtle.down()
  75. turtle.dig()
  76. end
  77. done()
  78. end
Advertisement
Add Comment
Please, Sign In to add comment