Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function select_fuel(from_slot)
- local slot
- local success
- slot = 1
- success = false
- while slot <= 16 do
- turtle.select(slot)
- if turtle.refuel() then
- success = true
- end
- slot = slot + 1
- end
- return success
- end
- function print_fuel_status()
- print("Fuel level: ", turtle.getFuelLevel(), "/", turtle.getFuelLimit())
- end
- function check_fuel()
- local sleeptime
- local try
- try = 0
- sleeptime = 0.5
- while turtle.getFuelLevel() < turtle.getFuelLimit() do
- if not select_fuel() then
- print("Waiting fuel... retrying in " .. sleeptime .. " seconds.")
- print_fuel_status()
- sleep(i)
- sleeptime = 2
- try = try + 1
- else
- sleeptime = 0.5
- end
- print_fuel_status()
- if try > 500 then
- print("Master forgotten me...")
- return false
- end
- end
- return true
- end
- check_fuel()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement