funkd0ct0r

Untitled

Dec 27th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1.  
  2. -- 0s8EKQTp
  3. -- slots: seeds, fuel, detector, filter, breaker
  4.  
  5. local plotLength = 16
  6.  
  7. local function harvestPlant()
  8.  
  9. turtle.select(5)
  10. turtle.placeDown()
  11.  
  12. turtle.select(6)
  13. repeat until turtle.forward()
  14. repeat until turtle.down()
  15. sleep(2)
  16. repeat until turtle.up()
  17. repeat until turtle.back()
  18.  
  19. turtle.select(5)
  20. turtle.digDown()
  21.  
  22. turtle.select(1)
  23. repeat until turtle.back()
  24. turtle.placeDown()
  25. repeat until turtle.forward()
  26.  
  27. end
  28.  
  29. local function testPlant()
  30.  
  31. turtle.turnRight()
  32.  
  33. while turtle.getItemCount(1) < 2 do
  34. print("Out of Seeds")
  35. sleep(1)
  36. end
  37.  
  38. turtle.select(3)
  39. turtle.placeDown()
  40. sleep(0)
  41. turtle.select(4)
  42. turtle.dropDown()
  43. sleep(0)
  44.  
  45. local isGrown = rs.getInput("bottom")
  46.  
  47. turtle.select(4)
  48. turtle.suckDown()
  49. turtle.select(3)
  50. turtle.digDown()
  51.  
  52. turtle.select(1)
  53. sleep(0)
  54.  
  55. if isGrown then harvestPlant() end
  56.  
  57.  
  58. turtle.turnLeft()
  59. end
  60.  
  61.  
  62. while turtle.getItemCount(1) ~= 0 do
  63.  
  64. while turtle.getFuelLevel() < 64 do
  65. while turtle.getItemCount(2) < 2 do
  66. print("Out of Fuel")
  67. sleep(1)
  68. end
  69. turtle.select(2)
  70. turtle.refuel(turtle.getItemCount(2) - 1)
  71. turtle.select(1)
  72. end
  73.  
  74. for x = 1, plotLength do
  75. testPlant()
  76. if x ~- plotLength then
  77. repeat until turtle.forward()
  78. end
  79. end
  80.  
  81. turtle.turnRight()
  82. repeat until turtle.forward()
  83. turtle.turnRight()
  84.  
  85. for x = 1, plotLength do
  86. testPlant()
  87. if x ~- plotLength then
  88. repeat until turtle.forward()
  89. end
  90. end
  91.  
  92. turtle.turnRight()
  93. repeat until turtle.forward()
  94. turtle.turnRight()
  95.  
  96.  
  97. end
Advertisement
Add Comment
Please, Sign In to add comment