diff --git a/gamemodes/benny/entities/weapons/benny/sh_inv.lua b/gamemodes/benny/entities/weapons/benny/sh_inv.lua index e140c18..b67ef56 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_inv.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_inv.lua @@ -54,7 +54,19 @@ function SWEP:D_SetClip( hand, value ) end function SWEP:C_DualCheck() - return self:BTable( true )--self:BTable( false ) and self:BTable( true ) and self:BClass( false ).Features == "firearm" and self:BClass( true ).Features == "firearm" + local p = self:GetOwner() + local lt = self:BTable( true ) + if lt then + if lt.Features == "firearm" then + return p:GetInfoNum( "benny_wep_ao_firearms", 1 )==1 + elseif lt.Features == "grenade" then + return p:GetInfoNum( "benny_wep_ao_grenades", 0 )==1 + else + return p:GetInfoNum( "benny_wep_ao_junk", 0 )==1 + end + else + return false + end end function SWEP:C_AttackDown( hand ) diff --git a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua index e422b86..3e94f03 100644 --- a/gamemodes/benny/gamemode/modules/commons/sh_convars.lua +++ b/gamemodes/benny/gamemode/modules/commons/sh_convars.lua @@ -48,6 +48,9 @@ CONVARS_CL["hud_enable_active"] = { 1, nil, nil, false, true, "Draw Active CONVARS_CL["hud_enable_hints"] = { 1, nil, nil, false, true, "Draw Hints panel" } CONVARS_CL["wep_toggleaim"] = { 1, 0, 1, true, true, "Hold or toggle to aim weapon." } +CONVARS_CL["wep_ao_firearms"] = { 1, 0, 1, true, true, "Whether offhand firearms overrides primary attack." } +CONVARS_CL["wep_ao_grenades"] = { 0, 0, 1, true, true, "Whether offhand grenades overrides primary attack." } +CONVARS_CL["wep_ao_junk"] = { 0, 0, 1, true, true, "Whether offhand junk overrides primary attack." } CONVARS_CL["wep_toolgun"] = { "", nil, nil, true, true, "Toolgun tool." } diff --git a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua b/gamemodes/benny/gamemode/modules/gui/cl_settings.lua index 8a93779..cf82fe5 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_settings.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_settings.lua @@ -4,14 +4,53 @@ -- 0 = checkbox, 1 = slider, 2 = string local conf = { [1] = { - { "benny_hud_enable_health", "Health", 0 }, - { "benny_hud_enable_active", "Active Weapon", 0 }, - { "benny_hud_enable_hints", "Hints", 0 }, - { "benny_hud_enable_hotbar", "Hotbar", 0 }, - { "benny_hud_scale", "Scale", 1, 1, 4, 0 }, + { 0, "benny_hud_enable_health", "Health", }, + { 0, "benny_hud_enable_active", "Active Weapon", }, + { 0, "benny_hud_enable_hints", "Hints", }, + { 0, "benny_hud_enable_hotbar", "Hotbar", }, + { 1, "benny_hud_scale", "Scale", 1, 4, 0 }, + }, + [2] = { + { 0, "benny_wep_ao_firearms", "Firearms Override Primary Attack" }, + { 2, "Pressing Left Mouse will shoot an offhand firearm." }, + { 0, "benny_wep_ao_grenades", "Grenades Override Primary Attack" }, + { 2, "Pressing Left Mouse will throw an offhand grenade." }, + { 0, "benny_wep_ao_junk", "Junk Override Primary Attack" }, + { 2, "Pressing Left Mouse will throw offhand junk." }, }, } +local function genpan( Base, Sect, Num ) + local Scroll = Base:Add("DPanel") + Scroll:DockPadding( 10, 5, 10, 5 ) + Scroll.Paint = function() end + Sect:SetContents( Scroll ) + + for i, v in ipairs( conf[Num] ) do + if v[1] == 0 then + local Butt = Scroll:Add("DCheckBoxLabel") + Butt:Dock(TOP) + Butt:DockMargin( 0, 2, 0, 2 ) + Butt:SetText( v[3] ) + Butt:SetConVar( v[2] ) + elseif v[1] == 1 then + local Butt = Scroll:Add("DNumSlider") + Butt:Dock(TOP) + Butt:DockMargin( 0, 2, 0, 2 ) + Butt:SetText( v[3] ) + Butt:SetConVar( v[2] ) + Butt:SetMin( v[4] ) + Butt:SetMax( v[5] ) + Butt:SetDecimals( v[6] ) + elseif v[1] == 2 then + local Butt = Scroll:Add("DLabel") + Butt:Dock(TOP) + Butt:DockMargin( 40, -5, 0, 0 ) + Butt:SetText( v[2] ) + end + end +end + function OpenSettingsMenu() local Base = vgui.Create("DFrame") Base:SetTitle("Settings") @@ -24,35 +63,15 @@ function OpenSettingsMenu() Sect:Dock(TOP) Sect:SetLabel("Preferences") - local Scroll = Base:Add("DPanel") - Scroll:DockPadding( 10, 5, 10, 5 ) - Scroll.Paint = function() end - Sect:SetContents( Scroll ) - - for i, v in ipairs( conf[1] ) do - if v[3] == 0 then - local Butt = Scroll:Add("DCheckBoxLabel") - Butt:Dock(TOP) - Butt:DockMargin( 0, 2, 0, 2 ) - Butt:SetText( v[2] ) - Butt:SetConVar( v[1] ) - elseif v[3] == 1 then - local Butt = Scroll:Add("DNumSlider") - Butt:Dock(TOP) - Butt:DockMargin( 0, 2, 0, 2 ) - Butt:SetText( v[2] ) - Butt:SetConVar( v[1] ) - Butt:SetMin( v[4] ) - Butt:SetMax( v[5] ) - Butt:SetDecimals( v[6] ) - end - end + genpan( Base, Sect, 1 ) end do -- Sect 2 local Sect = Base:Add("DCollapsibleCategory") Sect:Dock(TOP) Sect:SetLabel("Controls") + + genpan( Base, Sect, 2 ) end do -- Sect 3