Skip to content

Commit

Permalink
Settings: Cleaned up voice settings (#1494)
Browse files Browse the repository at this point in the history
Nothing major, I mostly added some documentation and moved some settings
around.
  • Loading branch information
TimGoll authored Mar 31, 2024
1 parent 11de20d commit 9cf038e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
8 changes: 4 additions & 4 deletions gamemodes/terrortown/gamemode/client/cl_voice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ g_VoicePanelList = nil
---
-- @realm client
-- stylua: ignore
local duck_spectator = CreateConVar("ttt2_voice_duck_spectator", "0", {FCVAR_ARCHIVE})
local cvDuckSpectator = CreateConVar("ttt2_voice_duck_spectator", "0", {FCVAR_ARCHIVE})

---
-- @realm client
-- stylua: ignore
local duck_spectator_amount = CreateConVar("ttt2_voice_duck_spectator_amount", "0", {FCVAR_ARCHIVE})
local cvDuckSpectatorAmount = CreateConVar("ttt2_voice_cvDuckSpectator_amount", "0", {FCVAR_ARCHIVE})

---
-- @realm client
Expand Down Expand Up @@ -580,8 +580,8 @@ function VOICE.UpdatePlayerVoiceVolume(ply)
end

local vol = VOICE.GetPreferredPlayerVoiceVolume(ply)
if duck_spectator:GetBool() and ply:IsSpec() then
vol = vol * (1 - duck_spectator_amount:GetFloat())
if cvDuckSpectator:GetBool() and ply:IsSpec() then
vol = vol * (1 - cvDuckSpectatorAmount:GetFloat())
end
local out_vol = vol

Expand Down
3 changes: 3 additions & 0 deletions lua/terrortown/lang/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2213,3 +2213,6 @@ L.label_level_sound_message = "Message sound level multiplier"
-- 2024-03-07
L.label_crosshair_static_gap_length = "Enable static crosshair gap length"
L.label_crosshair_size_gap = "Crosshair gap size multiplier"

-- 2024-03-31
L.help_voice_duck_spectator = "Ducking spectators makes other spectators quieter in comparison to living players. This can be useful if one wants to listen closely to the discussions of the living players."
27 changes: 17 additions & 10 deletions lua/terrortown/menus/gamemode/gameplay/sounds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@ CLGAMEMODESUBMENU.title = "submenu_gameplay_sounds_title"
CLGAMEMODESUBMENU.icon = Material("vgui/ttt/vskin/helpscreen/sounds")

function CLGAMEMODESUBMENU:Populate(parent)
local form = vgui.CreateTTT2Form(parent, "header_sounds_settings")
local form = vgui.CreateTTT2Form(parent, "header_soundeffect_settings")

form:MakeHelp({
form:MakeCheckBox({
label = "label_inferface_scues_enable",
convar = "ttt_cl_soundcues",
})

local form2 = vgui.CreateTTT2Form(parent, "header_sounds_settings")

form2:MakeHelp({
label = "help_enable_sound_interact",
})

local enbSoundInteract = form:MakeCheckBox({
local enbSoundInteract = form2:MakeCheckBox({
label = "label_enable_sound_interact",
convar = "ttt2_enable_sound_interact",
})

form:MakeSlider({
form2:MakeSlider({
label = "label_level_sound_interact",
convar = "ttt2_level_sound_interact",
min = 0,
Expand All @@ -27,16 +34,16 @@ function CLGAMEMODESUBMENU:Populate(parent)
master = enbSoundInteract,
})

form:MakeHelp({
form2:MakeHelp({
label = "help_enable_sound_buttons",
})

local enbSoundButtons = form:MakeCheckBox({
local enbSoundButtons = form2:MakeCheckBox({
label = "label_enable_sound_buttons",
convar = "ttt2_enable_sound_buttons",
})

form:MakeSlider({
form2:MakeSlider({
label = "label_level_sound_buttons",
convar = "ttt2_level_sound_buttons",
min = 0,
Expand All @@ -45,16 +52,16 @@ function CLGAMEMODESUBMENU:Populate(parent)
master = enbSoundButtons,
})

form:MakeHelp({
form2:MakeHelp({
label = "help_enable_sound_message",
})

local enbSoundMessage = form:MakeCheckBox({
local enbSoundMessage = form2:MakeCheckBox({
label = "label_enable_sound_message",
convar = "ttt2_enable_sound_message",
})

form:MakeSlider({
form2:MakeSlider({
label = "label_level_sound_message",
convar = "ttt2_level_sound_message",
min = 0,
Expand Down
19 changes: 8 additions & 11 deletions lua/terrortown/menus/gamemode/gameplay/voiceandvolume.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@ CLGAMEMODESUBMENU.title = "submenu_gameplay_voiceandvolume_title"
CLGAMEMODESUBMENU.icon = Material("vgui/ttt/vskin/helpscreen/voiceandvolume")

function CLGAMEMODESUBMENU:Populate(parent)
local form = vgui.CreateTTT2Form(parent, "header_soundeffect_settings")
local form = vgui.CreateTTT2Form(parent, "header_voiceandvolume_settings")

form:MakeCheckBox({
label = "label_inferface_scues_enable",
convar = "ttt_cl_soundcues",
})

local form2 = vgui.CreateTTT2Form(parent, "header_voiceandvolume_settings")

form2:MakeCheckBox({
label = "label_gameplay_mute",
convar = "ttt_mute_team_check",
})

form2:MakeComboBox({
form:MakeComboBox({
label = "label_voice_scaling",
convar = "ttt2_voice_scaling",
choices = VOICE.GetScalingFunctions(),
Expand All @@ -32,12 +25,16 @@ function CLGAMEMODESUBMENU:Populate(parent)
end,
})

local enbSpecDuck = form2:MakeCheckBox({
form:MakeHelp({
label = "help_voice_duck_spectator",
})

local enbSpecDuck = form:MakeCheckBox({
label = "label_voice_duck_spectator",
convar = "ttt2_voice_duck_spectator",
})

form2:MakeSlider({
form:MakeSlider({
label = "label_voice_duck_spectator_amount",
convar = "ttt2_voice_duck_spectator_amount",
min = 0,
Expand Down

0 comments on commit 9cf038e

Please sign in to comment.