fix: better debug messages + debug refuel
This commit is contained in:
parent
3e9222dd8d
commit
7d6825f59d
11
miner.lua
11
miner.lua
@ -22,7 +22,7 @@ local HIGHER_LIMIT = 128;
|
||||
local robot = robotApi.create()
|
||||
|
||||
local MAX_INVENTORY_BLOCKS = 16 * 64
|
||||
local ADDITIONAL_FUEL_NEEDED = 512
|
||||
local ADDITIONAL_FUEL_NEEDED = 128
|
||||
local MIN_FUEL_NEEDED = (config.size * 2) + TARGET_Y + MAX_INVENTORY_BLOCKS + ADDITIONAL_FUEL_NEEDED
|
||||
|
||||
local miner = {
|
||||
@ -79,11 +79,10 @@ local function unloadProcedure()
|
||||
|
||||
for i=1, 16, 1 do
|
||||
turtle.select(i)
|
||||
turtle.refuel()
|
||||
turtleUtils.tryDrop()
|
||||
end
|
||||
|
||||
turtle.select(1)
|
||||
|
||||
miner.mission = 'refuel'
|
||||
end
|
||||
|
||||
@ -131,14 +130,15 @@ local function returnMineProcedure()
|
||||
end
|
||||
|
||||
miner.mission = 'mine'
|
||||
print('> Starting mining procedure...')
|
||||
end
|
||||
else
|
||||
miner.mission = 'mine'
|
||||
print('> Starting mining procedure...')
|
||||
end
|
||||
end
|
||||
|
||||
local function mineProcedure()
|
||||
print('> Starting mine procedure...')
|
||||
local robotState = miner.robot.getState()
|
||||
local targetY = TARGET_Y
|
||||
local targetZ = TARGET_Z
|
||||
@ -170,6 +170,7 @@ local function mineProcedure()
|
||||
miner.finished = true
|
||||
miner.mission = 'return-home'
|
||||
miner.lastPositionState = miner.robot.getState()
|
||||
print('> Starting return home procedure because mining session is finished...')
|
||||
elseif robotState.x == MAX_X and robotState.z == MAX_Z then
|
||||
-- this part assume that the size of the mine is even
|
||||
miner.robot.turnRight()
|
||||
@ -183,13 +184,13 @@ local function mineProcedure()
|
||||
end
|
||||
|
||||
if turtleUtils.countFreeSlots() < 1 then
|
||||
print('> Starting return home procedure because inventory is empty...')
|
||||
miner.mission = 'return-home'
|
||||
miner.lastPositionState = miner.robot.getState()
|
||||
end
|
||||
end
|
||||
|
||||
local function returnHomeProcedure()
|
||||
print('> Starting return home procedure...')
|
||||
local robotState = miner.robot.getState()
|
||||
|
||||
if robotState.x == 0 and robotState.y == 0 and robotState.z == 0 then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user