Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command to force config update (untested) #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sonorancad/core/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ SonoranCAD Help
viewcaches - View the current unit and call cache, for troubleshooting
getclientlog <playerId> - Get a log buffer from a given client
dumpconsole - Dumps current console buffer to file
forceconfigupdate - Clears config and forces a re-read of the config file
]])
elseif args[1] == "debugmode" then
Config.debugMode = not Config.debugMode
Expand Down Expand Up @@ -201,6 +202,10 @@ SonoranCAD Help
print(buf[i])
end
print("----ERROR/WARNING BUFFER END----")

elseif args[1] == "forceconfigupdate" then
infoLog("Forcing configuration update... Please restart script")
TriggerEvent("SonoranCAD::core:ForceConfigUpdate")
else
print("Missing command. Try \"sonoran help\" for help.")
end
Expand Down
9 changes: 9 additions & 0 deletions sonorancad/core/configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -557,3 +557,12 @@ function file_exists(name)
return false
end
end

RegisterEvent('SonoranCAD::core:ForceConfigUpdate', function()
for k, _ in pairs(json.decode(conf)) do
local cvar_setter = GetConvar('sonoran_' .. k .. '_setter', 'none')
if cvar_setter == 'framework' then
SetConvar('sonran_' .. k .. '_setter', 'NONE')
end
end
end)