From b2658117fd886f8a704c0c985e6a4db0562452f0 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Wed, 22 May 2024 19:41:24 +0200 Subject: [PATCH] fix(inferium-server): length of the plan is automatically calculated --- config/inferium.lua | 1 - inferium-server.lua | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config/inferium.lua b/config/inferium.lua index 9577534..5167ec4 100644 --- a/config/inferium.lua +++ b/config/inferium.lua @@ -15,7 +15,6 @@ return { mystical('inferium') }, fertilizedBoost = false, - length = 8, firstCropZ = 2 } } diff --git a/inferium-server.lua b/inferium-server.lua index 7a8b179..edde063 100644 --- a/inferium-server.lua +++ b/inferium-server.lua @@ -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