Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to select taunt voice gender #305

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gamemode/gametypes/base/cl_localisation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ LOCALISATION["english"] = {
["GM_WEAPONDROP_DESC"] = "Change what players drop on death",
["GM_CHANGELVLDELAY"] = "Level change delay",
["GM_CHANGELVLDELAY_DESC"] = "The amount in seconds to wait before changing to the next map",
["GM_VOICEGENDER"] = "Voice gender",
["GM_VOICEGENDER_DESC"] = "Set the gender of your character's voice",
["GM_COCKROACHES"] = "Cockroach amount",
["GM_COCKROACHES_DESC"] = "The maximum amount of cockroaches that can be spawned. 0 to disable them",
["GM_ABH"] = "Accelerated backhopping",
Expand Down
1 change: 1 addition & 0 deletions gamemode/gametypes/gametype_base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ function GAMETYPE:InitSettings()
Max = 100,
}
})

end

function GAMETYPE:GetScoreboardInfo()
Expand Down
53 changes: 52 additions & 1 deletion gamemode/huds/hud_lambda_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,57 @@ function PANEL:Init()

sheetPanel:AddSheet("MODEL", mdlPanel)

local voicePanel = sheetPanel:Add("DPanel")

local voiceLabel = voicePanel:Add("DLabel")
voiceLabel:Dock(TOP)
voiceLabel:SetText("Voice Group")
voiceLabel:SetTextColor(Color(255, 255, 255, 255))
voiceLabel:SetFont("TargetIDSmall")
voiceLabel:SizeToContents()
voiceLabel:DockMargin(0, 5, 0, 5)

local voiceCombo = voicePanel:Add("DComboBox")
voiceCombo:Dock(TOP)

local categories = GAMEMODE:GetAvailableTauntCategories()
for _, category in ipairs(categories) do
local displayName = category == "auto" and "Auto" or (string.upper(category:sub(1,1)) .. category:sub(2))
voiceCombo:AddChoice(displayName, category)
end

voiceCombo:SetTextColor(Color(255, 255, 255, 255))
voiceCombo:SetSortItems(false)

local lastKnownVoiceGroup = ""

local function UpdateVoiceCombo()
local currentVoiceGroup = GetConVar("lambda_voice_group"):GetString()
if currentVoiceGroup ~= lastKnownVoiceGroup then
for id, data in ipairs(voiceCombo.Data) do
if data == currentVoiceGroup then
voiceCombo:ChooseOptionID(id)
lastKnownVoiceGroup = currentVoiceGroup
break
end
end
end
end

voiceCombo.OnSelect = function(_, _, _, data)
RunConsoleCommand("lambda_voice_group", data)
lastKnownVoiceGroup = data
end

UpdateVoiceCombo()

-- Update only when the panel becomes visible
self.OnVisible = function()
UpdateVoiceCombo()
end

sheetPanel:AddSheet("VOICE", voicePanel)

local bgPanel = sheetPanel:Add("DPanel")

local bgList = bgPanel:Add("DPanelList")
Expand Down Expand Up @@ -185,4 +236,4 @@ function PANEL:Init()
end
end

vgui.Register("LambdaPlayerPanel", PANEL, "DPanel")
vgui.Register("LambdaPlayerPanel", PANEL, "DPanel")
16 changes: 4 additions & 12 deletions gamemode/sh_convars.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
if SERVER then
AddCSLuaFile()
end

if SERVER then AddCSLuaFile() end
GM.ConVars = {}

function GM:RegisterConVar(name, value, flags, helptext, fn)
if CLIENT and bit.band(flags, FCVAR_REPLICATED) ~= 0 and bit.band(flags, FCVAR_ARCHIVE) ~= 0 then
DbgPrint("Removing FCVAR_ARCHIVE from " .. name)
Expand All @@ -13,7 +9,6 @@ function GM:RegisterConVar(name, value, flags, helptext, fn)
local prefix = "lambda_"
local actualName = prefix .. name
local actualValue = ""

if isbool(value) then
actualValue = tostring(tonumber(value))
elseif isstring(value) then
Expand All @@ -24,11 +19,7 @@ function GM:RegisterConVar(name, value, flags, helptext, fn)

local convar = CreateConVar(actualName, actualValue, flags, helptext)
self.ConVars[name] = convar

if fn ~= nil and isfunction(fn) then
cvars.AddChangeCallback(actualName, fn)
end

if fn ~= nil and isfunction(fn) then cvars.AddChangeCallback(actualName, fn) end
return convar
end

Expand Down Expand Up @@ -58,6 +49,7 @@ if CLIENT then
lambda_auto_jump = GM:RegisterConVar("auto_jump", "0", bit.bor(0, FCVAR_ARCHIVE), "Automatically jump if on ground")
lambda_gore = GM:RegisterConVar("gore", "1", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Enable gore")
lambda_language = GM:RegisterConVar("language", "english", bit.bor(0, FCVAR_ARCHIVE), "Gamemode language")
lambda_voice_group = GM:RegisterConVar("voice_group", "auto", bit.bor(0, FCVAR_ARCHIVE, FCVAR_USERINFO), "Voice group")
end

-- Server --
Expand All @@ -66,4 +58,4 @@ lambda_instance_id = GM:RegisterConVar("instance_id", 1, bit.bor(0, FCVAR_ARCHIV
-- Deathmatch specific convars
lambda_dm_fraglimit = GM:RegisterConVar("dm_fraglimit", 50, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "When frags are reached the round ends")
lambda_dm_timelimit = GM:RegisterConVar("dm_timelimit", 10, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "When time runs out the round ends(min)")
lambda_dm_teamonly = GM:RegisterConVar("dm_teamonly", 0, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "Team based deathmatch")
lambda_dm_teamonly = GM:RegisterConVar("dm_teamonly", 0, bit.bor(0, FCVAR_ARCHIVE, FCVAR_NOTIFY, FCVAR_REPLICATED), "Team based deathmatch")
25 changes: 21 additions & 4 deletions gamemode/sh_entity_extend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ local function EstimateModelCategory(ent)
local seq
seq = ent:LookupSequence("d3_c17_07_Kidnap")
if seq ~= nil and seq > 0 then return "combine" end
if mdl:lower():find("monk.mdl", 1, true) then return "monk" end
if mdl:lower():find("barney.mdl", 1, true) then return "barney" end
if mdl:lower():find("alyx.mdl", 1, true) then return "alyx" end
if mdl:lower():find("female", 1, true) or ent:LookupBone("ValveBiped.Bip01_R_Pectoral") or ent:LookupBone("ValveBiped.Bip01_L_Pectoral") then return "female" end

local mdlLower = mdl:lower()

if mdlLower:find("monk.mdl", 1, true) then return "monk" end
if mdlLower:find("barney.mdl", 1, true) then return "barney" end
if mdlLower:find("alyx.mdl", 1, true) then return "alyx" end
if mdlLower:find("gman", 1, true) then return "gman" end
if mdlLower:find("kleiner", 1, true) then return "kleiner" end
if mdlLower:find("magnusson", 1, true) then return "magnusson" end
if mdlLower:find("mossman", 1, true) then return "mossman" end
if mdlLower:find("odessa", 1, true) then return "odessa" end
if mdlLower:find("breen", 1, true) then return "breen" end
if mdlLower:find("eli", 1, true) then return "eli" end
if mdlLower:find("female", 1, true) or ent:LookupBone("ValveBiped.Bip01_R_Pectoral") or ent:LookupBone("ValveBiped.Bip01_L_Pectoral") then return "female" end

return "male"
end
Expand All @@ -39,6 +49,13 @@ function ENTITY_META:GetActivator()
end

function ENTITY_META:GetModelCategory()
if self:IsPlayer() then
local voiceGroup = self:GetInfo("lambda_voice_group", "auto")
if voiceGroup ~= "auto" then
return voiceGroup
end
end

local oldCache = false
local mdl = self:GetModel()

Expand Down
Loading