From b973b4da70cce2d30da7a5054983f81d3270a858 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Wed, 3 Jan 2024 21:08:59 -0500 Subject: [PATCH] Rebind Reload1 and Reload2 --- .../benny/entities/weapons/benny/shared.lua | 4 ++-- .../gamemode/modules/commons/sh_convars.lua | 8 ++++++-- .../benny/gamemode/modules/gui/cl_settings.lua | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index 44ded7c..124b945 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -107,11 +107,11 @@ hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_TempForAim", function( ply end end - if button == KEY_R then + if button == ply:GetInfoNum("benny_bind_reload", KEY_R) then wep:Reload( wep:hFlipHand( false ) ) end - if button == KEY_T then + if button == ply:GetInfoNum("benny_bind_reloada", KEY_T) then wep:Reload( wep:hFlipHand( true ) ) end end diff --git a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua index ea7f052..5a43509 100644 --- a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua +++ b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua @@ -58,8 +58,12 @@ CONVARS_CL["wep_ao_junk"] = { 0, 0, 1, true, true, "Whether offhand junk CONVARS_CL["wep_toolgun"] = { "", nil, nil, true, true, "Toolgun tool." } -CONVARS_CL["cam_override"] = { "", nil, nil, false, true, "Override camera" } -CONVARS_CL["cam_unlock"] = { 0, 0, 1, false, false, "Unlock camera" } +CONVARS_CL["cam_override"] = { "", nil, nil, false, true, "Override camera" } +CONVARS_CL["cam_unlock"] = { 0, 0, 1, false, false, "Unlock camera" } + + +CONVARS_CL["bind2_reload"] = { KEY_R, nil, nil, true, true, "Bind for Reload" } +CONVARS_CL["bind2_reloada"] = { KEY_T, nil, nil, true, true, "Bind for ReloadAlt" } CONVARS_CL_GEN = {} for i, v in pairs( CONVARS_CL ) do diff --git a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua b/gamemodes/benny/gamemode/modules/gui/cl_settings.lua index 89c6cdf..69ac379 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_settings.lua @@ -1,7 +1,7 @@ -- Settings panel --- 0 = checkbox, 1 = slider, 2 = string +-- 0 = checkbox, 1 = slider, 2 = string, 3 = binder local conf = { [1] = { { 0, "benny_hud_enable_health", "Health", }, @@ -17,6 +17,8 @@ local conf = { { 2, "Pressing Left Mouse will throw an offhand grenade." }, { 0, "benny_wep_ao_junk", "Junk Overrides Primary Attack" }, { 2, "Pressing Left Mouse will throw offhand junk." }, + { 3, "benny_bind_reload", "Reload" }, + { 3, "benny_bind_reloada", "Reload Alt" }, }, } @@ -47,6 +49,20 @@ local function genpan( Base, Sect, Conf ) Butt:Dock(TOP) Butt:DockMargin( 24, -5, 0, 0 ) Butt:SetText( v[2] ) + elseif v[1] == 3 then + local Butt = Scroll:Add("DLabel") + Butt:Dock(TOP) + Butt:DockMargin( 48+5, 0, 0, 0 ) + Butt:SetText( v[3] ) + + local Butt = Scroll:Add("DBinder") + Butt:Dock(TOP) + Butt:DockMargin( 48, 0, 48, 2 ) + Butt:SetText( v[2] ) + + function Butt:OnChange( num ) + RunConsoleCommand( v[2], num ) + end end end end