Changed mine.lua with configurable fuel store amount
This commit is contained in:
parent
779385271a
commit
8a9b0e4361
1 changed files with 10 additions and 2 deletions
12
mine.lua
12
mine.lua
|
|
@ -2,11 +2,19 @@
|
||||||
-- current position and facing
|
-- current position and facing
|
||||||
|
|
||||||
-- +x = right of start, +y = forward of start, +z = up of start
|
-- +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 FORWARD, RIGHT, BACK, LEFT = 0, 1, 2, 3
|
||||||
local mode = { x = 0, y = 0, z = 0, facing = FORWARD }
|
local mode = { x = 0, y = 0, z = 0, facing = FORWARD }
|
||||||
mode.mine = { forward = true }
|
mode.mine = { forward = true }
|
||||||
local block = {}
|
local block = {}
|
||||||
|
|
||||||
|
function refuelUntil (amt)
|
||||||
|
while turtle.getFuelLevel() < amt do
|
||||||
|
if not turtle.refuel(8) then break end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function mineSides ()
|
function mineSides ()
|
||||||
if mode.mine.up then
|
if mode.mine.up then
|
||||||
turtle.digUp()
|
turtle.digUp()
|
||||||
|
|
@ -126,7 +134,7 @@ end
|
||||||
function moveAndCheck (x, y, z)
|
function moveAndCheck (x, y, z)
|
||||||
move(x, y, z)
|
move(x, y, z)
|
||||||
if inventoryFull() then dropOffItems(true) end
|
if inventoryFull() then dropOffItems(true) end
|
||||||
if turtle.getFuelLevel() < 100 then turtle.refuel(8) end
|
refuelUntil(FUEL_RESERVE)
|
||||||
end
|
end
|
||||||
|
|
||||||
function generateNextSteps (w, l)
|
function generateNextSteps (w, l)
|
||||||
|
|
@ -188,7 +196,7 @@ end
|
||||||
|
|
||||||
function mine (block)
|
function mine (block)
|
||||||
-- fuel and go to starting corner
|
-- fuel and go to starting corner
|
||||||
if turtle.getFuelLevel() < 100 then turtle.refuel(8) end
|
refuelUntil(FUEL_RESERVE)
|
||||||
mode.mine = { forward = true }
|
mode.mine = { forward = true }
|
||||||
moveAbs(block.x, block.y, block.z)
|
moveAbs(block.x, block.y, block.z)
|
||||||
local z_dir
|
local z_dir
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue