Skip to content

Commit

Permalink
HUD: Added Team name next to Role name (#1726)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
milkwxter and TimGoll authored Jan 21, 2025
1 parent cb34ac0 commit 516bf08
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Added `GM:TTT2PlayDeathScream` hook to cancel or overwrite/change the deathscream sound that plays, when you die (by @NickCloudAT)
- Added support for "toggle_zoom" binds to trigger the radio commands menu (by @TW1STaL1CKY)
- Added option to use right click to enable/disable roles in the role layering menu (by @TimGoll)
- Added option to enable team name next to role name on the HUD (by @milkwxter)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ if CLIENT then
end,
}

savingKeys.showTeamName = {
typ = "bool",
desc = "label_hud_show_team_name",
default = false,
OnChange = function(slf, bool)
slf:PerformLayout()
slf:SaveData()
end,
}

return table.Copy(savingKeys)
end

Expand Down Expand Up @@ -195,7 +205,11 @@ if CLIENT then
local round_state = gameloop.GetRoundState()

if cactive then
text = L[rd.name]
if self.showTeamName then
text = L[rd.name] .. " (" .. L[client:GetTeam()] .. ")"
else
text = L[rd.name]
end
else
if IsValid(tgt) and tgt:IsPlayer() then
text = tgt:Nick()
Expand Down
4 changes: 4 additions & 0 deletions lua/terrortown/lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2403,6 +2403,7 @@ L.searchbar_roles_placeholder = "Search roles..."
L.label_menu_search_no_items = "No items matched your search."

L.submenu_roles_overview_title = "Roles Overview (READ ME)"

-- Is there a way to ahve some sort of external file that's possibly-localized?
L.roles_overview_html = [[
<h1>Overview</h1>
Expand Down Expand Up @@ -2691,3 +2692,6 @@ considered. (This is relevant in the presence of forced subroles.)</p>

-- 2025-01-19
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."

-- 2025-01-20
L.label_hud_show_team_name = "Enable showing team name next to role name"

0 comments on commit 516bf08

Please sign in to comment.