Advertisement
visiongaming43

Untitled

Sep 19th, 2021
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. -- Getting fuel level
  2. local fuelLevel = turtle.getFuelLevel()
  3.  
  4. -- Asking user for length and width
  5. print("How far do you want the turtle to go in front")
  6. local length = io.read()
  7.  
  8. print("How far do you want the turtle to go to the side")
  9. local width = io.read()
  10.  
  11. -- Getting fuel needed
  12. local fuelNeeded = (length*width) + 1 + (1/2*length) + (1/2*width)
  13.  
  14. local timesChanged = 0
  15.  
  16. -- Making function to take crops
  17. local function getCrop()
  18. local isBlock, data = turtle.inspectDown()
  19. if (string.match(data.name, "croptopia:") and data['stage']['age'] == 7) then
  20. turtle.digDown()
  21. for i = 6, 1, -1
  22. do
  23. turtle.suckDown()
  24. end
  25. end
  26. end
  27. if(fuelLevel > fuelNeeded) then
  28. for a = length, 1, -1
  29. do
  30. timesChanged = timesChanged + 1
  31. turtle.forward()
  32. getCrop()
  33. if(timesChanged % 2 == 1) then
  34. turtle.turnRight()
  35. else
  36. turtle.turnLeft()
  37. end
  38.  
  39. for b = width, 1, -1
  40. do
  41. turtle.forward()
  42. getCrop()
  43. end
  44. turtle.turnLeft()
  45. end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement