Advertisement
visiongaming43

Untitled

Sep 20th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. ---@diagnostic disable: lowercase-global
  2. -- Getting fuel level
  3. local fuelLevel = turtle.getFuelLevel()
  4.  
  5. local direction = false
  6.  
  7. local directionNew = direction
  8.  
  9. -- Getting fuel needed
  10. local fuelNeeded = (13*13) + 1 + (1/2*13) + (1/2*13)
  11.  
  12. -- Making function to get the slot index of the seed
  13. local function getSeedIndex()
  14. for slot = 1, 16, 1 do
  15. local item = turtle.getItemDetail(slot)
  16. if (item ~= nil) then
  17. if (string.match(item.name, "seed")) then
  18. return slot
  19. end
  20. end
  21. end
  22. end
  23.  
  24. -- Making function to take crops
  25. local function getCrop()
  26. local isBlock, data = turtle.inspectDown()
  27. if(isBlock)then
  28. if (string.match(data.name, "croptopia:") and data['state']['age'] == 7) then
  29. turtle.digDown()
  30. for i = 6, 1, -1
  31. do
  32. turtle.suckDown()
  33. seedIndex = getSeedIndex()
  34. if(seedIndex ~= nil) then
  35. turtle.select(seedIndex)
  36. turtle.placeDown()
  37. end
  38. end
  39. end
  40. else
  41. seedIndex = getSeedIndex()
  42. if(seedIndex ~= nil) then
  43. turtle.select(seedIndex)
  44. turtle.placeDown()
  45. end
  46. end
  47. end
  48.  
  49. if(fuelLevel > fuelNeeded) then
  50. for a = 13, 1, -1
  51. do
  52. direction = not(direction)
  53. turtle.forward()
  54. getCrop()
  55.  
  56. if(direction) then
  57. turtle.turnLeft()
  58. else
  59. turtle.turnRight()
  60. end
  61.  
  62. for b = 13-1, 1, -1
  63. do
  64. turtle.forward()
  65. getCrop()
  66. end
  67.  
  68. if(direction) then
  69. turtle.turnRight()
  70. else
  71. turtle.turnLeft()
  72. end
  73. end
  74.  
  75. turtle.turnRight()
  76. turtle.turnRight()
  77.  
  78. for c = 13, 1, -1
  79. do
  80. turtle.forward()
  81. end
  82.  
  83. if (directionNew == false) then
  84. turtle.turnLeft()
  85. for d = 13-1, 1, -1
  86. do
  87. turtle.forward()
  88. end
  89. turtle.turnLeft()
  90. else
  91. turtle.turnRight()
  92. for d = 13-1, 1, -1
  93. do
  94. turtle.forward()
  95. end
  96. turtle.turnRight()
  97. end
  98.  
  99. -- Drops ALL the items gained from farming ( seeds and crops ) into chest below starting point
  100. for slot = 1, 16, 1
  101. do
  102. turtle.select(slot)
  103. turtle.dropDown(64)
  104. end
  105.  
  106. local time = os.startTimer(600)
  107. if(time == 0)then
  108. reboot()
  109. end
  110.  
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement