fix(inferium-server): length of the plan is automatically calculated

This commit is contained in:
Guillaume ARM 2024-05-22 19:41:24 +02:00
parent c555e4e0fc
commit b2658117fd
2 changed files with 11 additions and 3 deletions

View File

@ -15,7 +15,6 @@ return {
mystical('inferium')
},
fertilizedBoost = false,
length = 8,
firstCropZ = 2
}
}

View File

@ -1,7 +1,8 @@
local net = require('libs/net')
local utils = require('libs/utils')
local inferium = require('config/inferium')
local VERSION = "1.1.1"
local VERSION = "1.1.2"
local INFERIUM_SERVER = 'inferium.com'
local PERSISTED_CONFIGS = '/data/inferium-configs'
@ -46,6 +47,14 @@ local function setConfigForComputer(computerId, config)
savePersistedConfigs(LOCAL_CONFIGS)
end
local function getConfigWithLength(config)
local configWithLength = utils.shallowClone(config)
configWithLength.length = utils.sizeof(config.plan)
return configWithLength
end
local function getConfig(computerId)
if not computerId == nil then
print('getconfig error: no computerId found')
@ -62,7 +71,7 @@ local function getConfig(computerId)
return {
type = "getconfig/response",
payload = config
payload = getConfigWithLength(config)
}
end