diff --git a/MWSE/mods/celediel/ASinkingFeeling/config.lua b/MWSE/mods/celediel/ASinkingFeeling/config.lua index 671d1ae..7fac395 100644 --- a/MWSE/mods/celediel/ASinkingFeeling/config.lua +++ b/MWSE/mods/celediel/ASinkingFeeling/config.lua @@ -1,6 +1,8 @@ local common = require("celediel.ASinkingFeeling.common") -local defaultConfig = { +local this = {} + +this.defaultConfig = { enabled = true, debug = false, playerOnly = false, @@ -12,6 +14,11 @@ local defaultConfig = { mode = common.modes.equippedArmour.value } -local config = mwse.loadConfig(common.configString, defaultConfig) +local currentConfig -return config +this.getConfig = function() + currentConfig = currentConfig or mwse.loadConfig(common.configString, this.defaultConfig) + return currentConfig +end + +return this diff --git a/MWSE/mods/celediel/ASinkingFeeling/main.lua b/MWSE/mods/celediel/ASinkingFeeling/main.lua index f8ec4be..00dd22d 100644 --- a/MWSE/mods/celediel/ASinkingFeeling/main.lua +++ b/MWSE/mods/celediel/ASinkingFeeling/main.lua @@ -1,4 +1,4 @@ -local config = require("celediel.ASinkingFeeling.config") +local config = require("celediel.ASinkingFeeling.config").getConfig() local common = require("celediel.ASinkingFeeling.common") -- Helper Functions diff --git a/MWSE/mods/celediel/ASinkingFeeling/mcm.lua b/MWSE/mods/celediel/ASinkingFeeling/mcm.lua index 59a60ef..caff22b 100644 --- a/MWSE/mods/celediel/ASinkingFeeling/mcm.lua +++ b/MWSE/mods/celediel/ASinkingFeeling/mcm.lua @@ -1,7 +1,8 @@ local common = require("celediel.ASinkingFeeling.common") local config = require("celediel.ASinkingFeeling.config") +local currentConfig = config.getConfig() -local function createTableVar(id) return mwse.mcm.createTableVariable({id = id, table = config}) end +local function createTableVar(id) return mwse.mcm.createTableVariable({id = id, table = currentConfig}) end local function createDescriptions() local description = "Formula used to calculate down-pull amount.\n\nOptions are: " @@ -37,7 +38,7 @@ local function createOptions() end local template = mwse.mcm.createTemplate(common.modName) -template:saveOnClose(common.configString, config) +template:saveOnClose(common.configString, currentConfig) local page = template:createSideBarPage({ label = "Sidebar Page???", @@ -65,12 +66,12 @@ category:createDropdown({ variable = createTableVar("mode") }) -for name, _ in pairs(config.multipliers) do +for name, _ in pairs(config.defaultConfig.multipliers) do local title = common.camelCaseToWords(name) category:createSlider({ label = title .. " multiplier", - description = "Multiplier used for " .. title .." formula. Default value: 100", - variable = mwse.mcm.createTableVariable({id = name, table = config.multipliers}), + description = "Multiplier used for " .. title .." formula. Default value: " .. config.defaultConfig.multipliers[name], + variable = mwse.mcm.createTableVariable({id = name, table = currentConfig.multipliers}), min = 0, max = 300, step = 1,