Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function forward(i)
- while i > 0 do
- turtle.forward()
- i=i-1
- end
- end
- function pick_flower()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end
- function pick_and_move(i)
- while i > 0 do
- if turtle.detectDown() then
- turtle.digDown()
- end
- forward(1)
- i = i-1
- end
- end
- function uturn_left()
- turtle.turnLeft()
- pick_and_move(1)
- turtle.turnLeft()
- end
- function uturn_right()
- turtle.turnRight()
- pick_and_move(1)
- turtle.turnRight()
- end
- function dump_flowers()
- local i
- for i=1,16,1 do
- if turtle.getItemCount(i) > 0 then
- turtle.select(i)
- turtle.dropDown()
- end
- end
- turtle.select(1)
- end
- function one_lap()
- local i, fuel
- turtle.up()
- forward(3)
- pick_and_move(7)
- uturn_right()
- pick_and_move(7)
- uturn_left()
- pick_and_move(7)
- uturn_right()
- pick_and_move(7)
- uturn_left()
- pick_and_move(3)
- forward(1)
- pick_and_move(3)
- uturn_right()
- pick_and_move(7)
- uturn_left()
- pick_and_move(7)
- uturn_right()
- pick_and_move(7)
- uturn_left()
- pick_and_move(7)
- turtle.turnLeft()
- turtle.turnLeft()
- pick_flower()
- forward(8)
- turtle.turnRight()
- pick_and_move(8)
- pick_flower()
- turtle.turnRight()
- turtle.back()
- turtle.back()
- turtle.down()
- dump_flowers()
- fuel = turtle.getFuelLevel()
- if fuel > 200 then
- print("Fuel: ",fuel)
- else
- print("Out of fuel")
- return
- end
- end
- function main()
- local fuel
- fuel = turtle.getFuelLevel()
- while fuel > 200 do
- one_lap()
- fuel = turtle.getFuelLevel()
- if fuel > 200 then
- sleep(180)
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement