Skip to content

Commit

Permalink
toggle role indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
TimGoll committed Jan 19, 2025
1 parent b46e0e2 commit 714f735
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,10 @@ function SKIN:PaintRoleImageTTT2(panel, w, h)
)
end

if not panel:IndicatorEnabled() then
return
end

drawRoundedBoxEx(
sizes.cornerRadius,
w - sizeMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function PANEL:Init()
self.data = {
color = COLOR_WHITE,
icon = nil,
indicatorState = false,
}
end

Expand Down Expand Up @@ -49,6 +50,20 @@ function PANEL:DoRightClick()
self:ValueChanged(newValue)
end

---
-- param boolean state
-- @realm client
function PANEL:EnableIndicator(state)

Check failure on line 56 in gamemodes/terrortown/gamemode/client/cl_vskin/vgui/droleimage_ttt2.lua

View workflow job for this annotation

GitHub Actions / doc-check

Param mismatch --> "In 'function' datastructure ('function PANEL:EnableIndicator(state)'), detected params (0): " "Expected Params (1): " "- 'state'"
self.data.indicatorState = state
end

---
-- @return boolean
-- @realm client
function PANEL:IndicatorEnabled()
return self.data.indicatorState or false
end

---
-- @ignore
function PANEL:Paint(w, h)
Expand Down
1 change: 1 addition & 0 deletions lua/terrortown/menus/gamemode/roles/rolelayering.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ hook.Add("TTT2ReceivedRolelayerData", "received_layer_data", function(role, laye
ic:SetTooltip(roleData.name)
ic:SetTooltipFixedPosition(0, 64)
ic:SetServerConVar("ttt_" .. roleData.name .. "_enabled")
ic:EnableIndicator(true)

ic.subrole = subrole

Expand Down

0 comments on commit 714f735

Please sign in to comment.