revert to not resetting badly typed config values
turns out that caused config values to not update on the fly users can fix their own config in the MCM
This commit is contained in:
parent
2320394693
commit
ea05e08733
2 changed files with 3 additions and 18 deletions
|
@ -1,5 +1,7 @@
|
|||
local common = require("celediel.ASinkingFeeling.common")
|
||||
|
||||
local currentConfig
|
||||
|
||||
local this = {}
|
||||
|
||||
this.defaultConfig = {
|
||||
|
@ -15,21 +17,6 @@ this.defaultConfig = {
|
|||
caseScenarioNecroMode = true
|
||||
}
|
||||
|
||||
local currentConfig
|
||||
|
||||
this.resetDefaults = function(config)
|
||||
local resetConfig = {}
|
||||
for k, v in pairs(config) do
|
||||
-- ensure types are consistent, or reset to default
|
||||
if type(v) == type(this.defaultConfig[k]) then
|
||||
resetConfig[k] = config[k]
|
||||
else
|
||||
resetConfig[k] = this.defaultConfig[k]
|
||||
end
|
||||
end
|
||||
return resetConfig
|
||||
end
|
||||
|
||||
this.getConfig = function()
|
||||
currentConfig = currentConfig or mwse.loadConfig(common.configString, this.defaultConfig)
|
||||
return currentConfig
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
local bigConf = require("celediel.ASinkingFeeling.config")
|
||||
local config = bigConf.getConfig()
|
||||
local config = require("celediel.ASinkingFeeling.config").getConfig()
|
||||
local common = require("celediel.ASinkingFeeling.common")
|
||||
|
||||
-- Helper Functions
|
||||
|
@ -158,7 +157,6 @@ end
|
|||
|
||||
local function onInitialized()
|
||||
event.register("calcSwimSpeed", sinkInWater)
|
||||
config = bigConf.resetDefaults(config)
|
||||
common.log("Successfully initialized!")
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue