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