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 common = require("celediel.ASinkingFeeling.common")
|
||||||
|
|
||||||
|
local currentConfig
|
||||||
|
|
||||||
local this = {}
|
local this = {}
|
||||||
|
|
||||||
this.defaultConfig = {
|
this.defaultConfig = {
|
||||||
|
@ -15,21 +17,6 @@ this.defaultConfig = {
|
||||||
caseScenarioNecroMode = true
|
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()
|
this.getConfig = function()
|
||||||
currentConfig = currentConfig or mwse.loadConfig(common.configString, this.defaultConfig)
|
currentConfig = currentConfig or mwse.loadConfig(common.configString, this.defaultConfig)
|
||||||
return currentConfig
|
return currentConfig
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
local bigConf = require("celediel.ASinkingFeeling.config")
|
local config = require("celediel.ASinkingFeeling.config").getConfig()
|
||||||
local config = bigConf.getConfig()
|
|
||||||
local common = require("celediel.ASinkingFeeling.common")
|
local common = require("celediel.ASinkingFeeling.common")
|
||||||
|
|
||||||
-- Helper Functions
|
-- Helper Functions
|
||||||
|
@ -158,7 +157,6 @@ end
|
||||||
|
|
||||||
local function onInitialized()
|
local function onInitialized()
|
||||||
event.register("calcSwimSpeed", sinkInWater)
|
event.register("calcSwimSpeed", sinkInWater)
|
||||||
config = bigConf.resetDefaults(config)
|
|
||||||
common.log("Successfully initialized!")
|
common.log("Successfully initialized!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue