Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function crop(row)
- local success, thisone = turtle.inspectDown()
- if thisone.state then
- if thisone.state.age == 7 then
- if row % 2 == 1 then
- turtle.select(1)
- else
- turtle.select(2)
- end
- turtle.digDown()
- turtle.placeDown()
- end
- end
- turtle.forward()
- end
- function fueled()
- if turtle.refuel(0) > 150 then
- return true
- else
- return false
- end
- end
- local progress = {}
- if fs.exists("farm_progress") then
- local progressFile = fs.open("farm_progress","r")
- local progressString = progressFile.readAll()
- progress = textutils.unserialize(progressString)
- progressFile.close()
- else
- progress.timeLeft = 1200
- end
- while fueled() do
- for i=progress.timeLeft,1,-1 do
- progress.timeLeft = i
- local progressFile = fs.open("farm_progress","w")
- progressFile.write(textutils.serialize(progress))
- progressFile.close()
- sleep(1)
- end
- progress.timeLeft = 1200
- for x=1,9 do
- for y=1,8 do
- crop(x)
- end
- if x < 9 then
- if x % 2 == 1 then
- turtle.turnLeft()
- crop(x)
- turtle.turnLeft()
- else
- turtle.turnRight()
- crop(x)
- turtle.turnRight()
- end
- else
- turtle.turnLeft()
- for j=1,2 do
- turtle.turnLeft()
- for i=1,8 do
- turtle.forward()
- end
- end
- turtle.turnRight()
- for i=3,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement