From cece2b0e363c364b393df4f9a4c1912c602ae217 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Fri, 8 Dec 2023 00:28:34 -0500 Subject: [PATCH] Fixes for deagle left hand grenade right hand --- .../benny/entities/weapons/benny/sh_firing.lua | 2 +- gamemodes/benny/entities/weapons/benny/shared.lua | 14 +++++++++----- gamemodes/benny/gamemode/modules/player/cl_hud.lua | 9 +++++---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gamemodes/benny/entities/weapons/benny/sh_firing.lua b/gamemodes/benny/entities/weapons/benny/sh_firing.lua index 2344295..7f99a46 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_firing.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_firing.lua @@ -59,7 +59,7 @@ function SWEP:BFire( hand ) if CLIENT and IsFirstTimePredicted() then - if IsValid(self.CWM) then + if IsValid(self.CWM) and self.CWM:GetAttachment( 1 ) then local vStart = self.CWM:GetAttachment( 1 ).Pos --local vPoint = p:GetEyeTrace().HitPos --local effectdata = EffectData() diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index 0a69ba0..13f0f29 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -211,11 +211,15 @@ function SWEP:Think() self:SetWep2_Burst( 0 ) end - if wep1 and self:D_GetDelay( false ) < CurTime()-0.01 then - local mweh = math.Remap( CurTime(), self:D_GetShotTime( false ), self:D_GetShotTime( false )+wep1c.SpreadDecay_RampTime, 0, 1 ) - mweh = math.Clamp( mweh, 0, 1 ) - local decayfinal = Lerp( math.ease.InExpo( mweh ), wep1c.SpreadDecay_Start, wep1c.SpreadDecay_End ) - self:D_SetSpread( false, math.Approach( self:D_GetSpread( false ), 0, decayfinal * FrameTime() ) ) + for i=1, 2 do + local hand = i==2 + local wep, wepc = self:BTable( hand ), self:BClass( hand ) + if wepc and wepc.Features == "firearm" and self:D_GetDelay( hand ) < CurTime()-0.01 then + local mweh = math.Remap( CurTime(), self:D_GetShotTime( hand ), self:D_GetShotTime( hand )+wepc.SpreadDecay_RampTime, 0, 1 ) + mweh = math.Clamp( mweh, 0, 1 ) + local decayfinal = Lerp( math.ease.InExpo( mweh ), wepc.SpreadDecay_Start, wepc.SpreadDecay_End ) + self:D_SetSpread( hand, math.Approach( self:D_GetSpread( hand ), 0, decayfinal * FrameTime() ) ) + end end local ht = "normal" diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 64b0ad8..dc3ec76 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -535,11 +535,12 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() end end - if wep:GetUserAim() and wep:BClass( false ) then -- Crosshair + local meow = wep:C_DualCheck() + if wep:GetUserAim() and wep:BClass( meow ) and wep:BClass( meow ).Spread then -- Crosshair local s, w, h = ss, ScrW(), ScrH() local pl_x, pl_y = w/2, h/2 - local dispersion = math.rad( wep:BSpread( false ) ) + local dispersion = math.rad( wep:BSpread( meow ) ) cam.Start3D() local lool = ( EyePos() + ( EyeAngles():Forward()*8192 ) + ( dispersion * EyeAngles():Up()*8192 ) ) :ToScreen() cam.End3D() @@ -592,7 +593,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local mat1 = i == 1 and mat_long_s or mat_long local mat2 = i == 1 and mat_dot_s or mat_dot surface.SetDrawColor( cooler ) - if wep:BClass( false ).Type == "rifle" then + if wep:BClass( meow ).Type == "rifle" then surface.SetMaterial( mat1 ) surface.DrawTexturedRectRotated( poosx - s(spacer_long) - gap, poosy, s(32), s(32), 0 ) surface.DrawTexturedRectRotated( poosx + s(spacer_long) + gap, poosy, s(32), s(32), 0 ) @@ -600,7 +601,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() surface.SetMaterial( mat2 ) surface.DrawTexturedRectRotated( poosx, poosy - gap - s(spacer), s(32), s(32), 0 ) surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer), s(32), s(32), 0 ) - elseif wep:BClass( false ).Type == "smg" then + elseif wep:BClass( meow ).Type == "smg" then surface.SetMaterial( mat1 ) surface.DrawTexturedRectRotated( poosx, poosy + gap + s(spacer_long), s(32), s(32), 90 ) surface.DrawTexturedRectRotated( poosx - (math.sin(math.rad(45))*gap) - (math.sin(math.rad(45))*s(spacer_long)), poosy - (math.sin(math.rad(45))*gap) - (math.sin(math.rad(45))*s(spacer_long)), s(32), s(32), -45 )