refuel-test.lua
28 lines · 476 B
Copy & run
wget https://perlytiara.github.io/turtles.tips/raw/programs/BigGamingGamers/refuel-test.lua
| 1 | local SLOT_COUNT = 16 |
| 2 | |
| 3 | function checkFuel() |
| 4 | turtle.select(1) |
| 5 | |
| 6 | if(turtle.getFuelLevel() < 100) then |
| 7 | for slot = 1, SLOT_COUNT, 1 do |
| 8 | print(string.format("Attempting refuel on slot %d", slot)) |
| 9 | turtle.select(slot) |
| 10 | if(turtle.refuel(1)) then |
| 11 | return true |
| 12 | end |
| 13 | end |
| 14 | end |
| 15 | |
| 16 | |
| 17 | end |
| 18 | |
| 19 | while(true) |
| 20 | do |
| 21 | if(not checkFuel()) then |
| 22 | print("Turtle is out of fuel...") |
| 23 | |
| 24 | break |
| 25 | end |
| 26 | |
| 27 | end |
| 28 |