feat(inferium-harvester): better logs on refuel, harvest and remove seeds
This commit is contained in:
parent
b8fb2390f2
commit
0a9294310a
@ -3,7 +3,7 @@ local utils = require('libs/utils')
|
||||
local turtleUtils = require('libs/turtle-utils')
|
||||
local config = require('config/harvesting')
|
||||
|
||||
local VERSION = "2.3.0"
|
||||
local VERSION = "2.5.0"
|
||||
local INFERIUM_SERVER = 'inferium.com'
|
||||
local IDLE_TIME = 2
|
||||
local WAIT_ITEM_IDLE_TIME = 5
|
||||
@ -157,11 +157,19 @@ local function dropAllProcedure()
|
||||
end
|
||||
|
||||
local function refuelProcedure()
|
||||
print('> refuel')
|
||||
local refuelOk, refuelErr = turtleUtils.refuelWithBuffer('bottom', 'front', MIN_FUEL_NEEDED, IDLE_TIME)
|
||||
local fuelLevel = turtle.getFuelLevel()
|
||||
print('> fuel: ' .. tostring(fuelLevel))
|
||||
|
||||
if not refuelOk then
|
||||
error('Cannot refuel the turtle: "' .. refuelErr .. '"')
|
||||
if fuelLevel < MIN_FUEL_NEEDED then
|
||||
print('> refuel needed (minimum is ' .. MIN_FUEL_NEEDED .. ')')
|
||||
|
||||
local refuelOk, refuelErr = turtleUtils.refuelWithBuffer('bottom', 'front', MIN_FUEL_NEEDED, IDLE_TIME)
|
||||
|
||||
if not refuelOk then
|
||||
error('Cannot refuel the turtle: "' .. refuelErr .. '"')
|
||||
end
|
||||
|
||||
print('> fuel: ' .. tostring(fuelLevel))
|
||||
end
|
||||
end
|
||||
|
||||
@ -222,15 +230,23 @@ local function forward()
|
||||
end
|
||||
|
||||
local function harvestProcedure()
|
||||
print('> harvest')
|
||||
|
||||
term.write('> harvest on ' .. tostring(config.length) .. ' blocks')
|
||||
local nbHarvested = 0
|
||||
for i=1, config.length, 1 do
|
||||
harvestDown(i)
|
||||
if harvestDown(i) then
|
||||
nbHarvested = nbHarvested + 1
|
||||
term.write(' .')
|
||||
else
|
||||
term.write(' !')
|
||||
end
|
||||
|
||||
if i ~= config.length then
|
||||
forward()
|
||||
end
|
||||
end
|
||||
term.write('\n')
|
||||
|
||||
print('> ' .. tostring(nbHarvested) .. ' harvested crops')
|
||||
|
||||
turtle.turnLeft()
|
||||
turtle.turnLeft()
|
||||
@ -302,7 +318,7 @@ end
|
||||
local function removeSeeds(seeds)
|
||||
goToHarvestPoint()
|
||||
|
||||
print('> remove old seeds')
|
||||
print('> remove ' .. utils.sizeof(seeds) .. ' seed(s)')
|
||||
local stateSeeds = seeds -- warning: do not mutate the data (only the ref)
|
||||
|
||||
for i=1, config.length, 1 do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user