Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. local xSize = 2
  2. local ySize = 2
  3. local seedSlot = 1
  4. local _TURN = false
  5.  
  6. function checkPlant()
  7. sleep(.1)
  8. local is, plant = turtle.inspectDown()
  9. sleep(.1)
  10. if plant.metadata ~= nil then
  11. if plant.metadata > 6 then
  12. turtle.digDown()
  13. turtle.select(seedSlot)
  14. turtle.placeDown()
  15. end
  16. end
  17. end
  18.  
  19. function goChest()
  20. for i=1,xSize do
  21. turtle.forward()
  22. end
  23. turtle.turnRight()
  24. for i=1,ySize do
  25. turtle.forward()
  26. end
  27. turtle.down()
  28. turtle.turnLeft()
  29. dropChest()
  30. turtle.turnRight()
  31. turtle.turnRight()
  32. end
  33.  
  34. function dropChest()
  35. for i=1,16 do
  36. if i ~= seed then
  37. turtle.select(i)
  38. turtle.drop()
  39. end
  40. end
  41. end
  42.  
  43. function checkAll()
  44. for ii=1,ySize do
  45. for i=1,xSize - 1 do
  46. checkPlant()
  47. turtle.forward()
  48. end
  49. checkPlant()
  50. if _TURN == false then
  51. turtle.turnRight()
  52. turtle.forward()
  53. turtle.turnRight()
  54. else
  55. turtle.turnLeft()
  56. turtle.forward()
  57. turtle.turnLeft()
  58. end
  59. _TURN = not _TURN
  60. end
  61. end
  62.  
  63.  
  64. while true do
  65. term.clear()
  66. term.setCursorPos(1,1)
  67. print("Yakit kontrolu yapiliyor.")
  68. if turtle.getFuelLevel() > xSize * ySize then
  69. print("Yakit yeterli.")
  70. print("Isleme baslamak icin herhangi tusa basin.")
  71. read()
  72. turtle.up()
  73. turtle.forward()
  74. checkAll()
  75. if (number % 2 == 0) then
  76. turtle.turnRight()
  77. turtle.forward()
  78. turtle.turnRight
  79. end
  80. goChest()
  81. else
  82. print("Yetersiz yakit. Lutfen en son slota yakit koyun.")
  83. print("Yakit koyduktan sonra herhangi tusa basin.")
  84. read()
  85. turtle.select(16)
  86. turtle.refuel()
  87. sleep(.5)
  88. end
  89. end
  90.  
  91. print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement