diff --git a/miner.lua b/miner.lua index 0024b02..7dfe62d 100644 --- a/miner.lua +++ b/miner.lua @@ -4,6 +4,7 @@ local config = require('config-miner') local LOWER_SIZE_LIMIT = 2; local HIGHER_SIZE_LIMIT = 128; +local FUEL_NEEDED_MULTIPLIER = 3 local ADDITIONAL_FUEL_NEEDED = 256 local INITIAL_TARGET_Y = config.targetY - config.startY @@ -17,7 +18,7 @@ local MAX_Z = TARGET_Z local robot = robotApi.create() 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 = { robot = robot, @@ -63,6 +64,10 @@ local function checkConfig() if isOdd(config.size) then error('configured size should be even') end + + if MIN_FUEL_NEEDED > turtle.getFuelLimit() then + error('MIN_FUEL_NEEDED is higher than the turtle fuel limit') + end end local function prepareTurtle()