Advertisement
TheProdigy22

Untitled

Mar 18th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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 % 2 == 1 then
  46. turtle.turnLeft()
  47. crop(x)
  48. turtle.turnLeft()
  49. else
  50. turtle.turnRight()
  51. crop(x)
  52. turtle.turnRight()
  53. end
  54. end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement