Skip to content

Commit 516bf08

Browse files
milkwxterTimGoll
andauthored
HUD: Added Team name next to Role name (#1726)
Hello! I have encountered a problem on my friends server where if we have many roles installed, some players who join will not know what every single role is, and they will become confused, especially with what team they are supposed to play on. This new change will allow players to see what team they are on, immediately next to their role name. I know there is a team ICON next to the time remaining in the match on the top of the screen, but our players either never even noticed it, or did not know what it meant. I have included a toggle in the F1 menu, under HUD Switcher so that players who feel like they don't need to see the team can turn it off and enjoy the game their way. If you guys have any changes to be made I would love to hear it, I think this change will help new player retention! Here are some previews of how it will look, including the F1 menu and an example with a long role name! ![f1_menu](https://github.com/user-attachments/assets/a67e867d-53e3-4d57-b2b4-d5af7b15060b) ![short_name](https://github.com/user-attachments/assets/12be0364-4b44-465c-83ab-aaf3855616ac) ![long_name](https://github.com/user-attachments/assets/fdd3e46e-edfd-4274-96aa-d2ac82da177c) --------- Co-authored-by: Tim Goll <github@timgoll.de>
1 parent cb34ac0 commit 516bf08

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
1212
- Added `GM:TTT2PlayDeathScream` hook to cancel or overwrite/change the deathscream sound that plays, when you die (by @NickCloudAT)
1313
- Added support for "toggle_zoom" binds to trigger the radio commands menu (by @TW1STaL1CKY)
1414
- Added option to use right click to enable/disable roles in the role layering menu (by @TimGoll)
15+
- Added option to enable team name next to role name on the HUD (by @milkwxter)
1516

1617
### Fixed
1718

gamemodes/terrortown/gamemode/shared/hud_elements/tttinfopanel/pure_skin_playerinfo.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ if CLIENT then
6363
end,
6464
}
6565

66+
savingKeys.showTeamName = {
67+
typ = "bool",
68+
desc = "label_hud_show_team_name",
69+
default = false,
70+
OnChange = function(slf, bool)
71+
slf:PerformLayout()
72+
slf:SaveData()
73+
end,
74+
}
75+
6676
return table.Copy(savingKeys)
6777
end
6878

@@ -195,7 +205,11 @@ if CLIENT then
195205
local round_state = gameloop.GetRoundState()
196206

197207
if cactive then
198-
text = L[rd.name]
208+
if self.showTeamName then
209+
text = L[rd.name] .. " (" .. L[client:GetTeam()] .. ")"
210+
else
211+
text = L[rd.name]
212+
end
199213
else
200214
if IsValid(tgt) and tgt:IsPlayer() then
201215
text = tgt:Nick()

lua/terrortown/lang/en.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,6 +2403,7 @@ L.searchbar_roles_placeholder = "Search roles..."
24032403
L.label_menu_search_no_items = "No items matched your search."
24042404

24052405
L.submenu_roles_overview_title = "Roles Overview (READ ME)"
2406+
24062407
-- Is there a way to ahve some sort of external file that's possibly-localized?
24072408
L.roles_overview_html = [[
24082409
<h1>Overview</h1>
@@ -2691,3 +2692,6 @@ considered. (This is relevant in the presence of forced subroles.)</p>
26912692

26922693
-- 2025-01-19
26932694
L.help_rolelayering_enable = "The red and green border around the icon shows if the role is currently enabled. Right click on an icon to quickly enable/disable that role."
2695+
2696+
-- 2025-01-20
2697+
L.label_hud_show_team_name = "Enable showing team name next to role name"

0 commit comments

Comments
 (0)