Mine turtle: fix refuel

This commit is contained in:
Théophile Bastian 2020-08-18 18:33:26 +02:00
parent 503cf6c0e4
commit e985454913
1 changed files with 5 additions and 5 deletions

View File

@ -116,7 +116,7 @@ function refuel_turtle()
return false return false
end end
go_to(DROP_POINT_H, DROP_POINT_D, DROP_POINT_S) go_to(FUEL_POINT_H, FUEL_POINT_D, FUEL_POINT_S)
while turtle.getFuelLevel() < FUEL_EXPECTATION do while turtle.getFuelLevel() < FUEL_EXPECTATION do
local rc, desc = turtle.suckUp() local rc, desc = turtle.suckUp()
if not rc then if not rc then
@ -193,11 +193,11 @@ end
-- Main function -- Main function
function main() function main()
if turtle.getFuelLevel() < FUEL_LOW then if turtle.getFuelLevel() < distance_to_refuel() then
refuel_turtle() print("Not enough fuel to begin with.")
else
print("NO FUEL AT ALL.")
return return
elseif turtle.getFuelLevel() < FUEL_LOW then
refuel_turtle()
end end
while true do while true do