expose default config so MCM can access
This commit is contained in:
parent
83d01ec04a
commit
be297bb586
3 changed files with 17 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue