From bc55cdbd30c3f8f4908df7d35b856ab07618e871 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Wed, 29 Nov 2023 18:09:31 -0500 Subject: [PATCH] AttackDown --- gamemodes/benny/entities/weapons/benny/sh_inv.lua | 5 +++++ gamemodes/benny/entities/weapons/benny/shared.lua | 4 +++- gamemodes/benny/gamemode/modules/player/cl_hud.lua | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gamemodes/benny/entities/weapons/benny/sh_inv.lua b/gamemodes/benny/entities/weapons/benny/sh_inv.lua index 27e8953..dbdcab7 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_inv.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_inv.lua @@ -57,6 +57,11 @@ 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" end +function SWEP:C_AttackDown( hand ) + if self:C_DualCheck() then hand = !hand end + return (hand == true) and self:GetOwner():KeyDown( IN_ATTACK2 ) or (hand == false) and self:GetOwner():KeyDown( IN_ATTACK ) +end + function SWEP:BDeploy( hand, id ) assert( isbool(hand), "You forgot the hand." ) assert( isstring(id), "You forgot the ID." ) diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index 67fdc5d..a078501 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -195,8 +195,10 @@ function SWEP:Think() self:SetAim( math.Approach( self:GetAim(), self:GetUserAim() and 1 or 0, FrameTime()/0.2 ) ) - if !p:KeyDown( IN_ATTACK ) then + if !self:C_AttackDown( false ) then self:SetWep1_Burst( 0 ) + end + if !self:C_AttackDown( true ) then self:SetWep2_Burst( 0 ) end diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 5c69bfb..be97209 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -452,7 +452,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local identicallist = p:INV_Find( wep:BTable( hand ).Class ) identicallist = table.Flip( identicallist ) local numba = identicallist[ wep:D_GetID( hand ) ] - draw.SimpleText( "(" .. tostring(numba) .. ") - " .. wep:D_GetID( hand ), "Benny_10", p_x+p_w-pb2, p_y+ss(7), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) + draw.SimpleText( "#" .. tostring(numba) .. ", " .. wep:D_GetID( hand ), "Benny_10", p_x+p_w-pb2, p_y+ss(7), scheme["bg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) if wep_class.Firemodes then -- Firemode surface.SetDrawColor( scheme["fg"] )