Changed mine.lua with configurable fuel store amount

This commit is contained in:
Emerson Rosen-Jones 2025-08-18 18:38:45 -04:00
parent 779385271a
commit 8a9b0e4361

View file

@ -2,11 +2,19 @@
-- current position and facing
-- +x = right of start, +y = forward of start, +z = up of start
local FUEL_RESERVE = 800
local FORWARD, RIGHT, BACK, LEFT = 0, 1, 2, 3
local mode = { x = 0, y = 0, z = 0, facing = FORWARD }
mode.mine = { forward = true }
local block = {}
function refuelUntil (amt)
while turtle.getFuelLevel() < amt do
if not turtle.refuel(8) then break end
end
end
function mineSides ()
if mode.mine.up then
turtle.digUp()
@ -126,7 +134,7 @@ end
function moveAndCheck (x, y, z)
move(x, y, z)
if inventoryFull() then dropOffItems(true) end
if turtle.getFuelLevel() < 100 then turtle.refuel(8) end
refuelUntil(FUEL_RESERVE)
end
function generateNextSteps (w, l)
@ -188,7 +196,7 @@ end
function mine (block)
-- fuel and go to starting corner
if turtle.getFuelLevel() < 100 then turtle.refuel(8) end
refuelUntil(FUEL_RESERVE)
mode.mine = { forward = true }
moveAbs(block.x, block.y, block.z)
local z_dir