orngix

Tree Farm

Feb 25th, 2013
1,969
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. --Plant
  2. function plant()
  3. if turtle.getItemCount(1) == 0 then
  4. turtle.select(1)
  5. turtle.turnLeft()
  6. turtle.suck()
  7. turtle.turnRight()
  8. end
  9. if turtle.getItemCount(2) == 0 then
  10. turtle.select(2)
  11. turtle.turnRight()
  12. turtle.suck()
  13. turtle.turnLeft()
  14. end
  15. turtle.select(1)
  16. turtle.place()
  17. turtle.select(2)
  18. turtle.place()
  19. end
  20.  
  21. --Chop
  22. function chop()
  23. turtle.select(3)
  24. turtle.dig()
  25. turtle.forward()
  26. while turtle.compareUp() == true do
  27. turtle.digUp()
  28. turtle.up()
  29. end
  30. while turtle.detectDown() == false do
  31. turtle.down()
  32. end
  33. turtle.back()
  34. end
  35.  
  36. --Refuel
  37. function refuel()
  38. turtle.select(3)
  39. turtle.refuel(1)
  40. end
  41.  
  42. --Empty
  43. function empty()
  44. turtle.turnLeft()
  45. turtle.turnLeft()
  46. turtle.select(3)
  47. turtle.drop()
  48. turtle.turnRight()
  49. turtle.turnRight()
  50. end
  51.  
  52. while true do
  53. refuel()
  54. empty()
  55. plant()
  56. chop()
  57. sleep(40)
  58. os.queueEvent("Repeat")
  59. os.pullEvent()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment