Skip to content

Commit 215ad5a

Browse files
authored
vGui: Fixed Clientside ConVars & Small Misc Fixes (#1742)
fixes #1735 This issue was created since the cvar is now tracked in the "main button" not the checkbox button anymore. This worked fine for serverside settings with custom handling, as well as client settings that use function wrappers to set the convar (like vskin for example). This change now correctly sets the stored convar. It feels a bit hacky to me to be honest, but only a full rewrite would resolve this. So it is probably fine. I also noticed that [this requested change](#1724 (comment)) was not applied to all function calls, so I renamed the one remaining. Last but not least, I noticed that the border radius was substracted twice.
1 parent 19cbd67 commit 215ad5a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

gamemodes/terrortown/gamemode/client/cl_vskin/default_skin.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,8 +1768,8 @@ function SKIN:PaintRoleImageTTT2(panel, w, h)
17681768
drawFilteredShadowedTexture(
17691769
widthBorder,
17701770
widthBorder,
1771-
sizeIconRole - widthBorder2,
1772-
sizeIconRole - widthBorder2,
1771+
sizeIconRole,
1772+
sizeIconRole,
17731773
panel:GetMaterial(),
17741774
colorIcon.a,
17751775
colorIcon
@@ -1778,8 +1778,8 @@ function SKIN:PaintRoleImageTTT2(panel, w, h)
17781778
drawFilteredTexture(
17791779
widthBorder,
17801780
widthBorder,
1781-
sizeIconRole - widthBorder2,
1782-
sizeIconRole - widthBorder2,
1781+
sizeIconRole,
1782+
sizeIconRole,
17831783
panel:GetMaterial(),
17841784
colorIcon.a * 0.5,
17851785
colorIcon

gamemodes/terrortown/gamemode/client/cl_vskin/vgui/dbutton_ttt2.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ function PANEL:SetConVar(cvar)
7474
return
7575
end
7676

77-
self:SetDefaultValue(tobool(GetConVar(cvar):GetDefault()))
77+
self.convar = GetConVar(cvar)
78+
79+
self:SetDefaultValue(tobool(self.convar:GetDefault()))
80+
self:SetValue(self.convar:GetBool())
7881
end
7982

8083
local callbackEnabledVarTracker = 0
@@ -217,7 +220,9 @@ function PANEL:ValueChanged(val)
217220
val = not val
218221
end
219222

220-
if self.serverConVar and not self:GetIgnoreCallbackEnabledVar() then
223+
if self.convar then
224+
self.convar:SetBool(val)
225+
elseif self.serverConVar and not self:GetIgnoreCallbackEnabledVar() then
221226
cvars.ChangeServerConVar(self.serverConVar, val and "1" or "0")
222227
elseif self.databaseInfo and not self:GetIgnoreCallbackEnabledVar() then
223228
database.SetValue(

gamemodes/terrortown/gamemode/client/cl_vskin/vgui/drolelayeringreceiver_ttt2.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function PANEL:InitRoles(layeredRoles)
236236
ic:SetTooltip(roleData.name)
237237
ic:SetTooltipFixedPosition(0, 64)
238238
ic:SetServerConVar("ttt_" .. roleData.name .. "_enabled")
239-
ic:EnableIndicator(true)
239+
ic:SetIsActiveIndicator(true)
240240

241241
ic.subrole = subrole
242242

0 commit comments

Comments
 (0)