fix: better handling of the minimum fuel limit
This commit is contained in:
parent
4c84f48207
commit
09d15d0db7
@ -4,6 +4,7 @@ local config = require('config-miner')
|
|||||||
|
|
||||||
local LOWER_SIZE_LIMIT = 2;
|
local LOWER_SIZE_LIMIT = 2;
|
||||||
local HIGHER_SIZE_LIMIT = 128;
|
local HIGHER_SIZE_LIMIT = 128;
|
||||||
|
local FUEL_NEEDED_MULTIPLIER = 3
|
||||||
local ADDITIONAL_FUEL_NEEDED = 256
|
local ADDITIONAL_FUEL_NEEDED = 256
|
||||||
|
|
||||||
local INITIAL_TARGET_Y = config.targetY - config.startY
|
local INITIAL_TARGET_Y = config.targetY - config.startY
|
||||||
@ -17,7 +18,7 @@ local MAX_Z = TARGET_Z
|
|||||||
local robot = robotApi.create()
|
local robot = robotApi.create()
|
||||||
|
|
||||||
local MAX_INVENTORY_BLOCKS = 16 * 64
|
local MAX_INVENTORY_BLOCKS = 16 * 64
|
||||||
local MIN_FUEL_NEEDED = 2 * ((config.size * 2) + INITIAL_TARGET_Y) + MAX_INVENTORY_BLOCKS + ADDITIONAL_FUEL_NEEDED
|
local MIN_FUEL_NEEDED = FUEL_NEEDED_MULTIPLIER * ((config.size * 2) + INITIAL_TARGET_Y) + MAX_INVENTORY_BLOCKS + ADDITIONAL_FUEL_NEEDED
|
||||||
|
|
||||||
local miner = {
|
local miner = {
|
||||||
robot = robot,
|
robot = robot,
|
||||||
@ -63,6 +64,10 @@ local function checkConfig()
|
|||||||
if isOdd(config.size) then
|
if isOdd(config.size) then
|
||||||
error('configured size should be even')
|
error('configured size should be even')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if MIN_FUEL_NEEDED > turtle.getFuelLimit() then
|
||||||
|
error('MIN_FUEL_NEEDED is higher than the turtle fuel limit')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function prepareTurtle()
|
local function prepareTurtle()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user