Skip to content

Commit

Permalink
UI: Hide Propspec bind if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCloudAT committed Jan 4, 2025
1 parent 975691b commit 38f37af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions gamemodes/terrortown/gamemode/server/sv_propspec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ local cvPropspecMax = CreateConVar("ttt_spec_prop_maxbonus", "16", { FCVAR_NOTIF
local cvPropspecDashMulitplier =
CreateConVar("ttt_spec_prop_dash", "2", { FCVAR_NOTIFY, FCVAR_ARCHIVE })

hook.Add("TTT2SyncGlobals", "AddPropspecGlobals", function()
SetGlobalBool(cvPropspecToggle:GetName(), cvPropspecToggle:GetBool())
end)

cvars.AddChangeCallback(cvPropspecToggle:GetName(), function(cv, old, new)
SetGlobalBool(cvPropspecToggle:GetName(), tobool(tonumber(new)))
end)

---
-- Forces a @{Player} to spectate an @{Entity}
-- @param Player ply
Expand Down
2 changes: 1 addition & 1 deletion lua/ttt2/libraries/keyhelp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function keyhelp.InitializeBasicKeys()
KEYHELP_CORE,
"label_keyhelper_possess_focus_entity",
function(client)
if not client:IsSpec() or IsValid(client:GetObserverTarget()) then
if not client:IsSpec() or IsValid(client:GetObserverTarget()) or not GetGlobalBool("ttt_spec_prop_control", true) then
return
end

Expand Down

0 comments on commit 38f37af

Please sign in to comment.