fix(inferium-harvester): handle when a turtle is blocked during forward

This commit is contained in:
Guillaume ARM 2024-05-22 19:31:17 +02:00
parent f38f3dc7bf
commit 77210784ff

View File

@ -2,7 +2,7 @@ local net = require('libs/net')
local utils = require('libs/utils') local utils = require('libs/utils')
local turtleUtils = require('libs/turtle-utils') local turtleUtils = require('libs/turtle-utils')
local VERSION = "3.0.1" local VERSION = "3.1.0"
local INFERIUM_SERVER = 'inferium.com' local INFERIUM_SERVER = 'inferium.com'
local IDLE_TIME = 2 local IDLE_TIME = 2
local WAIT_ITEM_IDLE_TIME = 5 local WAIT_ITEM_IDLE_TIME = 5
@ -244,8 +244,17 @@ end
local function forward() local function forward()
if not turtle.forward() then local blocked = false
error('turtle is blocked')
while not turtle.forward() do
if not blocked then
blocked = true
print('> turtle is blocked')
end
end
if blocked then
print('turtle is unblocked')
end end
end end