Skip to content

Commit

Permalink
Remove unsupported cvars from cvar browser
Browse files Browse the repository at this point in the history
- We have cvars that have been removed from the game hard-coded into the addon;
these were previously being stripped out using the CVarExists function, which no longer works
- The hard-coded list is now only being used to provide descriptions for cvars
  • Loading branch information
semlar committed Oct 29, 2020
1 parent a670ef3 commit a470aa3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions browser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ local _G = _G
local E = addon:Eve()

function addon:CVarExists(cvar)
-- FIXME: This no longer works to identify whether a cvar exists
return pcall(function() return GetCVarDefault(cvar) end)
end

-- Go through list of cvars and remove any that don't currently exist
local CVarList = {}
for cvar in pairs(addon.hiddenOptions) do
local cvar_exists = addon:CVarExists(cvar) -- pcall(function() return GetCVarDefault(cvar) end)
if cvar_exists then
CVarList[cvar] = addon.hiddenOptions[cvar]
else
-- addon.hiddenOptions[cvar] = nil -- can't do this because we have exceptions for some settings that aren't cvars, should probably restructure the database
-- print("Warning, CVar doesn't exist:", cvar)
for i, info in pairs(C_Console.GetAllCommands()) do
local cvar = info.command
if info.commandType == 0 -- cvar, rather than script
and info.category ~= 0 -- ignore debug category
and not strfind(info.command:lower(), 'debug') -- a number of commands with "debug" in their name are inexplicibly not in the "debug" category
and info.category ~= 8 -- ignore GM category
then
if addon.hiddenOptions[cvar] then
CVarList[cvar] = addon.hiddenOptions[cvar]
else
CVarList[cvar] = {
description = info.help,
}
end
end
end

Expand Down

0 comments on commit a470aa3

Please sign in to comment.