Added config validator and changed behavior of hidden state storage config flag
This commit is contained in:
1 parent
4b248762bc
commit
b2b869d9a9
3 files changed
+15
-13
No files matched your search
+4
-4
@@ -54,7 +54,7 @@ EID.UserConfig = {
|
|||||||
["HideKey"] = Keyboard.KEY_F2,
|
["HideKey"] = Keyboard.KEY_F2,
|
||||||
-- Initial displaystate. Can be used to change the toggle behavior of the "Hide Key" event
|
-- Initial displaystate. Can be used to change the toggle behavior of the "Hide Key" event
|
||||||
-- Default = false
|
-- Default = false
|
||||||
["Hidden"] = false,
|
["InitiallyHidden"] = false,
|
||||||
-- Hide the descriptions when in battle
|
-- Hide the descriptions when in battle
|
||||||
-- Default = false
|
-- Default = false
|
||||||
["HideInBattle"] = false,
|
["HideInBattle"] = false,
|
||||||
@@ -167,11 +167,11 @@ EID.UserConfig = {
|
|||||||
---------Mouse Controls-----------
|
---------Mouse Controls-----------
|
||||||
|
|
||||||
-- Toggles HUD descriptions based on the mouse position
|
-- Toggles HUD descriptions based on the mouse position
|
||||||
-- Default = "false"
|
-- Default = false
|
||||||
["EnableMouseControls"] = false,
|
["EnableMouseControls"] = false,
|
||||||
|
|
||||||
-- Toggles the custom mouse cursor
|
-- Toggles the custom mouse cursor
|
||||||
-- Default = "false"
|
-- Default = false
|
||||||
["ShowCursor"] = false,
|
["ShowCursor"] = false,
|
||||||
|
|
||||||
-------------MISC---------------
|
-------------MISC---------------
|
||||||
@@ -225,7 +225,7 @@ EID.DefaultConfig = {
|
|||||||
["MaxDistance"] = 5,
|
["MaxDistance"] = 5,
|
||||||
["Indicator"] = "none",
|
["Indicator"] = "none",
|
||||||
["HideKey"] = Keyboard.KEY_F2,
|
["HideKey"] = Keyboard.KEY_F2,
|
||||||
["Hidden"] = false,
|
["InitiallyHidden"] = false,
|
||||||
["HideInBattle"] = false,
|
["HideInBattle"] = false,
|
||||||
["DisableObstructionOnFlight"] = true,
|
["DisableObstructionOnFlight"] = true,
|
||||||
["DisableOnCurse"] = true,
|
["DisableOnCurse"] = true,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ require("eid_config")
|
|||||||
EID.Config = EID.UserConfig
|
EID.Config = EID.UserConfig
|
||||||
EID.Config.Version = "3.2"
|
EID.Config.Version = "3.2"
|
||||||
EID.DefaultConfig.Version = EID.Config.Version
|
EID.DefaultConfig.Version = EID.Config.Version
|
||||||
EID.isHidden = EID.Config["Hidden"]
|
EID.isHidden = false
|
||||||
EID.player = nil
|
EID.player = nil
|
||||||
|
|
||||||
-- general variables
|
-- general variables
|
||||||
@@ -728,19 +728,22 @@ if EID.MCMLoaded or REPENTANCE then
|
|||||||
if savedEIDConfig.Version == EID.Config.Version then
|
if savedEIDConfig.Version == EID.Config.Version then
|
||||||
local isDefaultConfig = true
|
local isDefaultConfig = true
|
||||||
for key, value in pairs(EID.Config) do
|
for key, value in pairs(EID.Config) do
|
||||||
|
if type(value) ~= type(EID.DefaultConfig[key]) and key ~= "BagContent" then
|
||||||
|
print("EID Warning! : Config value '"..key.."' has wrong data-type. Resetting it to default...")
|
||||||
|
EID.Config[key] = EID.DefaultConfig[key]
|
||||||
|
end
|
||||||
if EID.DefaultConfig[key] ~= value then
|
if EID.DefaultConfig[key] ~= value then
|
||||||
isDefaultConfig = false
|
isDefaultConfig = false
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if isDefaultConfig or EID.MCMLoaded then
|
if isDefaultConfig or EID.MCMLoaded then
|
||||||
for key, value in pairs(EID.Config) do
|
for key, value in pairs(EID.Config) do
|
||||||
if savedEIDConfig[key] ~= nil then
|
if savedEIDConfig[key] ~= nil and type(value) == type(savedEIDConfig[key]) then
|
||||||
EID.Config[key] = savedEIDConfig[key]
|
EID.Config[key] = savedEIDConfig[key]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EID.isHidden = EID.Config["Hidden"]
|
EID.isHidden = EID.Config["InitiallyHidden"]
|
||||||
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"])
|
||||||
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt")
|
||||||
EID:addTextPosModifier("HudOffset", Vector((EID.Config["HUDOffset"] * 2) - 20, EID.Config["HUDOffset"] - 10))
|
EID:addTextPosModifier("HudOffset", Vector((EID.Config["HUDOffset"] * 2) - 20, EID.Config["HUDOffset"] - 10))
|
||||||
|
|||||||
+4
-5
@@ -187,18 +187,17 @@ if MCMLoaded then
|
|||||||
{
|
{
|
||||||
Type = ModConfigMenu.OptionType.BOOLEAN,
|
Type = ModConfigMenu.OptionType.BOOLEAN,
|
||||||
CurrentSetting = function()
|
CurrentSetting = function()
|
||||||
return EID.isHidden
|
return EID.Config["InitiallyHidden"]
|
||||||
end,
|
end,
|
||||||
Display = function()
|
Display = function()
|
||||||
local onOff = "False"
|
local onOff = "False"
|
||||||
if EID.isHidden then
|
if EID.Config["InitiallyHidden"] then
|
||||||
onOff = "True"
|
onOff = "True"
|
||||||
end
|
end
|
||||||
return 'Is Hidden: ' .. onOff
|
return 'Is initially Hidden: ' .. onOff
|
||||||
end,
|
end,
|
||||||
OnChange = function(currentBool)
|
OnChange = function(currentBool)
|
||||||
EID.Config["Hidden"] = currentBool
|
EID.Config["InitiallyHidden"] = currentBool
|
||||||
EID.isHidden = currentBool
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user