Advertisement
TheProdigy22

Untitled

Mar 18th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. function crop(row)
  2. local success, thisone = turtle.inspectDown()
  3. if thisone.state then
  4. if thisone.state.age == 7 then
  5. if row % 2 == 1 then
  6. turtle.select(1)
  7. else
  8. turtle.select(2)
  9. end
  10. turtle.digDown()
  11. turtle.placeDown()
  12. end
  13. end
  14. turtle.forward()
  15. end
  16.  
  17. function fueled()
  18. if turtle.refuel(0) > 150 then
  19. return true
  20. else
  21. return false
  22. end
  23. end
  24.  
  25. local progress = {}
  26. if fs.exists("farm_progress") then
  27. local progressFile = fs.open("farm_progress","r")
  28. local progressString = progressFile.readAll()
  29. progress = textutils.unserialize(progressString)
  30. progressFile.close()
  31. else
  32. progress.timeLeft = 1200
  33. end
  34. while fueled() do
  35. for i=progress.timeLeft,1,-1 do
  36. local progressFile = fs.open("farm_progress","w")
  37. local progressFile.write(textutils.serialize(progress))
  38. progressFile.close()
  39. sleep(1)
  40. end
  41. for x=1,9 do
  42. for y=1,8 do
  43. crop(x)
  44. end
  45. if x < 9 then
  46. if x % 2 == 1 then
  47. turtle.turnLeft()
  48. crop(x)
  49. turtle.turnLeft()
  50. else
  51. turtle.turnRight()
  52. crop(x)
  53. turtle.turnRight()
  54. end
  55. else
  56. turtle.turnLeft()
  57. turtle.turnLeft()
  58. for j=1,2 do
  59. for i=1,8 do
  60. turtle.forward()
  61. end
  62. turtle.turnLeft()
  63. end
  64. end
  65. end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement