From 7d6825f59d02766ce59fb29bc442ee744290fde3 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Wed, 8 May 2024 21:43:30 +0200 Subject: [PATCH] fix: better debug messages + debug refuel --- miner.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/miner.lua b/miner.lua index bcbd102..5c3a53e 100644 --- a/miner.lua +++ b/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