fix(inferium-server): length of the plan is automatically calculated
This commit is contained in:
parent
c555e4e0fc
commit
b2658117fd
@ -15,7 +15,6 @@ return {
|
|||||||
mystical('inferium')
|
mystical('inferium')
|
||||||
},
|
},
|
||||||
fertilizedBoost = false,
|
fertilizedBoost = false,
|
||||||
length = 8,
|
|
||||||
firstCropZ = 2
|
firstCropZ = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
local net = require('libs/net')
|
local net = require('libs/net')
|
||||||
|
local utils = require('libs/utils')
|
||||||
local inferium = require('config/inferium')
|
local inferium = require('config/inferium')
|
||||||
|
|
||||||
local VERSION = "1.1.1"
|
local VERSION = "1.1.2"
|
||||||
local INFERIUM_SERVER = 'inferium.com'
|
local INFERIUM_SERVER = 'inferium.com'
|
||||||
|
|
||||||
local PERSISTED_CONFIGS = '/data/inferium-configs'
|
local PERSISTED_CONFIGS = '/data/inferium-configs'
|
||||||
@ -46,6 +47,14 @@ local function setConfigForComputer(computerId, config)
|
|||||||
savePersistedConfigs(LOCAL_CONFIGS)
|
savePersistedConfigs(LOCAL_CONFIGS)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function getConfigWithLength(config)
|
||||||
|
local configWithLength = utils.shallowClone(config)
|
||||||
|
configWithLength.length = utils.sizeof(config.plan)
|
||||||
|
|
||||||
|
return configWithLength
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function getConfig(computerId)
|
local function getConfig(computerId)
|
||||||
if not computerId == nil then
|
if not computerId == nil then
|
||||||
print('getconfig error: no computerId found')
|
print('getconfig error: no computerId found')
|
||||||
@ -62,7 +71,7 @@ local function getConfig(computerId)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
type = "getconfig/response",
|
type = "getconfig/response",
|
||||||
payload = config
|
payload = getConfigWithLength(config)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user