Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enabled = true
- col_length = 15
- length = 5
- function rowEnd()
- turtle.turnLeft()
- go()
- go()
- turtle.turnLeft()
- end
- function lineEnd()
- turtle.turnRight()
- go()
- turtle.turnRight()
- end
- function line()
- for i=1, col_length do
- go()
- end
- end
- function go()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- print("fuel: " .. turtle.getFuelLevel())
- harvest()
- end
- function harvest()
- turtle.suckDown()
- turtle.suckUp()
- turtle.suck()
- end
- function goHome()
- turtle.turnRight()
- for i = 1, (length * 3) - 2 do
- go()
- end
- turtle.turnRight()
- end
- function dock()
- --bank
- for i = 16,1,-1 do
- turtle.select(i)
- turtle.dropDown()
- end
- --refuel
- --wait for growth
- while (not turtle.detect() and (not detectRight())) do
- print('waiting for growth...')
- sleep(10)
- end
- end
- function detectRight()
- turtle.turnRight()
- isThere = turtle.detect()
- turtle.turnLeft()
- return isThere
- end
- while enabled do
- if (turtle.getFuelLevel() > 150) then
- for i = 1, length do
- line()
- lineEnd()
- line()
- if(i ~= length) then
- rowEnd()
- end
- end
- goHome()
- dock()
- else
- enabled = false
- print('out of fuel T.T')
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement