refactor: add config-miner file

This commit is contained in:
Guillaume ARM 2024-05-09 02:58:21 +02:00
parent 772d94693d
commit 1e30be3223
3 changed files with 19 additions and 8 deletions

6
config-miner.lua Normal file
View File

@ -0,0 +1,6 @@
return {
startY = 101,
targetY = 101,
height = 1,
size = 2 -- should not be odd
}

View File

@ -4,6 +4,11 @@ local LIST_FILES = {
'miner.lua' 'miner.lua'
}; };
local LIST_CONFIG_FILES = {
'config-miner.lua'
}
local REPO_PREFIX = 'https://git.trapcloud.fr/guillaumearm/minecraft-cc-tools/raw/branch/master/' local REPO_PREFIX = 'https://git.trapcloud.fr/guillaumearm/minecraft-cc-tools/raw/branch/master/'
local previousDir = shell.dir() local previousDir = shell.dir()
@ -13,4 +18,11 @@ for _, filePath in pairs(LIST_FILES) do
shell.execute('wget', REPO_PREFIX .. filePath, filePath) shell.execute('wget', REPO_PREFIX .. filePath, filePath)
end end
-- do not override existing config files
for _, filePath in pairs(LIST_CONFIG_FILES) do
if not fs.exists(filePath) then
shell.execute('wget', REPO_PREFIX .. filePath, filePath)
end
end
shell.setDir(previousDir) shell.setDir(previousDir)

View File

@ -1,12 +1,6 @@
local robotApi = require('robot') local robotApi = require('robot')
local turtleUtils = require('turtle-utils') local turtleUtils = require('turtle-utils')
local config = require('config-miner')
local config = {
startY = 109,
targetY = 109,
height = 4,
size = 16
}
local LOWER_SIZE_LIMIT = 2; local LOWER_SIZE_LIMIT = 2;
local HIGHER_SIZE_LIMIT = 128; local HIGHER_SIZE_LIMIT = 128;
@ -20,7 +14,6 @@ local MAX_X = TARGET_X
local MAX_Y = INITIAL_TARGET_Y + (config.height - 1) local MAX_Y = INITIAL_TARGET_Y + (config.height - 1)
local MAX_Z = TARGET_Z 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