Skip to content

Commit

Permalink
Client: ScorePanel: Allow self-unmute (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Dec 3, 2023
1 parent 18b0817 commit 050da46
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/game/client/vgui/score_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,8 +915,9 @@ void CScorePanel::OpenPlayerMenu(int itemID)
}

// Player muting
bool isMuted = GetClientVoiceMgr()->IsPlayerBlocked(m_MenuData.nClient);
bool thisPlayer = kv->GetBool("thisplayer", 0);
if (thisPlayer)
if (thisPlayer && !isMuted)
{
// Can't mute yourself
m_pPlayerMenu->UpdateMenuItem(m_MenuData.nMuteItemID, "#BHL_Scores_MenuMute", new KeyValues("Command", "command", "MenuMute"));
Expand All @@ -925,7 +926,7 @@ void CScorePanel::OpenPlayerMenu(int itemID)
else
{
m_pPlayerMenu->SetItemEnabled(m_MenuData.nMuteItemID, true);
if (GetClientVoiceMgr()->IsPlayerBlocked(m_MenuData.nClient))
if (isMuted)
{
m_pPlayerMenu->UpdateMenuItem(m_MenuData.nMuteItemID, "#BHL_Scores_MenuUnmute", new KeyValues("Command", "command", "MenuMute"));
}
Expand All @@ -949,9 +950,6 @@ void CScorePanel::OnPlayerMenuCommand(MenuAction command)
{
case MenuAction::Mute:
{
if (pi->IsThisPlayer())
return;

if (GetClientVoiceMgr()->IsPlayerBlocked(pi->GetIndex()))
{
// Unmute
Expand All @@ -961,7 +959,7 @@ void CScorePanel::OnPlayerMenuCommand(MenuAction command)
snprintf(string1, sizeof(string1), CHudTextMessage::BufferedLocaliseTextString("#Unmuted"), pi->GetDisplayName(true));
CHudChat::Get()->ChatPrintf(0, "** %s", string1);
}
else
else if (!pi->IsThisPlayer())
{
// Mute
GetClientVoiceMgr()->SetPlayerBlockedState(pi->GetIndex(), true);
Expand Down

0 comments on commit 050da46

Please sign in to comment.