Advertisement
TheProdigy22

Untitled

Mar 18th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 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. progress.timeLeft = i
  37. local progressFile = fs.open("farm_progress","w")
  38. progressFile.write(textutils.serialize(progress))
  39. progressFile.close()
  40. sleep(1)
  41. end
  42. progress.timeLeft = 1200
  43. for x=1,9 do
  44. for y=1,8 do
  45. crop(x)
  46. end
  47. if x < 9 then
  48. if x % 2 == 1 then
  49. turtle.turnLeft()
  50. crop(x)
  51. turtle.turnLeft()
  52. else
  53. turtle.turnRight()
  54. crop(x)
  55. turtle.turnRight()
  56. end
  57. else
  58. turtle.turnLeft()
  59. for j=1,2 do
  60. turtle.turnLeft()
  61. for i=1,8 do
  62. turtle.forward()
  63. end
  64. end
  65. turtle.turnRight()
  66. for i=3,16 do
  67. turtle.select(i)
  68. turtle.drop()
  69. end
  70. turtle.select(1)
  71. turtle.turnRight()
  72. turtle.turnRight()
  73. end
  74. end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement