From f0f998217e93209711e73f6693353f2963382880 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Tue, 10 Oct 2023 00:36:22 -0400 Subject: [PATCH] Obey weapon firemode, reload press tweak --- gamemodes/benny/entities/weapons/benny.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gamemodes/benny/entities/weapons/benny.lua b/gamemodes/benny/entities/weapons/benny.lua index 5e1cfd3..67b53af 100644 --- a/gamemodes/benny/entities/weapons/benny.lua +++ b/gamemodes/benny/entities/weapons/benny.lua @@ -27,6 +27,8 @@ function SWEP:SetupDataTables() self:NetworkVar( "String", 1, "Wep2" ) self:NetworkVar( "Int", 0, "Wep1Clip" ) self:NetworkVar( "Int", 1, "Wep2Clip" ) + self:NetworkVar( "Int", 2, "Wep1Burst" ) + self:NetworkVar( "Int", 3, "Wep2Burst" ) end function SWEP:PrimaryAttack() @@ -39,6 +41,9 @@ function SWEP:PrimaryAttack() if self:GetDelay1() > CurTime() then return end + if self:GetWep1Burst() >= self:B_Firemode( false ).Mode then + return + end if self:Clip1() == 0 then B_Sound( self, self:BClass( false ).Sound_DryFire ) self:SetDelay1( CurTime() + 0.2 ) @@ -77,6 +82,7 @@ function SWEP:PrimaryAttack() end self:SetDelay1( CurTime() + self:BClass( false ).Delay ) + self:SetWep1Burst( self:GetWep1Burst() + 1 ) return true end @@ -125,14 +131,13 @@ function SWEP:SecondaryAttack() end function SWEP:Reload() - if self:BTable( false ) then + if self:BTable( false ) and self:GetOwner():KeyPressed( IN_RELOAD ) then if self:BClass().Reload then if self:BClass( false ).Reload( self, false ) then return end end if self:GetDelay1() > CurTime() then return false end - self:SetDelay1( CurTime() + 0.2 ) if self:GetWep1Clip() != 0 then B_Sound( self, self:BClass().Sound_MagOut ) @@ -159,6 +164,10 @@ function SWEP:Think() self:SetAim( math.Approach( self:GetAim(), p:KeyDown(IN_ATTACK2) and 1 or 0, FrameTime()/0.05 ) ) + if !p:KeyDown( IN_ATTACK ) then + self:SetWep1Burst( 0 ) + end + local ht = "normal" if self:GetAim() > 0 then ht = "revolver"