Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. local tArgs = {...}
  2. local todo = tonumber(tArgs[1])
  3. todo = todo or 1
  4. local j = tonumber(1)
  5. local z = tonumber(1)
  6. turtle.select(1)
  7.  
  8. function turnaround()
  9. turtle.turnRight()
  10. turtle.turnRight()
  11. end
  12.  
  13. function tFuel(amount)
  14. if turtle.getFuelLevel() < 5 then
  15. turtle.select(16)
  16. turtle.refuel(amount)
  17. if turtle.getItemCount(16) < 5 then
  18. turtle.turnRight()
  19. turtle.forward()
  20. turtle.forward()
  21. turtle.suckDown()
  22. turnaround()
  23. turtle.forward()
  24. turtle.forward()
  25. turtle.turnRight()
  26. end
  27. turtle.select(1)
  28. end
  29. end
  30.  
  31. function plant()
  32. tFuel(1)
  33. turtle.place()
  34. turtle.up()
  35. print("Planting Tree #"..z)
  36. z = z+1
  37. repeat
  38. os.sleep(30)
  39. until turtle.detect() == true
  40. turtle.down()
  41. turtle.select(1)
  42. end
  43.  
  44. function chop()
  45. repeat
  46. tFuel(1)
  47. turtle.dig()
  48. turtle.digUp()
  49. turtle.up()
  50. j = j + 1
  51. until turtle.detect() == false
  52. for i = 1, j do
  53. tFuel(1)
  54. turtle.down()
  55. end
  56. j = 1
  57. for l = 3, 15 do
  58. turtle.select(l)
  59. turtle.dropDown()
  60. turtle.select(1)
  61. end
  62. end
  63.  
  64.  
  65. for k = 1, todo do
  66. plant()
  67. chop()
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement