From fd5ebda7bee63ef947d3ae1f9d5e3a7c768d32cb Mon Sep 17 00:00:00 2001 From: Fesiug Date: Mon, 1 Jan 2024 16:12:35 -0500 Subject: [PATCH] Touch up weapon class code pt.1 --- .../entities/weapons/benny/sh_firing.lua | 26 +- .../benny/entities/weapons/benny/sh_inv.lua | 155 +- .../entities/weapons/benny/sh_reload.lua | 32 +- .../benny/entities/weapons/benny/sh_stat2.lua | 130 ++ .../benny/entities/weapons/benny/shared.lua | 78 +- .../gamemode/modules/gui/cl_debuginv.lua | 4 +- .../gamemode/modules/meta/sh_itemdef.lua | 44 + .../gamemode/modules/meta/sh_itemlive.lua | 5 + .../benny/gamemode/modules/player/cl_hud.lua | 34 +- .../gamemode/modules/player/sh_basic.lua | 12 +- .../benny/gamemode/modules/player/sh_hud.lua | 26 +- .../modules/player/sh_movement_advanced.lua | 4 +- .../gamemode/modules/player/sh_player.lua | 14 +- .../gamemode/modules/weapons/_sh_weapons.lua | 1552 ++++++++++++++++ ..._forlater.lua => _sh_weapons_forlater.lua} | 0 .../gamemode/modules/weapons/sh_weapons.lua | 1647 ++--------------- 16 files changed, 1987 insertions(+), 1776 deletions(-) create mode 100644 gamemodes/benny/entities/weapons/benny/sh_stat2.lua create mode 100644 gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua create mode 100644 gamemodes/benny/gamemode/modules/meta/sh_itemlive.lua create mode 100644 gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua rename gamemodes/benny/gamemode/modules/weapons/{sh_weapons_forlater.lua => _sh_weapons_forlater.lua} (100%) diff --git a/gamemodes/benny/entities/weapons/benny/sh_firing.lua b/gamemodes/benny/entities/weapons/benny/sh_firing.lua index 43c6ed1..f05359f 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_firing.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_firing.lua @@ -29,36 +29,36 @@ function SWEP:BFire( hand ) if wep_class.Custom_Fire then if wep_class.Custom_Fire( self, wep_table, wep_class, hand ) then return end end - if self:D_GetDelay( hand ) > CurTime() then + if self:bGetIntDelay( hand ) > CurTime() then return end - if self:D_GetHolstering( hand ) > 0 then + if self:bGetHolsterTime( hand ) > 0 then return end - if self:D_GetClip( hand ) == 0 then - if self:D_GetBurst( hand ) >= 1 then + if self:bGetIntClip( hand ) == 0 then + if self:bGetBurst( hand ) >= 1 then return end B_Sound( self, wep_class.Sound_DryFire ) - self:D_SetBurst( hand, self:D_GetBurst( hand ) + 1 ) + self:bSetBurst( hand, self:bGetBurst( hand ) + 1 ) return end - if self:D_GetBurst( hand ) >= self:B_Firemode( hand ).Mode then + if self:bGetBurst( hand ) >= self:B_Firemode( hand ).Mode then return end if !ConVarSV_Bool("cheat_infiniteammo") then - self:B_Ammo( hand, self:D_GetClip( hand ) - 1 ) + self:B_Ammo( hand, self:bGetIntClip( hand ) - 1 ) end B_Sound( self, wep_class.Sound_Fire ) self:TPFire( hand ) self:CallFire( hand ) - self:D_SetDelay( hand, CurTime() + wep_class.Delay ) - self:D_SetBurst( hand, self:D_GetBurst( hand ) + 1 ) - self:D_SetSpread( hand, math.Clamp( self:D_GetSpread( hand ) + wep_class.SpreadAdd, 0, wep_class.SpreadAddMax ) ) - self:D_SetShotTime( hand, CurTime() ) + self:bSetIntDelay( hand, CurTime() + wep_class.Delay ) + self:bSetBurst( hand, self:bGetBurst( hand ) + 1 ) + self:bSetSpread( hand, math.Clamp( self:bGetSpread( hand ) + wep_class.SpreadAdd, 0, wep_class.SpreadAddMax ) ) + self:bSetShotTime( hand, CurTime() ) if CLIENT and IsFirstTimePredicted() then @@ -80,7 +80,7 @@ function SWEP:CallFire( hand ) local p = self:GetOwner() local class = self:BClass( hand ) local spread = self:BSpread( hand ) - for i=1, class.Pellets or 1 do + for i=1, self:GetStat( hand, "Pellets" ) do local dir = self:GetOwner():EyeAngles() local radius = util.SharedRandom("benny_distance_"..tostring(hand), 0, 1, i ) @@ -98,7 +98,7 @@ function SWEP:CallFire( hand ) self:FireBullets( { Attacker = p, Damage = class.Damage, - Force = class.Damage/10, + Force = ( class.Damage / 10 ) * self:GetStat( hand, "Pellets" ), Src = p:EyePos(), Dir = dir:Forward(), Tracer = 0, diff --git a/gamemodes/benny/entities/weapons/benny/sh_inv.lua b/gamemodes/benny/entities/weapons/benny/sh_inv.lua index 00143f3..be2deef 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_inv.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_inv.lua @@ -1,131 +1,4 @@ --- Weapon ID -function SWEP:D_GetID( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2() or (hand == false) and self:GetWep1() -end - -function SWEP:D_SetID( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2( value ) or (hand == false) and self:SetWep1( value ) -end - --- Wep. Clip ID -function SWEP:D_GetMagID( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Clip() or (hand == false) and self:GetWep1_Clip() -end - -function SWEP:D_SetMagID( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Clip( value ) or (hand == false) and self:SetWep1_Clip( value ) -end - --- Weapon Firemode -function SWEP:D_GetFiremode( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Firemode() or (hand == false) and self:GetWep1_Firemode() -end - -function SWEP:D_SetFiremode( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Firemode( value ) or (hand == false) and self:SetWep1_Firemode( value ) -end - --- Weapon Burst -function SWEP:D_GetBurst( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Burst() or (hand == false) and self:GetWep1_Burst() -end - -function SWEP:D_SetBurst( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Burst( value ) or (hand == false) and self:SetWep1_Burst( value ) -end - --- Weapon Spread -function SWEP:D_GetSpread( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Spread() or (hand == false) and self:GetWep1_Spread() -end - -function SWEP:D_SetSpread( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Spread( value ) or (hand == false) and self:SetWep1_Spread( value ) -end - --- Weapon Spread -function SWEP:D_GetShotTime( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_ShotTime() or (hand == false) and self:GetWep1_ShotTime() -end - -function SWEP:D_SetShotTime( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_ShotTime( value ) or (hand == false) and self:SetWep1_ShotTime( value ) -end - --- Weapon Holstering Time -function SWEP:D_GetHolstering( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Holstering() or (hand == false) and self:GetWep1_Holstering() -end - -function SWEP:D_SetHolstering( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Holstering( value ) or (hand == false) and self:SetWep1_Holstering( value ) -end - --- Weapon Reloading Time -function SWEP:D_GetReloading( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_Reloading() or (hand == false) and self:GetWep1_Reloading() -end - -function SWEP:D_SetReloading( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_Reloading( value ) or (hand == false) and self:SetWep1_Reloading( value ) -end - --- Weapon Reload Type -function SWEP:D_GetReloadType( hand ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:GetWep2_ReloadType() or (hand == false) and self:GetWep1_ReloadType() -end - -function SWEP:D_SetReloadType( hand, value ) - assert( hand!=nil, "Missing hand argument" ) - return (hand == true) and self:SetWep2_ReloadType( value ) or (hand == false) and self:SetWep1_ReloadType( value ) -end - --- Weapon Player Requesting ID -function SWEP:D_GetReqID( hand ) - local p = self:GetOwner() - return (hand == true) and p:GetReqID2() or (hand == false) and p:GetReqID1() -end - -function SWEP:D_SetReqID( hand, value ) - local p = self:GetOwner() - return (hand == true) and p:SetReqID2( value ) or (hand == false) and p:SetReqID1( value ) -end - --- Internal SWEP Delay -function SWEP:D_GetDelay( hand ) - return (hand == true) and self:GetDelay2() or (hand == false) and self:GetDelay1() -end - -function SWEP:D_SetDelay( hand, value ) - return (hand == true) and self:SetDelay2( value ) or (hand == false) and self:SetDelay1( value ) -end - --- Internal SWEP Clip -function SWEP:D_GetClip( hand ) - return (hand == true) and self:Clip2() or (hand == false) and self:Clip1() -end - -function SWEP:D_SetClip( hand, value ) - return (hand == true) and self:SetClip2( value ) or (hand == false) and self:SetClip1( value ) -end local fallbackstat = { ["Reload_MagOut"] = 0.2, @@ -188,10 +61,10 @@ end function SWEP:BDeploy( hand, id ) assert( isbool(hand), "You forgot the hand." ) assert( isstring(id), "You forgot the ID." ) - if self:D_GetID( hand ) == id then + if self:bGetInvID( hand ) == id then -- This breaks prediction somewhat!! -- return -- PROTO: If you're in the middle of holstering, cancel it - elseif self:D_GetID( hand ) != "" then + elseif self:bGetInvID( hand ) != "" then return--self:BHolster( hand ) end local p = self:GetOwner() @@ -202,11 +75,11 @@ function SWEP:BDeploy( hand, id ) assert( item, "That item doesn't exist. " .. tostring(item) ) - self:D_SetID( hand, id ) - self:D_SetMagID( hand, "" ) - self:D_SetClip( hand, 0 ) - self:D_SetSpread( hand, 0 ) - self:D_SetDelay( hand, CurTime() + 0.35 ) + self:bSetInvID( hand, id ) + self:bSetMagInvID( hand, "" ) + self:bSetIntClip( hand, 0 ) + self:bSetSpread( hand, 0 ) + self:bSetIntDelay( hand, CurTime() + 0.35 ) B_Sound( self, "Common.Deploy" ) if item.Loaded and item.Loaded != "" then local mid = item.Loaded @@ -215,13 +88,13 @@ function SWEP:BDeploy( hand, id ) item.Loaded = "" error( "Deploy: Magazine doesn't exist in the inventory!! " .. tostring(mid) .. " item.Loaded removed." ) end - self:D_SetMagID( hand, mid ) - self:D_SetClip( hand, midi.Ammo ) + self:bSetMagInvID( hand, mid ) + self:bSetIntClip( hand, midi.Ammo ) end end function SWEP:BHolster( hand ) - if self:D_GetID( hand ) == "" then + if self:bGetInvID( hand ) == "" then return -- What the hell are you holstering..? end @@ -233,12 +106,12 @@ function SWEP:BHolster( hand ) if class.Custom_Holster then class.Custom_Holster( self, item, class, hand ) end end - self:D_SetID( hand, "" ) - self:D_SetMagID( hand, "" ) - self:D_SetClip( hand, 0 ) + self:bSetInvID( hand, "" ) + self:bSetMagInvID( hand, "" ) + self:bSetIntClip( hand, 0 ) end function SWEP:BSpread( hand ) - return self:BClass( hand ).Spread + self:D_GetSpread( hand ) + return self:BClass( hand ).Spread + self:bGetSpread( hand ) end diff --git a/gamemodes/benny/entities/weapons/benny/sh_reload.lua b/gamemodes/benny/entities/weapons/benny/sh_reload.lua index c6b0a66..dcd15ea 100644 --- a/gamemodes/benny/entities/weapons/benny/sh_reload.lua +++ b/gamemodes/benny/entities/weapons/benny/sh_reload.lua @@ -11,20 +11,20 @@ function SWEP:Reload( hand ) if wep_class.Custom_Reload then if wep_class.Custom_Reload( self, wep_table ) then return end end - if self:D_GetDelay( hand ) > CurTime() then + if self:bGetIntDelay( hand ) > CurTime() then return false end - local rt = self:D_GetReloading( hand ) + local rt = self:bGetReloadTime( hand ) if rt > 0 then - local rtt = self:D_GetReloadType( hand ) + local rtt = self:bGetReloadType( hand ) -- TODO: Unshitify this. if rtt == 1 then if (rt+self:GetStat( hand, "Reload_MagIn_Bonus1" )) <= RealTime() and RealTime() <= (rt+self:GetStat( hand, "Reload_MagIn_Bonus2" )) then - self:D_SetReloading( hand, 0 ) + self:bSetReloadTime( hand, 0 ) return true else B_Sound( self, "Common.ReloadFail" ) - self:D_SetReloading( hand, RealTime() ) + self:bSetReloadTime( hand, RealTime() ) return false end else @@ -32,15 +32,15 @@ function SWEP:Reload( hand ) end end - local curmag = self:D_GetMagID( hand ) + local curmag = self:bGetMagInvID( hand ) if curmag != "" then - self:D_SetReloading( hand, RealTime() ) - self:D_SetReloadType( hand, 2 ) + self:bSetReloadTime( hand, RealTime() ) + self:bSetReloadType( hand, 2 ) B_Sound( self, wep_class.Sound_MagOut ) - self:Reload_MagOut( hand, self:D_GetMagID( hand ), inv ) + self:Reload_MagOut( hand, self:bGetMagInvID( hand ), inv ) elseif self:GetBestLoadableMagazine( hand, wep_table.Class, inv, wep_table ) then - self:D_SetReloading( hand, RealTime() ) - self:D_SetReloadType( hand, 1 ) + self:bSetReloadTime( hand, RealTime() ) + self:bSetReloadType( hand, 1 ) B_Sound( self, wep_class.Sound_MagIn ) else B_Sound( self, "Common.NoAmmo" ) @@ -59,7 +59,7 @@ function SWEP:Reload_MagOut( hand, curmag, optinv, optwep_table, optwep_class ) if !inv[curmag] then -- PROTO: This happens sometimes. I'm commenting it so it doesn't look like anything broke, because it didn't. -- ErrorNoHalt( "Mag isn't a valid item" ) - self:D_SetMagID( hand, "" ) + self:bSetMagInvID( hand, "" ) wep_table.Loaded = "" elseif inv[curmag].Ammo == 0 then if SERVER or (CLIENT and IsFirstTimePredicted()) then @@ -67,8 +67,8 @@ function SWEP:Reload_MagOut( hand, curmag, optinv, optwep_table, optwep_class ) end end - self:D_SetMagID( hand, "" ) - self:D_SetClip( hand, 0 ) + self:bSetMagInvID( hand, "" ) + self:bSetIntClip( hand, 0 ) --B_Sound( self, wep_class.Sound_MagOut ) wep_table.Loaded = "" end @@ -122,8 +122,8 @@ function SWEP:Reload_MagIn( hand, curmag, optinv, optwep_table, optwep_class ) local mag = self:GetBestLoadableMagazine( hand, wep_table.Class ) if mag then - self:D_SetMagID( hand, mag ) - self:D_SetClip( hand, inv[mag].Ammo ) + self:bSetMagInvID( hand, mag ) + self:bSetIntClip( hand, inv[mag].Ammo ) wep_table.Loaded = mag B_Sound( self, wep_class.Sound_Cock ) else diff --git a/gamemodes/benny/entities/weapons/benny/sh_stat2.lua b/gamemodes/benny/entities/weapons/benny/sh_stat2.lua new file mode 100644 index 0000000..42cb70c --- /dev/null +++ b/gamemodes/benny/entities/weapons/benny/sh_stat2.lua @@ -0,0 +1,130 @@ + +-- Stat2 + +-- Weapon ID +function SWEP:bGetInvID( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2() or (hand == false) and self:GetWep1() +end + +function SWEP:bSetInvID( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2( value ) or (hand == false) and self:SetWep1( value ) +end + +-- Wep. Clip ID +function SWEP:bGetMagInvID( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Clip() or (hand == false) and self:GetWep1_Clip() +end + +function SWEP:bSetMagInvID( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Clip( value ) or (hand == false) and self:SetWep1_Clip( value ) +end + +-- Weapon Firemode +function SWEP:bGetFiremode( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Firemode() or (hand == false) and self:GetWep1_Firemode() +end + +function SWEP:bSetFiremode( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Firemode( value ) or (hand == false) and self:SetWep1_Firemode( value ) +end + +-- Weapon Burst +function SWEP:bGetBurst( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Burst() or (hand == false) and self:GetWep1_Burst() +end + +function SWEP:bSetBurst( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Burst( value ) or (hand == false) and self:SetWep1_Burst( value ) +end + +-- Weapon Spread +function SWEP:bGetSpread( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Spread() or (hand == false) and self:GetWep1_Spread() +end + +function SWEP:bSetSpread( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Spread( value ) or (hand == false) and self:SetWep1_Spread( value ) +end + +-- Weapon Spread +function SWEP:bGetShotTime( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_ShotTime() or (hand == false) and self:GetWep1_ShotTime() +end + +function SWEP:bSetShotTime( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_ShotTime( value ) or (hand == false) and self:SetWep1_ShotTime( value ) +end + +-- Weapon Holstering Time +function SWEP:bGetHolsterTime( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Holstering() or (hand == false) and self:GetWep1_Holstering() +end + +function SWEP:bSetHolsterTime( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Holstering( value ) or (hand == false) and self:SetWep1_Holstering( value ) +end + +-- Weapon Reloading Time +function SWEP:bGetReloadTime( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_Reloading() or (hand == false) and self:GetWep1_Reloading() +end + +function SWEP:bSetReloadTime( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_Reloading( value ) or (hand == false) and self:SetWep1_Reloading( value ) +end + +-- Weapon Reload Type +function SWEP:bGetReloadType( hand ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:GetWep2_ReloadType() or (hand == false) and self:GetWep1_ReloadType() +end + +function SWEP:bSetReloadType( hand, value ) + assert( hand!=nil, "Missing hand argument" ) + return (hand == true) and self:SetWep2_ReloadType( value ) or (hand == false) and self:SetWep1_ReloadType( value ) +end + +-- Weapon Player Requesting ID +function SWEP:bGetReqInvID( hand ) + local p = self:GetOwner() + return (hand == true) and p:GetReqID2() or (hand == false) and p:GetReqID1() +end + +function SWEP:bSetReqInvID( hand, value ) + local p = self:GetOwner() + return (hand == true) and p:SetReqID2( value ) or (hand == false) and p:SetReqID1( value ) +end + +-- Internal SWEP Delay +function SWEP:bGetIntDelay( hand ) + return (hand == true) and self:GetDelay2() or (hand == false) and self:GetDelay1() +end + +function SWEP:bSetIntDelay( hand, value ) + return (hand == true) and self:SetDelay2( value ) or (hand == false) and self:SetDelay1( value ) +end + +-- Internal SWEP Clip +function SWEP:bGetIntClip( hand ) + return (hand == true) and self:Clip2() or (hand == false) and self:Clip1() +end + +function SWEP:bSetIntClip( hand, value ) + return (hand == true) and self:SetClip2( value ) or (hand == false) and self:SetClip1( value ) +end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/benny/shared.lua b/gamemodes/benny/entities/weapons/benny/shared.lua index 98db6f8..d11d87d 100644 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ b/gamemodes/benny/entities/weapons/benny/shared.lua @@ -25,6 +25,8 @@ AddCSLuaFile( "sh_firing.lua" ) include ( "sh_firing.lua" ) AddCSLuaFile( "sh_inv.lua" ) include ( "sh_inv.lua" ) +AddCSLuaFile( "sh_stat2.lua" ) +include ( "sh_stat2.lua" ) AddCSLuaFile( "sh_holdtypes.lua" ) include ( "sh_holdtypes.lua" ) AddCSLuaFile( "sh_reload.lua" ) @@ -79,7 +81,7 @@ end function SWEP:BClass( alt ) local ta = self:BTable( alt ) if ta then - return WEAPONS[ ta.Class ] + return WeaponGet( ta.Class ) else return false end @@ -88,13 +90,13 @@ end function SWEP:B_Ammo( hand, value ) local p = self:GetOwner() local inv = p:INV_Get() - self:D_SetClip( hand, value ) - assert( self:D_GetMagID( hand ) != "", "There is no magazine loaded!" ) - inv[ self:D_GetMagID( hand ) ].Ammo = value + self:bSetIntClip( hand, value ) + assert( self:bGetMagInvID( hand ) != "", "There is no magazine loaded!" ) + inv[ self:bGetMagInvID( hand ) ].Ammo = value end function SWEP:B_Firemode( alt ) - return self:BClass( alt ).Firemodes[ self:D_GetFiremode( alt ) ] + return self:BClass( alt ).Firemodes[ self:bGetFiremode( alt ) ] end function SWEP:B_FiremodeName( alt ) @@ -142,26 +144,26 @@ hook.Add( "PlayerButtonUp", "Benny_PlayerButtonUp_TempForAim", function( ply, bu end) function SWEP:BStartHolster( hand ) - if self:D_GetHolstering( hand ) == -1 then + if self:bGetHolsterTime( hand ) == -1 then B_Sound( self, "Common.Holster" ) -- print( "Holstering the " .. (hand and "LEFT" or "RIGHT") ) - self:D_SetHolstering( hand, 0 ) - self:D_SetReloading( hand, -1 ) - self:D_SetReloadType( hand, 0 ) + self:bSetHolsterTime( hand, 0 ) + self:bSetReloadTime( hand, -1 ) + self:bSetReloadType( hand, 0 ) end end function SWEP:BThinkHolster( hand ) - if self:D_GetHolstering( hand ) >= 0 then - self:D_SetHolstering( hand, math.Approach( self:D_GetHolstering( hand ), 1, FrameTime() / 0.35 ) ) + if self:bGetHolsterTime( hand ) >= 0 then + self:bSetHolsterTime( hand, math.Approach( self:bGetHolsterTime( hand ), 1, FrameTime() / 0.35 ) ) end - if self:D_GetHolstering( hand ) == 1 then - self:D_SetHolstering( hand, -1 ) - self:D_SetReloading( hand, -1 ) - self:D_SetReloadType( hand, 0 ) + if self:bGetHolsterTime( hand ) == 1 then + self:bSetHolsterTime( hand, -1 ) + self:bSetReloadTime( hand, -1 ) + self:bSetReloadType( hand, 0 ) self:BHolster( hand ) local p = self:GetOwner() - local req = self:D_GetReqID( hand ) + local req = self:bGetReqInvID( hand ) local inv = p:INV_Get() if req != "" and inv[req] then self:BDeploy( hand, req ) @@ -178,25 +180,25 @@ function SWEP:Think() local wep2 = self:BTable( true ) local wep2c = self:BClass( true ) - if self:D_GetReqID( false ) != "" and self:D_GetReqID( true ) != "" and self:D_GetReqID( false ) == self:D_GetReqID( true ) then - self:D_SetReqID( false, "" ) - self:D_SetReqID( true, "" ) + if self:bGetReqInvID( false ) != "" and self:bGetReqInvID( true ) != "" and self:bGetReqInvID( false ) == self:bGetReqInvID( true ) then + self:bSetReqInvID( false, "" ) + self:bSetReqInvID( true, "" ) if CLIENT then chat.AddText( "Same weapons on ReqID, both holstered" ) end end for i=1, 2 do local hand = i==2 - if self:D_GetReqID( hand ) != "" and !inv[self:D_GetReqID( hand )] then - self:D_SetReqID( hand, "" ) + if self:bGetReqInvID( hand ) != "" and !inv[self:bGetReqInvID( hand )] then + self:bSetReqInvID( hand, "" ) end - local req = self:D_GetReqID( hand ) - local req_o = self:D_GetReqID( !hand ) - local curr = self:D_GetID( hand ) - local curr_o = self:D_GetID( !hand ) + local req = self:bGetReqInvID( hand ) + local req_o = self:bGetReqInvID( !hand ) + local curr = self:bGetInvID( hand ) + local curr_o = self:bGetInvID( !hand ) if req != curr then -- Don't allow holstering from this weapon if... -- Just know, this feels bad. - if self:D_GetReloading( hand ) > 0 then - elseif self:D_GetShotTime( hand ) + self:GetStat( hand, "ShootHolsterTime" ) > CurTime() then + if self:bGetReloadTime( hand ) > 0 then + elseif self:bGetShotTime( hand ) + self:GetStat( hand, "ShootHolsterTime" ) > CurTime() then else if curr != "" then @@ -220,18 +222,18 @@ function SWEP:Think() self:BThinkHolster( hand ) do -- Reload logic - if self:D_GetReloading( hand ) != -1 then - local rlt = self:D_GetReloadType( hand ) + if self:bGetReloadTime( hand ) != -1 then + local rlt = self:bGetReloadType( hand ) -- TODO: Unshitify this. - if RealTime() >= self:D_GetReloading( hand ) + (rlt == 1 and self:GetStat( hand, "Reload_MagIn" ) or rlt == 2 and self:GetStat( hand, "Reload_MagOut" )) then + if RealTime() >= self:bGetReloadTime( hand ) + (rlt == 1 and self:GetStat( hand, "Reload_MagIn" ) or rlt == 2 and self:GetStat( hand, "Reload_MagOut" )) then if rlt == 1 then if SERVER or (CLIENT and IsFirstTimePredicted() ) then - self:Reload_MagIn( hand, self:D_GetMagID( hand ), inv ) + self:Reload_MagIn( hand, self:bGetMagInvID( hand ), inv ) end elseif rlt == 2 then end - self:D_SetReloading( hand, -1 ) - self:D_SetReloadType( hand, 0 ) + self:bSetReloadTime( hand, -1 ) + self:bSetReloadType( hand, 0 ) -- Do reload stuff. end end @@ -243,23 +245,23 @@ function SWEP:Think() for i=1, 2 do local hand = i==2 if !self:C_AttackDown( hand ) then - self:D_SetBurst( hand, 0 ) + self:bSetBurst( hand, 0 ) end end 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 ) + self:GetStat( hand, "SpreadDecay_RampTime" ), 0, 1 ) + if wepc and wepc.Features == "firearm" and self:bGetIntDelay( hand ) < CurTime()-0.01 then + local mweh = math.Remap( CurTime(), self:bGetShotTime( hand ), self:bGetShotTime( hand ) + self:GetStat( hand, "SpreadDecay_RampTime" ), 0, 1 ) mweh = math.Clamp( mweh, 0, 1 ) local decayfinal = Lerp( math.ease.InExpo( mweh ), self:GetStat( hand, "SpreadDecay_Start" ), self:GetStat( hand, "SpreadDecay_End" ) ) - self:D_SetSpread( hand, math.Approach( self:D_GetSpread( hand ), 0, decayfinal * FrameTime() ) ) + self:bSetSpread( hand, math.Approach( self:bGetSpread( hand ), 0, decayfinal * FrameTime() ) ) end end local ht = "normal" - if self:BClass( false ) and self:D_GetHolstering( false ) < 0 then + if self:BClass( false ) and self:bGetHolsterTime( false ) < 0 then ht = "passive" if self:GetUserAim() then if self:BClass( true ) then diff --git a/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua b/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua index a05b71b..bc60727 100644 --- a/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua +++ b/gamemodes/benny/gamemode/modules/gui/cl_debuginv.lua @@ -130,8 +130,8 @@ local function regen_items( itemlist ) local wep = ply:BennyCheck() if wep then - local handed_r = wep:D_GetID( false ) == v - local handed_l = wep:D_GetID( true ) == v + local handed_r = wep:bGetInvID( false ) == v + local handed_l = wep:bGetInvID( true ) == v if handed_r or handed_l then draw.SimpleText( handed_l and "LEFT" or "RIGHT", "Benny_18", w/2, h/2 + ss(1), schema_c("bg"), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end diff --git a/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua b/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua new file mode 100644 index 0000000..a506daf --- /dev/null +++ b/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua @@ -0,0 +1,44 @@ + +--[[ + Your Name Is Benny + Item definition +]] + +-- Not 100% sure how metastuff works yet. + +-- Global weapons table +WEAPONS = {} + +function WeaponGet(class) + return ItemDef(class) +end + +-- ItemDef metatable +ItemDef = {} + +function ItemDef.__index( self, key ) + if rawget(self, "BaseClass") then + return rawget( rawget(self, "BaseClass"), key ) + end +end + +function ItemDef:new( classname, classtable ) + if classtable then + local newdef = classtable + newdef.ClassName = classname + newdef.BaseClass = WEAPONS[newdef.Base] + + WEAPONS[classname] = newdef + + setmetatable( newdef, ItemDef ) + return newdef + else + return WEAPONS[classname] + end +end + +function ItemDef:__tostring() + return "ItemDef [" .. self.ClassName .. "]" +end + +setmetatable( ItemDef, { __call = ItemDef.new } ) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/meta/sh_itemlive.lua b/gamemodes/benny/gamemode/modules/meta/sh_itemlive.lua new file mode 100644 index 0000000..b5814e4 --- /dev/null +++ b/gamemodes/benny/gamemode/modules/meta/sh_itemlive.lua @@ -0,0 +1,5 @@ + +--[[ + Your Name Is Benny + Item existance +]] \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 1eb3345..b27ecb0 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -516,8 +516,8 @@ 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 ) + local numba = identicallist[ wep:bGetInvID( hand ) ] + draw.SimpleText( "#" .. tostring(numba) .. ", " .. wep:bGetInvID( 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"] ) @@ -526,19 +526,19 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() draw.SimpleText( wep:B_FiremodeName( hand ), "Benny_12", p_x + pb + ss(14.5), p_y + pb + t_h + ss(8), scheme["bg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) -- draw.SimpleText( "[AMMO TYPE]", "Benny_10", p_x + pb + ss(30+4), p_y + pb + t_h + ss(8), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER ) end - if wep_class.Ammo then -- Ammo + if wep_table.Loaded and wep_table.Loaded != "" then -- Ammo local b_w, b_h = ss(3), ss(10) local lw, lh = ss(2), ss(2) surface.SetDrawColor( scheme["fg"] ) - local ammo = math.max( wep:D_GetClip( hand ), wep_class.Ammo ) + local ammo = math.max( wep:bGetIntClip( hand ), ItemDef(inv[wep_table.Loaded].Class).Ammo ) if ammo>30 then b_w, b_h = ss(3), ss(4) end local offset = b_h local count = 1 for i=1, ammo do local thefunk = surface.DrawRect - if i > wep:D_GetClip( hand ) then + if i > wep:bGetIntClip( hand ) then thefunk = surface.DrawOutlinedRect end if i!=1 and i%30 == 1 then @@ -548,9 +548,9 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() thefunk( p_x + p_w - b_w - pb - ((count-1)*(b_w+lw)), p_y + p_h - offset - pb, b_w, b_h, ss(0.5) ) count = count + 1 end - draw.SimpleText( wep:D_GetClip( hand ), "Benny_12", p_x + p_w - pb - ss(1), p_y + p_h - offset - ss(12+3), scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) + draw.SimpleText( wep:bGetIntClip( hand ), "Benny_12", p_x + p_w - pb - ss(1), p_y + p_h - offset - ss(12+3), scheme["fg"], TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - if wep:D_GetMagID( hand ) != wep_table.Loaded then + if wep:bGetMagInvID( hand ) != wep_table.Loaded then surface.SetDrawColor( scheme["bg"] ) surface.DrawRect( p_x, p_y - ss( 12+3 ), ss( 66 ), ss( 12 ) ) draw.SimpleText( "!! Mag desync.", "Benny_12", p_x + ss( 2 ), p_y - ss( 12+2 ), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) @@ -563,7 +563,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local b2 = ss( 2 ) local b3 = ss( 3 ) local b4 = ss( 4 ) - local maglist = p:INV_FindMagSmart( wep_table.Class, wep:D_GetID( hand ) ) + local maglist = p:INV_FindMagSmart( wep_class.ClassName, wep:bGetInvID( hand ) ) for id, tag in ipairs( maglist ) do --assert( inv[tag], "That magazine doesn't exist. " .. tag ) local chunk = ((ss(1)+m_w)*(id-1)) @@ -578,8 +578,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local s3 = math.floor( s2 - s1 ) local m1, m2, m3, m4 = m_x + bb + bb - chunk, m_y + bb + bb - s3, m_w - b2 - b2, s2 - local active = tag == wep:D_GetMagID( hand ) - local active2 = tag == wep:D_GetMagID( !hand ) + local active = tag == wep:bGetMagInvID( hand ) + local active2 = tag == wep:bGetMagInvID( !hand ) if active or active2 then draw.SimpleText( active2 and "|" or "x", "Benny_10", m_x + (m_w/2) - chunk, m_y + (m_h/2), scheme["fg"], TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end @@ -735,9 +735,9 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local invid = 0 for _, item in pairs( weighted ) do local id = iflip[item] - local active = wep:D_GetReqID( false ) == id or wep:D_GetReqID( true ) == id - local active_r = wep:D_GetReqID( false ) == id - local active_l = wep:D_GetReqID( true ) == id + local active = wep:bGetReqInvID( false ) == id or wep:bGetReqInvID( true ) == id + local active_r = wep:bGetReqInvID( false ) == id + local active_l = wep:bGetReqInvID( true ) == id local class = WeaponGet(item.Class) local boxsize = ss(b_w) surface.SetDrawColor( scheme[active and "fg" or "bg"] ) @@ -911,7 +911,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() draw.SimpleText( wep1_class.Name, "Benny_14", bx-mx, by+ss(8)*-1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) draw.SimpleText( "Clip1: " .. wep:Clip1(), "Benny_14", bx-mx, by+ss(8)*0, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) draw.SimpleText( "ID1: " .. wep:GetWep1(), "Benny_14", bx-mx, by+ss(8)*1, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) - draw.SimpleText( "MagID1: " .. wep:D_GetMagID( false ), "Benny_14", bx-mx, by+ss(8)*2, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) + draw.SimpleText( "MagID1: " .. wep:bGetMagInvID( false ), "Benny_14", bx-mx, by+ss(8)*2, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) if wep1_table.Loaded then draw.SimpleText( "T_MagID1: " .. wep1_table.Loaded, "Benny_14", bx-mx, by+ss(8)*3, color_white, TEXT_ALIGN_RIGHT, TEXT_ALIGN_TOP ) end @@ -922,7 +922,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() draw.SimpleText( wep2_class.Name, "Benny_14", bx+mx, by+ss(8)*-1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) draw.SimpleText( "Clip2: " .. wep:Clip2(), "Benny_14", bx+mx, by+ss(8)*0, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) draw.SimpleText( "ID2: " .. wep:GetWep2(), "Benny_14", bx+mx, by+ss(8)*1, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) - draw.SimpleText( "MagID2: " .. wep:D_GetMagID( true ), "Benny_14", bx+mx, by+ss(8)*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) + draw.SimpleText( "MagID2: " .. wep:bGetMagInvID( true ), "Benny_14", bx+mx, by+ss(8)*2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) if wep2_table.Loaded then draw.SimpleText( "T_MagID2: " .. wep2_table.Loaded, "Benny_12", bx+mx, by+24*3, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) end @@ -939,8 +939,8 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() local hand = i==2 if hand then boost = -boost end - local wr = wep:D_GetReloading( hand ) - local wrt = wep:D_GetReloadType( hand ) + local wr = wep:bGetReloadTime( hand ) + local wrt = wep:bGetReloadType( hand ) if wr > 0 then local b1 = math.TimeFraction( wr, wr + wep:GetStat( hand, "Reload_MagIn" ), wr + wep:GetStat( hand, "Reload_MagIn_Bonus1" ) ) local b2 = math.TimeFraction( wr, wr + wep:GetStat( hand, "Reload_MagIn" ), wr + wep:GetStat( hand, "Reload_MagIn_Bonus2" ) ) diff --git a/gamemodes/benny/gamemode/modules/player/sh_basic.lua b/gamemodes/benny/gamemode/modules/player/sh_basic.lua index d30927d..8880833 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_basic.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_basic.lua @@ -69,25 +69,25 @@ concommand.Add("benny_inv_discard", function( ply, cmd, args ) net.WriteString( args[1] ) net.Send( ply ) - if wep:D_GetID( false ) == args[1] then + if wep:bGetInvID( false ) == args[1] then print( "Disequipped " .. args[1] .. " for " .. tostring(wep) ) wep:SetWep1( "" ) wep:SetWep1_Clip( "" ) wep:SetClip1( 0 ) end - if wep:D_GetID( true ) == args[1] then + if wep:bGetInvID( true ) == args[1] then print( "Disequipped " .. args[1] .. " for " .. tostring(wep) ) wep:SetWep2( "" ) wep:SetWep2_Clip( "" ) wep:SetClip2( 0 ) end - if wep:D_GetMagID( false ) == args[1] then - inv[wep:D_GetID( false )].Loaded = "" + if wep:bGetMagInvID( false ) == args[1] then + inv[wep:bGetInvID( false )].Loaded = "" wep:SetWep1_Clip( "" ) wep:SetClip1( 0 ) end - if wep:D_GetMagID( true ) == args[1] then - inv[wep:D_GetID( true )].Loaded = "" + if wep:bGetMagInvID( true ) == args[1] then + inv[wep:bGetInvID( true )].Loaded = "" wep:SetWep2_Clip( "" ) wep:SetClip2( 0 ) end diff --git a/gamemodes/benny/gamemode/modules/player/sh_hud.lua b/gamemodes/benny/gamemode/modules/player/sh_hud.lua index 8711f71..efb49e8 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_hud.lua @@ -30,39 +30,39 @@ local function beatup( ply, num ) invid = invid + 1 if num == 0 then num = 10 end if num == invid then - if id == wep:D_GetReqID( hand ) then + if id == wep:bGetReqInvID( hand ) then -- If we are selected our currently equipped weapon, holster it. - return wep:D_SetReqID( hand, "" ) + return wep:bSetReqInvID( hand, "" ) else - if wep:D_GetReqID( hand ) != "" then + if wep:bGetReqInvID( hand ) != "" then -- Something is in this hand - if wep:D_GetReqID( !hand ) != "" then + if wep:bGetReqInvID( !hand ) != "" then -- Something in the other hand - wep:D_SetReqID( !hand, wep:D_GetReqID( hand ) ) - wep:D_SetReqID( hand, id ) + wep:bSetReqInvID( !hand, wep:bGetReqInvID( hand ) ) + wep:bSetReqInvID( hand, id ) return else -- Nothing in the other hand - wep:D_SetReqID( !hand, "" ) - wep:D_SetReqID( hand, id ) + wep:bSetReqInvID( !hand, "" ) + wep:bSetReqInvID( hand, id ) return end else -- Nothing in this hand. - if wep:D_GetReqID( !hand ) == id then + if wep:bGetReqInvID( !hand ) == id then -- Weapon we want is in the other hand. - wep:D_SetReqID( !hand, "" ) - wep:D_SetReqID( hand, id ) + wep:bSetReqInvID( !hand, "" ) + wep:bSetReqInvID( hand, id ) return end end - return wep:D_SetReqID( hand, id ) + return wep:bSetReqInvID( hand, id ) end end end end - return wep:D_SetReqID( hand, "" ) + return wep:bSetReqInvID( hand, "" ) end hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_Inv", function( ply, button ) diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua index cdfcd5c..872398e 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua @@ -157,10 +157,10 @@ hook.Add( "Move", "Benny_Move", function( ply, mv ) targetspeed = targetspeed * Lerp( w:GetAim(), 1, w:GetStat( false, "Speed_Aiming" ) ) - local st = w:D_GetShotTime( false ) + local st = w:bGetShotTime( false ) targetspeed = targetspeed * (st+w:GetStat( hand, "Speed_FiringTime" ) > CurTime() and w:GetStat( false, "Speed_Firing" ) or 1) - targetspeed = targetspeed * (w:D_GetReloading( false ) > 0 and w:GetStat( false, "Speed_Reloading" ) or 1) + targetspeed = targetspeed * (w:bGetReloadTime( false ) > 0 and w:GetStat( false, "Speed_Reloading" ) or 1) mv:SetMaxSpeed( targetspeed ) mv:SetMaxClientSpeed( targetspeed ) diff --git a/gamemodes/benny/gamemode/modules/player/sh_player.lua b/gamemodes/benny/gamemode/modules/player/sh_player.lua index a2c3387..1e62cd0 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_player.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_player.lua @@ -182,6 +182,7 @@ local T_WEIGHT = { ["equipment"] = 00, ["grenade"] = -10, ["magazine"] = -100, + ["base"] = -1000, } function PT:INV_Weight() @@ -253,6 +254,7 @@ do ["utility"] = { 6, 2 }, ["equipment"] = { 7, 1 }, ["magazine"] = { 8, 1 }, + ["base"] = { 8, 2 }, } -- PROTO: Cache this! @@ -289,16 +291,6 @@ do end return inventorylist end - -- PROTO: I am on an outdated version of GMod. - function table.Flip( tab ) - local res = {} - - for k, v in pairs( tab ) do - res[ v ] = k - end - - return res - end function PT:INV_ListFromBuckets() local buckets = self:INV_Buckets() @@ -325,7 +317,7 @@ hook.Add("StartCommand", "Benny_INV_StartCommand", function( ply, cmd ) -- if CLIENT and ply.CLIENTDESIRE and inv[ply.CLIENTDESIRE ] and inv_bucketlist_flipped[ ply.CLIENTDESIRE ] then -- cmd:SetUpMove( inv_bucketlist_flipped[ ply.CLIENTDESIRE ] ) -- end - -- if CLIENT and (wep:D_GetID( hand ) == ply.CLIENTDESIRE) then + -- if CLIENT and (wep:bGetInvID( hand ) == ply.CLIENTDESIRE) then -- ply.CLIENTDESIRE = 0 -- print("Fixed") -- end diff --git a/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua new file mode 100644 index 0000000..8659313 --- /dev/null +++ b/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua @@ -0,0 +1,1552 @@ + +FIREMODE_AUTO = { + { Mode = math.huge }, +} +FIREMODE_AUTOSEMI = { + { Mode = math.huge }, + { Mode = 1 }, +} +FIREMODE_SEMI = { + { Mode = 1 }, +} +WEAPONS = {} + +function WeaponGet( classname ) + return WEAPONS[ classname ] +end + +do -- Sound definitions + + AddSound( "1911.Fire", { + "benny/weapons/1911/01.ogg", + "benny/weapons/1911/02.ogg", + "benny/weapons/1911/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Bizon.Fire", { + "benny/weapons/bizon/01.ogg", + "benny/weapons/bizon/02.ogg", + "benny/weapons/bizon/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "MP5K.Fire", { + "benny/weapons/mp5k/01.ogg", + "benny/weapons/mp5k/02.ogg", + "benny/weapons/mp5k/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "MAC11.Fire", { + "benny/weapons/mac11/01.ogg", + "benny/weapons/mac11/02.ogg", + "benny/weapons/mac11/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "MP7.Fire", { + "benny/weapons/mp7/01.ogg", + "benny/weapons/mp7/02.ogg", + "benny/weapons/mp7/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "TMP.Fire", { + "benny/weapons/tmp/01.ogg", + "benny/weapons/tmp/02.ogg", + "benny/weapons/tmp/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Anaconda.Fire", { + "benny/weapons/anaconda/01.ogg", + "benny/weapons/anaconda/02.ogg", + "benny/weapons/anaconda/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Nambu.Fire", { + "benny/weapons/nambu/01.ogg", + "benny/weapons/nambu/02.ogg", + "benny/weapons/nambu/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "USP.Fire", { + "benny/weapons/usp/01.ogg", + "benny/weapons/usp/02.ogg", + "benny/weapons/usp/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Glock.Fire", { + "benny/weapons/glock/01.ogg", + "benny/weapons/glock/02.ogg", + "benny/weapons/glock/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "M92.Fire", { + "benny/weapons/m92/01.ogg", + "benny/weapons/m92/02.ogg", + "benny/weapons/m92/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "P226.Fire", { + "benny/weapons/p226/01.ogg", + "benny/weapons/p226/02.ogg", + "benny/weapons/p226/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "M16A2.Fire", { + "benny/weapons/m16a2/01.ogg", + "benny/weapons/m16a2/02.ogg", + "benny/weapons/m16a2/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "FNC.Fire", { + "benny/weapons/fnc/01.ogg", + "benny/weapons/fnc/02.ogg", + "benny/weapons/fnc/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "AA12.Fire", "benny/weapons/aa12/01.ogg", 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "SPAS12.Fire", { + "benny/weapons/spas12/01.ogg", + "benny/weapons/spas12/02.ogg", + "benny/weapons/spas12/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "QBBLSW.Fire", { + "benny/weapons/qbblsw/fire-01.ogg", + "benny/weapons/qbblsw/fire-02.ogg", + "benny/weapons/qbblsw/fire-03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Stoner63.Fire", { + "benny/weapons/stoner63/01.ogg", + "benny/weapons/stoner63/02.ogg", + "benny/weapons/stoner63/03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "Barrett.Fire", { + "benny/weapons/barrett/fire-01.ogg", + "benny/weapons/barrett/fire-02.ogg", + "benny/weapons/barrett/fire-03.ogg", + }, 140, 100, 0.5, CHAN_STATIC ) + + AddSound( "MP5K.MagOut", "benny/weapons/mp5k/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MP5K.MagIn", "benny/weapons/mp5k/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MP5K.Cock", "benny/weapons/mp5k/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MAC11.MagOut", "benny/weapons/mac11/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MAC11.MagIn", "benny/weapons/mac11/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MP7.MagOut", "benny/weapons/mp7/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "MP7.MagIn", "benny/weapons/mp7/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "TMP.MagOut", "benny/weapons/tmp/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "TMP.MagIn", "benny/weapons/tmp/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Bizon.MagOut", "benny/weapons/bizon/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Bizon.MagIn", "benny/weapons/bizon/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Anaconda.MagOut", "benny/weapons/anaconda/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Anaconda.MagIn", "benny/weapons/anaconda/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Nambu.MagOut", "benny/weapons/nambu/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Nambu.MagIn", "benny/weapons/nambu/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "P226.MagOut", "benny/weapons/p226/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "P226.MagIn", "benny/weapons/p226/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "M92.MagOut", "benny/weapons/m92/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "M92.MagIn", "benny/weapons/m92/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "1911.MagOut", "benny/weapons/1911/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "1911.MagIn", "benny/weapons/1911/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "USP.MagOut", "benny/weapons/usp/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "USP.MagIn", "benny/weapons/usp/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Glock.MagOut", "benny/weapons/glock/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Glock.MagIn", "benny/weapons/glock/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Glock.Cock", "benny/weapons/glock/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Deagle.Cock", "benny/weapons/deagle/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "M16A2.MagOut", "benny/weapons/m16a2/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "M16A2.MagIn", "benny/weapons/m16a2/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "M16A2.Cock", "benny/weapons/m16a2/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "FNC.MagOut", "benny/weapons/fnc/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "FNC.MagIn", "benny/weapons/fnc/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "FNC.Cock", "benny/weapons/fnc/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Barrett.MagOut", "benny/weapons/barrett/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Barrett.MagIn", "benny/weapons/barrett/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Barrett.Cock", "benny/weapons/barrett/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "AA12.MagOut", "benny/weapons/aa12/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "AA12.MagIn", "benny/weapons/aa12/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "SPAS12.MagOut", { + "benny/weapons/spas12/magout-01.ogg", + "benny/weapons/spas12/magout-02.ogg", + "benny/weapons/spas12/magout-03.ogg", + }, 70, 100, 0.5, CHAN_STATIC ) + AddSound( "SPAS12.MagIn", "benny/weapons/spas12/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) + + AddSound( "Common.Unload", "benny/weapons/unload.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.Dryfire.Pistol", "benny/weapons/common/06-13.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.Dryfire.Rifle", "benny/weapons/common/06-12.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.Deploy", "benny/weapons/common/magpouch.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.Holster", "benny/weapons/common/magpouchin.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.NoAmmo", "benny/weapons/noammo.ogg", 70, 100, 0.5, CHAN_STATIC ) + AddSound( "Common.ReloadFail", "benny/hud/reloadfail.ogg", 70, 100, 0.1, CHAN_STATIC ) + +end + +do -- Toolgun + + local ToolGunTools = { + ["ammocrate"] = function( self, p, tr ) + if SERVER then + local summon = ents.Create( "benny_equipment_ammo" ) + summon:SetPos( tr.HitPos + tr.HitNormal ) + summon:Spawn() + end + end, + ["summon_human"] = function( self, p, tr ) + if SERVER then + local summon = ents.Create( "benny_npc_human" ) + summon:SetPos( tr.HitPos + tr.HitNormal ) + local ang = Angle( 0, p:EyeAngles().y+0, 0 ) + summon:SetAngles( ang ) + summon:Spawn() + end + end, + ["remover"] = function( self, p, tr ) + if SERVER then + local ent = tr.Entity + if IsValid( ent ) then + ent:Remove() + return + end + end + end, + } + local function CreateSelect() + local Frame = vgui.Create( "DFrame" ) + Frame:SetSize( 300, 85 ) + Frame:SetTitle( "Toolgun Select" ) + Frame:Center() + Frame:MakePopup() + + local Text = Frame:Add( "DLabel" ) + Text:Dock( TOP ) + Text:DockMargin( 10, 0, 10, 0 ) + Text:SetText( "Select a tool." ) + + local List = Frame:Add( "DComboBox" ) + List:Dock( TOP ) + List:SetValue(GetConVar("benny_wep_toolgun"):GetString()) + List:DockMargin( 10, 0, 10, 0 ) + for i, v in SortedPairs( ToolGunTools ) do + List:AddChoice( i ) + end + List.OnSelect = function( self, index, value ) + RunConsoleCommand( "benny_wep_toolgun", value ) + Frame:Remove() + end + end + WEAPONS["toolgun"] = { + Name = "TOOL GUN", + Description = "Developer development device. Hold ALT for Remover", + Type = "special", + + WModel = "models/weapons/w_toolgun.mdl", + HoldType = "revolver", + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + + Custom_Fire = function( self, data ) + if self:GetDelay1() > CurTime() then + return true + end + self:SetDelay1( CurTime() + 0.2 ) + + local p = self:GetOwner() + + local tr = p:GetEyeTrace() + local tool = p:KeyDown( IN_WALK ) and "remover" or p:GetInfo( "benny_wep_toolgun" ) + if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) else return true end + + if CLIENT and IsFirstTimePredicted() then + local vStart = self:GetAttachment( 1 ).Pos + local vPoint = tr.HitPos + local effectdata = EffectData() + effectdata:SetStart( vStart ) + effectdata:SetOrigin( vPoint ) + util.Effect( "ToolTracer", effectdata ) + end + + -- Return true to skip weapon logic + return true + end, + + Custom_Reload = function( self, data ) + if CLIENT then + CreateSelect() + end + + -- Return true to skip weapon logic + return true + end, + + Features = "firearm", + } + + + WEAPONS["camera"] = { + Name = "CAMERA", + Description = "Developer development device", + Type = "special", + + WModel = "models/maxofs2d/camera.mdl", + HoldType = "camera", + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + + Custom_Fire = function( self, data ) + if self:GetDelay1() > CurTime() then + return true + end + self:SetDelay1( CurTime() + 0.2 ) + + local p = self:GetOwner() + + if CLIENT and IsFirstTimePredicted() then + local zp, za, zf = p:EyePos(), p:EyeAngles(), 90 + RunConsoleCommand( "benny_cam_override", zp.x .. " " .. zp.y .. " " .. zp.z .. " " .. za.p .. " " .. za.y .. " " .. za.r .. " " .. zf ) + end + + -- Return true to skip weapon logic + return true + end, + + Custom_Reload = function( self, data ) + RunConsoleCommand( "benny_cam_override", "" ) + + -- Return true to skip weapon logic + return true + end, + + Custom_DisableSpecialMovement = function( self, data ) + -- Return true to skip weapon logic + if self:GetUserAim() then + return true + end + end, + + Custom_CalcView = function( self, data ) + if self:GetUserAim() and GetConVar("benny_cam_override"):GetString() == "" then + data.drawviewer = false + data.origin = self:GetOwner():EyePos() + data.angles = self:GetOwner():EyeAngles() + return true -- Return true to halt + end + + end, + + Features = "firearm", + } +end + +do -- Melee + + WEAPONS["melee_bat"] = { + Name = "BAT", + Description = "Aluminum bat. Home run!", + Type = "melee", + + WModel = "models/weapons/w_crowbar.mdl", + HoldType = "melee2", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 0, + Damage = 0, + + Features = "melee", + } + + WEAPONS["melee_baton"] = { + Name = "BATON", + Description = "Weighty beating stick.", + Type = "melee", + + WModel = "models/weapons/w_eq_tonfa.mdl", + HoldType = "knife", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 0, + Damage = 0, + + Features = "melee", + } + + WEAPONS["melee_knife"] = { + Name = "KNIFE", + Description = "Makes for a great entrée and dessert.", + Type = "melee", + + WModel = "models/weapons/w_knife_ct.mdl", + HoldType = "knife", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 0, + Damage = 0, + + Features = "melee", + } + + WEAPONS["melee_machete"] = { + Name = "MACHETE", + Description = "Cut up foliage and people!", + Type = "melee", + + WModel = "models/props_canal/mattpipe.mdl", + HoldType = "melee2", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 0, + Damage = 0, + + Features = "melee", + } + +end + +do -- Handguns + + WEAPONS["1911"] = { + Name = "COBRA .45", + Description = "Hits hard. They don't make them like they used to!", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_colt.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "1911.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_Reload = "1911.Reload", + Sound_MagOut = "1911.MagOut", + Sound_MagIn = "1911.MagIn", + Sound_Cock = "Glock.Cock", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 8, + Damage = 30, + Spread = 22/60, + SpreadAdd = 0.5, + SpreadAddMax = 15, + + SpreadDecay_Start = 3, + SpreadDecay_End = 11, + SpreadDecay_RampTime = 0.5, + + Reload_MagOut = 0.1, + Reload_MagIn = 0.75, + Reload_MagIn_Bonus1 = 0.4, + Reload_MagIn_Bonus2 = 0.4+0.15, + + Speed_Move = 1, + Speed_Aiming = 0.98, + Speed_Reloading = 1, + Speed_Firing = 1, + + Features = "firearm", + } + + WEAPONS["usp"] = { + Name = "MK. 23", + Description = "If it works for hardasses around the world, it'll work for you.", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_pist_usp.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "USP.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_Reload = "USP.Reload", + Sound_MagOut = "USP.MagOut", + Sound_MagIn = "USP.MagIn", + Sound_Cock = "Glock.Cock", + + Delay = (60/300), + Firemodes = FIREMODE_SEMI, + Ammo = 12, + Damage = 32, + Spread = 15/60, + SpreadAdd = 0.4, + SpreadAddMax = 15, + + SpreadDecay_Start = 3, + SpreadDecay_End = 11, + SpreadDecay_RampTime = 0.5, + + Reload_MagOut = 0.15, + Reload_MagIn = 0.85, + Reload_MagIn_Bonus1 = 0.5, + Reload_MagIn_Bonus2 = 0.5+0.12, + + Speed_Move = 1, + Speed_Aiming = 0.98, + Speed_Reloading = 1, + Speed_Firing = 1, + + Features = "firearm", + } + + WEAPONS["glock"] = { + Name = "GLOCK-18", + Description = "Bullet storm. Lasts about a second or so, just like you!", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_pist_glock18.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.25 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "Glock.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Glock.MagOut", + Sound_MagIn = "Glock.MagIn", + Sound_Cock = "Glock.Cock", + + Delay = (60/900), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 17, + Damage = 22, + Spread = 60/60, + SpreadAdd = 0.8, + SpreadAddMax = 15, + + SpreadDecay_Start = 3, + SpreadDecay_End = 11, + SpreadDecay_RampTime = 0.5, + + Reload_MagOut = 0.25, + Reload_MagIn = 1.1, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.08, + + Speed_Move = 1, + Speed_Aiming = 0.95, + Speed_Reloading = 0.95, + Speed_Firing = 0.95, + + Features = "firearm", + } + + WEAPONS["nambu"] = { + Name = "NAMBU .38", + Description = "Eastern revolver that hits as hard as it costs.", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_pist_derringer.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "Nambu.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Nambu.MagOut", + Sound_MagIn = "Nambu.MagIn", + Sound_Cock = "Glock.Cock", + + Delay = (60/180), + Firemodes = FIREMODE_SEMI, + Ammo = 6, + Damage = 36, + Spread = 30/60, + SpreadAdd = 1.5, + SpreadAddMax = 15, + + SpreadDecay_Start = 3, + SpreadDecay_End = 11, + SpreadDecay_RampTime = 0.5, + + Reload_MagOut = 0.5, + Reload_MagIn = 0.5, + Reload_MagIn_Bonus1 = 0.2, + Reload_MagIn_Bonus2 = 0.2+0.1, + + Speed_Move = 1, + Speed_Aiming = 1, + Speed_Reloading = 0.9, + Speed_Firing = 1, + + Features = "firearm", + } + + WEAPONS["anaconda"] = { + Name = "ANACONDA", + Description = "Precise and kicks like a mule.", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_357.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.1 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "Anaconda.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Anaconda.MagOut", + Sound_MagIn = "Anaconda.MagIn", + Sound_Cock = "Glock.Cock", + + Delay = (60/180), + Firemodes = FIREMODE_SEMI, + Ammo = 6, + Damage = 55, + Spread = 30/60, + SpreadAdd = 6, + SpreadAddMax = 15, + + SpreadDecay_Start = 6, + SpreadDecay_End = 22, + SpreadDecay_RampTime = 0.65, + + Reload_MagOut = 0.6, + Reload_MagIn = 0.6, + Reload_MagIn_Bonus1 = 0.18, + Reload_MagIn_Bonus2 = 0.18+0.08, + + Speed_Move = 1.0, + Speed_Aiming = 0.95, + Speed_Reloading = 0.9, + Speed_Firing = 0.95, + + Features = "firearm", + } + + WEAPONS["deagle"] = { + Name = "DEAGLE", + Description = "Autoloading .50 caliber pistol.", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_pist_deagle.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "Anaconda.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Anaconda.MagOut", + Sound_MagIn = "Anaconda.MagIn", + Sound_Cock = "Deagle.Cock", + + Delay = (60/180), + Firemodes = FIREMODE_SEMI, + Ammo = 7, + Damage = 47, + Spread = 30/60, + SpreadAdd = 4, + SpreadAddMax = 15, + + SpreadDecay_Start = 8, + SpreadDecay_End = 25, + SpreadDecay_RampTime = 0.5, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.95, + Speed_Firing = 0.95, + Speed_FiringTime = 0.5, + + Features = "firearm", + } + +end + +do -- SMGs & PDWs + + WEAPONS["tmp"] = { + Name = "TMP", + Description = "Small, compact, and favored by private security.", + Type = "smg", + + WModel = "models/weapons/w_smg_tmp_us.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "TMP.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "TMP.Reload", + Sound_MagOut = "TMP.MagOut", + Sound_MagIn = "TMP.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/650), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 15, + Damage = 22, + Spread = 20/60, + SpreadAdd = 10/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 4, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.4, + + Speed_Move = 0.97, + Speed_Aiming = 0.97, + Speed_Reloading = 0.97, + Speed_Firing = 0.97, + + Features = "firearm", + } + + WEAPONS["mp7"] = { + Name = "MP7", + Description = "Small, pistol-sized, goes through kevlar like a knife.", + Type = "smg", + + WModel = "models/weapons/w_smg1.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "MP7.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "MP7.Reload", + Sound_MagOut = "MP7.MagOut", + Sound_MagIn = "MP7.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/900), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 20, + Damage = 19, + Spread = 20/60, + SpreadAdd = 20/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 2, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.2, + + Speed_Move = 0.97, + Speed_Aiming = 0.97, + Speed_Reloading = 0.97, + Speed_Firing = 0.97, + + Features = "firearm", + } + + WEAPONS["mp5k"] = { + Name = "MP5K", + Description = "Quality manufacturing, but a cumbersome reload.", + Type = "smg", + + WModel = "models/weapons/w_smg_mp5k.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "MP5K.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "MP5K.Reload", + Sound_MagOut = "MP5K.MagOut", + Sound_MagIn = "MP5K.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/750), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 15, + Damage = 22, + Spread = 20/60, + SpreadAdd = 10/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 3, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.3, + + Speed_Move = 0.97, + Speed_Aiming = 0.97, + Speed_Reloading = 0.97, + Speed_Firing = 0.97, + + Features = "firearm", + } + + WEAPONS["mac11"] = { + Name = "MAC-11", + Description = "More fit for combat in a phone booth.", + Type = "smg", + + WModel = "models/weapons/w_smg_mac10.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.1 }, + + Sound_Fire = "MAC11.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "MAC11.Reload", + Sound_MagOut = "MAC11.MagOut", + Sound_MagIn = "MAC11.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/1400), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 16, + Damage = 19, + Spread = 60/60, + SpreadAdd = 30/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 10, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.3, + + Speed_Move = 0.97, + Speed_Aiming = 0.97, + Speed_Reloading = 0.97, + Speed_Firing = 0.97, + + Features = "firearm", + } + + WEAPONS["bizon"] = { + Name = "BIZON", + Description = "Unwieldy bullet storm.", + Type = "smg", + + WModel = "models/weapons/w_smg_bizon.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.34 }, + + Sound_Fire = "Bizon.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "Bizon.Reload", + Sound_MagOut = "Bizon.MagOut", + Sound_MagIn = "Bizon.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/700), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 40, + Damage = 20, + Spread = 40/60, + SpreadAdd = 10/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 1, + SpreadDecay_End = 10, + SpreadDecay_RampTime = 0.6, + + Speed_Move = 0.94, + Speed_Aiming = 0.94, + Speed_Reloading = 0.93, + Speed_Firing = 0.93, + + Features = "firearm", + } + + WEAPONS["chicom"] = { + Name = "QCW-CQB-21", + Description = "Subsonic bullpup SMG.", + Type = "smg", + + WModel = "models/weapons/w_rif_famas.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.34 }, + + Sound_Fire = "M92.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_Reload = "Bizon.Reload", + Sound_MagOut = "Bizon.MagOut", + Sound_MagIn = "Bizon.MagIn", + Sound_Cock = "MP5K.Cock", + + Delay = (60/1050), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 36, + Damage = 18, + Spread = 40/60, + SpreadAdd = 33/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 4, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.7, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.94, + Speed_Firing = 0.94, + + Features = "firearm", + } + +end + +do -- Shotguns + + WEAPONS["spas12"] = { + Name = "SPAS-12", + Description = "Heavy metal pump-action shotgun.", + Type = "shotgun", + + WModel = "models/weapons/w_shotgun.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + + Sound_Fire = "SPAS12.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "SPAS12.MagOut", + Sound_MagIn = "SPAS12.MagIn", + + Delay = (60/120), + Firemodes = FIREMODE_SEMI, + Ammo = 8, + Damage = 10, + Pellets = 8, + Spread = 150/60, + SpreadAdd = 150/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 2, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.7, + + Speed_Move = 0.93, + Speed_Aiming = 0.95, + Speed_Reloading = 0.85, + Speed_Firing = 0.75, + + Features = "firearm", + } + + WEAPONS["doublebarrel"] = { + Name = "D/B", + Description = "Pocket-sized double-barrelled rocket of fun!", + Type = "shotgun", + + WModel = "models/weapons/w_shot_shorty.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + + Sound_Fire = "SPAS12.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "SPAS12.MagOut", + Sound_MagIn = "SPAS12.MagIn", + + Delay = (60/120), + Firemodes = FIREMODE_SEMI, + Ammo = 2, + Damage = 10, + Pellets = 8, + Spread = 300/60, + SpreadAdd = 150/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 10, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.5, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.9, + Speed_Firing = 0.9, + + Features = "firearm", + } + + WEAPONS["overunder"] = { + Name = "O/U", + Description = "Full-length double-barrelled bar fight finisher.", + Type = "shotgun", + + WModel = "models/weapons/w_shot_kozlice.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + + Sound_Fire = "SPAS12.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "SPAS12.MagOut", + Sound_MagIn = "SPAS12.MagIn", + + Delay = (60/120), + Firemodes = FIREMODE_SEMI, + Ammo = 2, + Damage = 10, + Pellets = 8, + Spread = 130/60, + SpreadAdd = 130/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 10, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 0.5, + + Speed_Move = 0.93, + Speed_Aiming = 0.95, + Speed_Reloading = 0.85, + Speed_Firing = 0.85, + + Features = "firearm", + } + + WEAPONS["aa12"] = { + Name = "AA-12", + Description = "Magazine fed powerhouse.", + Type = "shotgun", + + WModel = "models/weapons/w_shot_br99.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + + Sound_Fire = "AA12.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "AA12.MagOut", + Sound_MagIn = "AA12.MagIn", + + Delay = (60/180), + Firemodes = FIREMODE_AUTO, + Ammo = 8, + Damage = 8, + Pellets = 8, + Spread = 250/60, + SpreadAdd = 150/60, + SpreadAddMax = 20, + + SpreadDecay_Start = 700/60, + SpreadDecay_End = 30, + SpreadDecay_RampTime = 1, + + Reload_MagOut = 0.5, + Reload_MagIn = 1.5, + Reload_MagIn_Bonus1 = 1.2, + Reload_MagIn_Bonus2 = 1.2+0.1, + + Speed_Move = 0.92, + Speed_Aiming = 0.92, + Speed_Reloading = 0.5, + Speed_Firing = 0.334, + Speed_FiringTime = 0.5, + + Features = "firearm", + } + +end + +do -- Rifles + + WEAPONS["fnc"] = { + Name = "FNC PARA", + Description = "Run of the mill automatic assault rifle.", + Type = "rifle", + + Icon = Material( "benny/weapons/fnc.png", "smooth" ), + WModel = "models/weapons/w_rif_ar556.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "FNC.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "FNC.MagOut", + Sound_MagIn = "FNC.MagIn", + Sound_Cock = "FNC.Cock", + + Delay = (60/700), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 30, + Damage = 30, + Spread = 30/60, + SpreadAdd = 22/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 0, + SpreadDecay_End = 12, + SpreadDecay_RampTime = 0.2, + + Reload_MagOut = 0.3, + Reload_MagIn = 1.3, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.1, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.95, + Speed_Firing = 0.95, + + Features = "firearm", + } + + WEAPONS["qbz"] = { + Name = "QBZ-95", + Description = "Bullpup assault rifle. Low profile, great in close quarters.", + Type = "rifle", + + Icon = Material( "benny/weapons/fnc.png", "smooth" ), + WModel = "models/weapons/w_rif_bakm.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "QBBLSW.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "FNC.MagOut", + Sound_MagIn = "FNC.MagIn", + Sound_Cock = "FNC.Cock", + + Delay = (60/800), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 30, + Damage = 28, + Spread = 45/60, + SpreadAdd = 35/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 12, + SpreadDecay_End = 36, + SpreadDecay_RampTime = 0.6, + + Reload_MagOut = 0.4, + Reload_MagIn = 1.5, + Reload_MagIn_Bonus1 = 0.8, + Reload_MagIn_Bonus2 = 0.8+0.1, + + Speed_Move = 0.975, + Speed_Aiming = 0.975, + Speed_Reloading = 0.975, + Speed_Firing = 0.975, + + Features = "firearm", + } + + WEAPONS["m16a2"] = { + Name = "M16A2", + Description = "Burst-fire assault rifle. Precise and effective at range.", + Type = "rifle", + + Icon = Material( "benny/weapons/m16a2.png", "smooth" ), + WModel = "models/weapons/w_rif_m16a2.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, + + Sound_Fire = "M16A2.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "M16A2.MagOut", + Sound_MagIn = "M16A2.MagIn", + Sound_Cock = "M16A2.Cock", + + Delay = (60/700), + Firemodes = { + { Mode = 3 }, + { Mode = 1 }, + }, + Ammo = 30, + Damage = 32, + Spread = 22/60, + SpreadAdd = 11/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 0, + SpreadDecay_End = 12, + SpreadDecay_RampTime = 0.3, + + Reload_MagOut = 0.3, + Reload_MagIn = 1.3, + Reload_MagIn_Bonus1 = 0.6, + Reload_MagIn_Bonus2 = 0.6+0.1, + + Speed_Move = 0.95, + Speed_Aiming = 0.9, + Speed_Reloading = 0.95, + Speed_Firing = 0.9, + + Features = "firearm", + } + +end + +do -- Sniper rifles + + WEAPONS["barrett"] = { + Name = "BARRETT .50c", + Description = "Semi-automatic .50 slinger. Turns people into slushie!", + Type = "sniper", + + Icon = Material( "benny/weapons/m16a2.png", "smooth" ), + WModel = "models/weapons/w_snip_awp.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.1 }, + + Sound_Fire = "Barrett.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "Barrett.MagOut", + Sound_MagIn = "Barrett.MagIn", + Sound_Cock = "Barrett.Cock", + + ShootHolsterTime = 1, + + Delay = (60/140), + Firemodes = FIREMODE_SEMI, + Ammo = 5, + Damage = 99, + Spread = 5/60, + SpreadAdd = 9, + SpreadAddMax = 18, + + SpreadDecay_Start = 4, + SpreadDecay_End = 22, + SpreadDecay_RampTime = 1, + + Reload_MagOut = 0.5, + Reload_MagIn = 1.5, + Reload_MagIn_Bonus1 = 1.0, + Reload_MagIn_Bonus2 = 1.0+0.1, + + Speed_Move = 0.75, + Speed_Aiming = 0.75, + Speed_Reloading = 0.5, + Speed_Firing = 0.334, + Speed_FiringTime = 1, + + Features = "firearm", + } + +end + +do -- Machine guns + + WEAPONS["stoner63"] = { + Name = "STONER 63", + Description = "Box-fed light machine gun that maintains mid-range authority.", + Type = "machinegun", + + WModel = "models/weapons/w_mach_hk21e.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, + + Sound_Fire = "Stoner63.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "M16A2.MagOut", + Sound_MagIn = "M16A2.MagIn", + + Delay = (60/650), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 75, + Damage = 32, + Spread = 26/60, + SpreadAdd = 22/60, + SpreadAddMax = 10, + + SpreadDecay_Start = 4, + SpreadDecay_End = 36, + SpreadDecay_RampTime = 0.6, + + Speed_Move = 0.8, + Speed_Aiming = 0.75, + Speed_Reloading = 0.5, + Speed_Firing = 0.334, + + Features = "firearm", + } + + WEAPONS["qbblsw"] = { + Name = "QBB-LSW-42", + Description = "Bullpup mag-fed light machine gun that excels in close quarters.", + Type = "machinegun", + + WModel = "models/weapons/w_mach_mg36.mdl", + HoldType = "rpg", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, + + Sound_Fire = "QBBLSW.Fire", + Sound_DryFire = "Common.Dryfire.Rifle", + Sound_MagOut = "M16A2.MagOut", + Sound_MagIn = "M16A2.MagIn", + + Delay = (60/850), + Firemodes = FIREMODE_AUTOSEMI, + Ammo = 60, + Damage = 29, + Spread = 36/60, + SpreadAdd = 33/60, + SpreadAddMax = 15, + + SpreadDecay_Start = 6, + SpreadDecay_End = 36, + SpreadDecay_RampTime = 0.4, + + Speed_Move = 0.8, + Speed_Aiming = 0.8, + Speed_Reloading = 0.75, + Speed_Firing = 0.334, + + Features = "firearm", + } + +end + +do -- Grenades, nothing here is guaranteed. + + local function GrenadeFire( self, data, class, hand ) + local p = self:GetOwner() + if self:GetGrenadeDown() then + return true + end + if self:bGetHolsterTime( hand ) > 0 then + return true + end + + self:SetGrenadeDown( true ) + self:SetGrenadeDownStart( CurTime() ) + + return true + end + + local function GrenadeReload( self, data ) + return true + end + + local function GrenadeCreate( self, data ) + -- PROTO: See to getting this done better. Maybe it's spawned while priming the nade for low CL-SV/phys delay? + local p = self:GetOwner() + local class = WeaponGet(data.Class) + local GENT = ents.Create( class.GrenadeEnt ) + GENT:SetOwner( p ) + local ang = p:EyeAngles() + ang.p = ang.p - 5 + GENT:SetPos( p:EyePos() + (ang:Forward()*16) ) + GENT:SetAngles( ang + Angle( 0, 0, -90 ) ) + GENT.Fuse = self:GetGrenadeDownStart() + class.GrenadeFuse + GENT:Spawn() + + local velocity = ang:Forward() * 1500 + velocity:Mul( Lerp( math.TimeFraction( 90, 0, ang.p ), 0, 1 ) ) + -- velocity:Add( p:EyeAngles():Up() * 500 * Lerp( math.TimeFraction( 0, -90, p:EyeAngles().p ), 0, 1 ) ) + + GENT:GetPhysicsObject():SetVelocity( velocity ) + end + + local function GrenadeThrow( self, data ) + local p = self:GetOwner() + local class = WeaponGet(data.Class) + self:SetGrenadeDown( false ) + -- TEMP: Do this right! + if !class.GrenadeCharge then self:SetGrenadeDownStart( CurTime() ) end + -- + local hand = (self:BTable( true ) and self:BTable( true ).Class == data.Class) or false + self:TPFire( hand ) + if SERVER then GrenadeCreate( self, data ) end + local id = self:bGetInvID( hand ) + self:BHolster( hand ) + + if SERVER or (CLIENT and IsFirstTimePredicted()) then + p:INV_Discard( id ) + end + + -- local subsequent = p:INV_Find( data.Class )[1] + -- if subsequent then + -- self:BDeploy( hand, subsequent ) + -- end + end + + local function GrenadeThink( self, data, class, hand ) + local p = self:GetOwner() + local class = WeaponGet(data.Class) + if self:GetGrenadeDown() then + if true or ( CurTime() >= (self:GetGrenadeDownStart() + class.GrenadeFuse) ) then + GrenadeThrow( self, data ) + end + end + return true + end + + local function GrenadeHolster( self, data ) + if self:GetGrenadeDown() then + GrenadeThrow( self, data ) + end + return true + end + + WEAPONS["g_frag"] = { + Name = "FRAG GRENADE", + Description = "Pull the pin and throw it the hell away!", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_frag", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_fraggrenade.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_semtex"] = { + Name = "SEMTEX GRENADE", + Description = "Long, audible fuse, but sticks to whatever it touches.", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_semtex", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_molotov"] = { + Name = "MOLOTOV COCKTAIL", + Description = "Alcoholic bottle of flame!", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_molotov", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_tknife"] = { + Name = "THROWING KNIFE", + Description = "Lightweight knife to throw and pick back up.", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_tknife", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_smoke"] = { + Name = "SMOKE GRENADE", + Description = "Smoke bomb used to conceal a position, and makes enemies cough.", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_smoke", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_flashbang"] = { + Name = "FLASHBANG", + Description = "Stun grenade that gives off a bright flash and a loud 'bang'.", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_flashbang", + GrenadeFuse = 2, + GrenadeCharge = false, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + + WEAPONS["g_prox"] = { + Name = "PROXIMITY MINE", + Description = "Mine that bounces into the air.", + Type = "grenade", + + Custom_Fire = GrenadeFire, + Custom_Reload = GrenadeReload, + Custom_Think = GrenadeThink, + Custom_Holster = GrenadeHolster, + GrenadeEnt = "benny_grenade_prox", + GrenadeFuse = 4, + GrenadeCharge = true, + + WModel = "models/weapons/w_eq_flashbang.mdl", + HoldType = "grenade", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, + + Features = "grenade", + } + +end + +do -- Equipment, nothing here is guaranteed. + + WEAPONS["e_medkit"] = { + Name = "MEDKIT", + Description = "Station that regenerates a portion of health.", + Type = "equipment", + + WModel = "models/weapons/w_eq_flashbang.mdl", + + Features = "grenade", + } + + WEAPONS["e_ammo"] = { + Name = "AMMO CRATE", + Description = "Station that replenishes ammo.", + Type = "equipment", + + WModel = "models/weapons/w_eq_flashbang.mdl", + + Features = "grenade", + } + +end + +-- Ammo generator + +for class, data in SortedPairs( WEAPONS ) do + if data.Features == "firearm" then + WEAPONS["mag_" .. class] = { + Name = "MAG: " .. WEAPONS[class].Name, + Description = "Magazine for the " .. WEAPONS[class].Name .. ".", + Type = "magazine", + + WModel = "models/weapons/w_pist_glock18.mdl", + HoldType = "slam", + + Ammo = WEAPONS[class].Ammo, + + Features = "magazine", + } + end +end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua b/gamemodes/benny/gamemode/modules/weapons/_sh_weapons_forlater.lua similarity index 100% rename from gamemodes/benny/gamemode/modules/weapons/sh_weapons_forlater.lua rename to gamemodes/benny/gamemode/modules/weapons/_sh_weapons_forlater.lua diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua index 785d225..feb2ebb 100644 --- a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua +++ b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua @@ -1,176 +1,16 @@ -FIREMODE_AUTO = { - { Mode = math.huge }, -} -FIREMODE_AUTOSEMI = { - { Mode = math.huge }, - { Mode = 1 }, -} -FIREMODE_SEMI = { - { Mode = 1 }, -} -WEAPONS = {} - -function WeaponGet( classname ) - return WEAPONS[ classname ] -end do -- Sound definitions - AddSound( "1911.Fire", { - "benny/weapons/1911/01.ogg", - "benny/weapons/1911/02.ogg", - "benny/weapons/1911/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "Bizon.Fire", { - "benny/weapons/bizon/01.ogg", - "benny/weapons/bizon/02.ogg", - "benny/weapons/bizon/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "MP5K.Fire", { - "benny/weapons/mp5k/01.ogg", - "benny/weapons/mp5k/02.ogg", - "benny/weapons/mp5k/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "MAC11.Fire", { - "benny/weapons/mac11/01.ogg", - "benny/weapons/mac11/02.ogg", - "benny/weapons/mac11/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "MP7.Fire", { - "benny/weapons/mp7/01.ogg", - "benny/weapons/mp7/02.ogg", - "benny/weapons/mp7/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "TMP.Fire", { - "benny/weapons/tmp/01.ogg", - "benny/weapons/tmp/02.ogg", - "benny/weapons/tmp/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - AddSound( "Anaconda.Fire", { "benny/weapons/anaconda/01.ogg", "benny/weapons/anaconda/02.ogg", "benny/weapons/anaconda/03.ogg", }, 140, 100, 0.5, CHAN_STATIC ) - AddSound( "Nambu.Fire", { - "benny/weapons/nambu/01.ogg", - "benny/weapons/nambu/02.ogg", - "benny/weapons/nambu/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "USP.Fire", { - "benny/weapons/usp/01.ogg", - "benny/weapons/usp/02.ogg", - "benny/weapons/usp/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "Glock.Fire", { - "benny/weapons/glock/01.ogg", - "benny/weapons/glock/02.ogg", - "benny/weapons/glock/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "M92.Fire", { - "benny/weapons/m92/01.ogg", - "benny/weapons/m92/02.ogg", - "benny/weapons/m92/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "P226.Fire", { - "benny/weapons/p226/01.ogg", - "benny/weapons/p226/02.ogg", - "benny/weapons/p226/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "M16A2.Fire", { - "benny/weapons/m16a2/01.ogg", - "benny/weapons/m16a2/02.ogg", - "benny/weapons/m16a2/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "FNC.Fire", { - "benny/weapons/fnc/01.ogg", - "benny/weapons/fnc/02.ogg", - "benny/weapons/fnc/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "AA12.Fire", "benny/weapons/aa12/01.ogg", 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "SPAS12.Fire", { - "benny/weapons/spas12/01.ogg", - "benny/weapons/spas12/02.ogg", - "benny/weapons/spas12/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "QBBLSW.Fire", { - "benny/weapons/qbblsw/fire-01.ogg", - "benny/weapons/qbblsw/fire-02.ogg", - "benny/weapons/qbblsw/fire-03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "Stoner63.Fire", { - "benny/weapons/stoner63/01.ogg", - "benny/weapons/stoner63/02.ogg", - "benny/weapons/stoner63/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "Barrett.Fire", { - "benny/weapons/barrett/fire-01.ogg", - "benny/weapons/barrett/fire-02.ogg", - "benny/weapons/barrett/fire-03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - AddSound( "MP5K.MagOut", "benny/weapons/mp5k/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MP5K.MagIn", "benny/weapons/mp5k/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MP5K.Cock", "benny/weapons/mp5k/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MAC11.MagOut", "benny/weapons/mac11/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MAC11.MagIn", "benny/weapons/mac11/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MP7.MagOut", "benny/weapons/mp7/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "MP7.MagIn", "benny/weapons/mp7/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "TMP.MagOut", "benny/weapons/tmp/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "TMP.MagIn", "benny/weapons/tmp/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Bizon.MagOut", "benny/weapons/bizon/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Bizon.MagIn", "benny/weapons/bizon/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Anaconda.MagOut", "benny/weapons/anaconda/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Anaconda.MagIn", "benny/weapons/anaconda/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Nambu.MagOut", "benny/weapons/nambu/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Nambu.MagIn", "benny/weapons/nambu/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "P226.MagOut", "benny/weapons/p226/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "P226.MagIn", "benny/weapons/p226/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "M92.MagOut", "benny/weapons/m92/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "M92.MagIn", "benny/weapons/m92/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "1911.MagOut", "benny/weapons/1911/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "1911.MagIn", "benny/weapons/1911/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "USP.MagOut", "benny/weapons/usp/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "USP.MagIn", "benny/weapons/usp/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Glock.MagOut", "benny/weapons/glock/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Glock.MagIn", "benny/weapons/glock/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Glock.Cock", "benny/weapons/glock/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Deagle.Cock", "benny/weapons/deagle/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "M16A2.MagOut", "benny/weapons/m16a2/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "M16A2.MagIn", "benny/weapons/m16a2/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "M16A2.Cock", "benny/weapons/m16a2/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "FNC.MagOut", "benny/weapons/fnc/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "FNC.MagIn", "benny/weapons/fnc/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "FNC.Cock", "benny/weapons/fnc/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Barrett.MagOut", "benny/weapons/barrett/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Barrett.MagIn", "benny/weapons/barrett/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "Barrett.Cock", "benny/weapons/barrett/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "AA12.MagOut", "benny/weapons/aa12/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "AA12.MagIn", "benny/weapons/aa12/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "SPAS12.MagOut", { - "benny/weapons/spas12/magout-01.ogg", - "benny/weapons/spas12/magout-02.ogg", - "benny/weapons/spas12/magout-03.ogg", - }, 70, 100, 0.5, CHAN_STATIC ) - AddSound( "SPAS12.MagIn", "benny/weapons/spas12/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Common.Unload", "benny/weapons/unload.ogg", 70, 100, 0.5, CHAN_STATIC ) AddSound( "Common.Dryfire.Pistol", "benny/weapons/common/06-13.ogg", 70, 100, 0.5, CHAN_STATIC ) @@ -182,1371 +22,144 @@ do -- Sound definitions end -do -- Toolgun +ItemDef("base", { + Name = "Base Item", + Type = "base", + Description = "Base of everything", - local ToolGunTools = { - ["ammocrate"] = function( self, p, tr ) - if SERVER then - local summon = ents.Create( "benny_equipment_ammo" ) - summon:SetPos( tr.HitPos + tr.HitNormal ) - summon:Spawn() - end - end, - ["summon_human"] = function( self, p, tr ) - if SERVER then - local summon = ents.Create( "benny_npc_human" ) - summon:SetPos( tr.HitPos + tr.HitNormal ) - local ang = Angle( 0, p:EyeAngles().y+0, 0 ) - summon:SetAngles( ang ) - summon:Spawn() - end - end, - ["remover"] = function( self, p, tr ) - if SERVER then - local ent = tr.Entity - if IsValid( ent ) then - ent:Remove() - return - end - end - end, - } - local function CreateSelect() - local Frame = vgui.Create( "DFrame" ) - Frame:SetSize( 300, 85 ) - Frame:SetTitle( "Toolgun Select" ) - Frame:Center() - Frame:MakePopup() + WModel = "models/weapons/w_357.mdl", - local Text = Frame:Add( "DLabel" ) - Text:Dock( TOP ) - Text:DockMargin( 10, 0, 10, 0 ) - Text:SetText( "Select a tool." ) + Func_Attack = function( self, hand ) + end, - local List = Frame:Add( "DComboBox" ) - List:Dock( TOP ) - List:SetValue(GetConVar("benny_wep_toolgun"):GetString()) - List:DockMargin( 10, 0, 10, 0 ) - for i, v in SortedPairs( ToolGunTools ) do - List:AddChoice( i ) - end - List.OnSelect = function( self, index, value ) - RunConsoleCommand( "benny_wep_toolgun", value ) - Frame:Remove() - end - end - WEAPONS["toolgun"] = { - Name = "TOOL GUN", - Description = "Developer development device. Hold ALT for Remover", - Type = "special", + Func_Attack2 = function( self, hand ) + end, - WModel = "models/weapons/w_toolgun.mdl", - HoldType = "revolver", - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + Func_Reload = function( self, hand ) + end, - Delay = (60/300), - Firemodes = FIREMODE_SEMI, + Func_Deploy = function( self, hand ) + end, - Custom_Fire = function( self, data ) - if self:GetDelay1() > CurTime() then - return true - end - self:SetDelay1( CurTime() + 0.2 ) - - local p = self:GetOwner() - - local tr = p:GetEyeTrace() - local tool = p:KeyDown( IN_WALK ) and "remover" or p:GetInfo( "benny_wep_toolgun" ) - if ToolGunTools[tool] then ToolGunTools[tool]( self, p, tr ) else return true end - - if CLIENT and IsFirstTimePredicted() then - local vStart = self:GetAttachment( 1 ).Pos - local vPoint = tr.HitPos - local effectdata = EffectData() - effectdata:SetStart( vStart ) - effectdata:SetOrigin( vPoint ) - util.Effect( "ToolTracer", effectdata ) - end - - -- Return true to skip weapon logic - return true - end, - - Custom_Reload = function( self, data ) - if CLIENT then - CreateSelect() - end - - -- Return true to skip weapon logic - return true - end, + Func_HolsterStart = function( self, hand ) + end, - Features = "firearm", - } + Func_HolsterFinish = function( self, hand ) + end, +}) - - WEAPONS["camera"] = { - Name = "CAMERA", - Description = "Developer development device", - Type = "special", +ItemDef("base_firearm", { + Name = "Base Firearm", + Type = "base", + Base = "base", + Description = "Base for firearms", + Features = "firearm", - WModel = "models/maxofs2d/camera.mdl", - HoldType = "camera", - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + WModel = "models/weapons/w_pistol.mdl", + HoldType = "pistol", - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - - Custom_Fire = function( self, data ) - if self:GetDelay1() > CurTime() then - return true - end - self:SetDelay1( CurTime() + 0.2 ) - - local p = self:GetOwner() - - if CLIENT and IsFirstTimePredicted() then - local zp, za, zf = p:EyePos(), p:EyeAngles(), 90 - RunConsoleCommand( "benny_cam_override", zp.x .. " " .. zp.y .. " " .. zp.z .. " " .. za.p .. " " .. za.y .. " " .. za.r .. " " .. zf ) - end - - -- Return true to skip weapon logic - return true - end, - - Custom_Reload = function( self, data ) - RunConsoleCommand( "benny_cam_override", "" ) - - -- Return true to skip weapon logic - return true - end, - - Custom_DisableSpecialMovement = function( self, data ) - -- Return true to skip weapon logic - if self:GetUserAim() then - return true - end - end, - - Custom_CalcView = function( self, data ) - if self:GetUserAim() and GetConVar("benny_cam_override"):GetString() == "" then - data.drawviewer = false - data.origin = self:GetOwner():EyePos() - data.angles = self:GetOwner():EyeAngles() - return true -- Return true to halt - end - - end, - - Features = "firearm", - } -end - -do -- Melee - - WEAPONS["melee_bat"] = { - Name = "BAT", - Description = "Aluminum bat. Home run!", - Type = "melee", - - WModel = "models/weapons/w_crowbar.mdl", - HoldType = "melee2", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 0, - Damage = 0, - - Features = "melee", - } - - WEAPONS["melee_baton"] = { - Name = "BATON", - Description = "Weighty beating stick.", - Type = "melee", - - WModel = "models/weapons/w_eq_tonfa.mdl", - HoldType = "knife", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 0, - Damage = 0, - - Features = "melee", - } - - WEAPONS["melee_knife"] = { - Name = "KNIFE", - Description = "Makes for a great entrée and dessert.", - Type = "melee", - - WModel = "models/weapons/w_knife_ct.mdl", - HoldType = "knife", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 0, - Damage = 0, - - Features = "melee", - } - - WEAPONS["melee_machete"] = { - Name = "MACHETE", - Description = "Cut up foliage and people!", - Type = "melee", - - WModel = "models/props_canal/mattpipe.mdl", - HoldType = "melee2", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 0, - Damage = 0, - - Features = "melee", - } - -end - -do -- Handguns - - WEAPONS["1911"] = { - Name = "COBRA .45", - Description = "Hits hard. They don't make them like they used to!", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_colt.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "1911.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_Reload = "1911.Reload", - Sound_MagOut = "1911.MagOut", - Sound_MagIn = "1911.MagIn", - Sound_Cock = "Glock.Cock", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 8, - Damage = 30, - Spread = 22/60, - SpreadAdd = 0.5, - SpreadAddMax = 15, - - SpreadDecay_Start = 3, - SpreadDecay_End = 11, - SpreadDecay_RampTime = 0.5, - - Reload_MagOut = 0.1, - Reload_MagIn = 0.75, - Reload_MagIn_Bonus1 = 0.4, - Reload_MagIn_Bonus2 = 0.4+0.15, - - Speed_Move = 1, - Speed_Aiming = 0.98, - Speed_Reloading = 1, - Speed_Firing = 1, - - Features = "firearm", - } - - WEAPONS["usp"] = { - Name = "MK. 23", - Description = "If it works for hardasses around the world, it'll work for you.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_usp.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "USP.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_Reload = "USP.Reload", - Sound_MagOut = "USP.MagOut", - Sound_MagIn = "USP.MagIn", - Sound_Cock = "Glock.Cock", - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - Ammo = 12, - Damage = 32, - Spread = 15/60, - SpreadAdd = 0.4, - SpreadAddMax = 15, - - SpreadDecay_Start = 3, - SpreadDecay_End = 11, - SpreadDecay_RampTime = 0.5, - - Reload_MagOut = 0.15, - Reload_MagIn = 0.85, - Reload_MagIn_Bonus1 = 0.5, - Reload_MagIn_Bonus2 = 0.5+0.12, - - Speed_Move = 1, - Speed_Aiming = 0.98, - Speed_Reloading = 1, - Speed_Firing = 1, - - Features = "firearm", - } - - WEAPONS["glock"] = { - Name = "GLOCK-18", - Description = "Bullet storm. Lasts about a second or so, just like you!", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_glock18.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.25 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "Glock.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_MagOut = "Glock.MagOut", - Sound_MagIn = "Glock.MagIn", - Sound_Cock = "Glock.Cock", - - Delay = (60/900), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 17, - Damage = 22, - Spread = 60/60, - SpreadAdd = 0.8, - SpreadAddMax = 15, - - SpreadDecay_Start = 3, - SpreadDecay_End = 11, - SpreadDecay_RampTime = 0.5, - - Reload_MagOut = 0.25, - Reload_MagIn = 1.1, - Reload_MagIn_Bonus1 = 0.8, - Reload_MagIn_Bonus2 = 0.8+0.08, - - Speed_Move = 1, - Speed_Aiming = 0.95, - Speed_Reloading = 0.95, - Speed_Firing = 0.95, - - Features = "firearm", - } - - WEAPONS["nambu"] = { - Name = "NAMBU .38", - Description = "Eastern revolver that hits as hard as it costs.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_derringer.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "Nambu.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_MagOut = "Nambu.MagOut", - Sound_MagIn = "Nambu.MagIn", - Sound_Cock = "Glock.Cock", - - Delay = (60/180), - Firemodes = FIREMODE_SEMI, - Ammo = 6, - Damage = 36, - Spread = 30/60, - SpreadAdd = 1.5, - SpreadAddMax = 15, - - SpreadDecay_Start = 3, - SpreadDecay_End = 11, - SpreadDecay_RampTime = 0.5, - - Reload_MagOut = 0.5, - Reload_MagIn = 0.5, - Reload_MagIn_Bonus1 = 0.2, - Reload_MagIn_Bonus2 = 0.2+0.1, - - Speed_Move = 1, - Speed_Aiming = 1, - Speed_Reloading = 0.9, - Speed_Firing = 1, - - Features = "firearm", - } - - WEAPONS["anaconda"] = { - Name = "ANACONDA", - Description = "Precise and kicks like a mule.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_357.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.1 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "Anaconda.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_MagOut = "Anaconda.MagOut", - Sound_MagIn = "Anaconda.MagIn", - Sound_Cock = "Glock.Cock", - - Delay = (60/180), - Firemodes = FIREMODE_SEMI, - Ammo = 6, - Damage = 55, - Spread = 30/60, - SpreadAdd = 6, - SpreadAddMax = 15, - - SpreadDecay_Start = 6, - SpreadDecay_End = 22, - SpreadDecay_RampTime = 0.65, - - Reload_MagOut = 0.6, - Reload_MagIn = 0.6, - Reload_MagIn_Bonus1 = 0.18, - Reload_MagIn_Bonus2 = 0.18+0.08, - - Speed_Move = 1.0, - Speed_Aiming = 0.95, - Speed_Reloading = 0.9, - Speed_Firing = 0.95, - - Features = "firearm", - } - - WEAPONS["deagle"] = { - Name = "DEAGLE", - Description = "Autoloading .50 caliber pistol.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_deagle.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "Anaconda.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_MagOut = "Anaconda.MagOut", - Sound_MagIn = "Anaconda.MagIn", - Sound_Cock = "Deagle.Cock", - - Delay = (60/180), - Firemodes = FIREMODE_SEMI, - Ammo = 7, - Damage = 47, - Spread = 30/60, - SpreadAdd = 4, - SpreadAddMax = 15, - - SpreadDecay_Start = 8, - SpreadDecay_End = 25, - SpreadDecay_RampTime = 0.5, - - Speed_Move = 0.95, - Speed_Aiming = 0.95, - Speed_Reloading = 0.95, - Speed_Firing = 0.95, - Speed_FiringTime = 0.5, - - Features = "firearm", - } - -end - -do -- SMGs & PDWs - - WEAPONS["tmp"] = { - Name = "TMP", - Description = "Small, compact, and favored by private security.", - Type = "smg", - - WModel = "models/weapons/w_smg_tmp_us.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "TMP.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "TMP.Reload", - Sound_MagOut = "TMP.MagOut", - Sound_MagIn = "TMP.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/650), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 15, - Damage = 22, - Spread = 20/60, - SpreadAdd = 10/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 4, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.4, - - Speed_Move = 0.97, - Speed_Aiming = 0.97, - Speed_Reloading = 0.97, - Speed_Firing = 0.97, - - Features = "firearm", - } - - WEAPONS["mp7"] = { - Name = "MP7", - Description = "Small, pistol-sized, goes through kevlar like a knife.", - Type = "smg", - - WModel = "models/weapons/w_smg1.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "MP7.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "MP7.Reload", - Sound_MagOut = "MP7.MagOut", - Sound_MagIn = "MP7.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/900), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 20, - Damage = 19, - Spread = 20/60, - SpreadAdd = 20/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 2, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.2, - - Speed_Move = 0.97, - Speed_Aiming = 0.97, - Speed_Reloading = 0.97, - Speed_Firing = 0.97, - - Features = "firearm", - } - - WEAPONS["mp5k"] = { - Name = "MP5K", - Description = "Quality manufacturing, but a cumbersome reload.", - Type = "smg", - - WModel = "models/weapons/w_smg_mp5k.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "MP5K.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "MP5K.Reload", - Sound_MagOut = "MP5K.MagOut", - Sound_MagIn = "MP5K.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/750), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 15, - Damage = 22, - Spread = 20/60, - SpreadAdd = 10/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 3, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.3, - - Speed_Move = 0.97, - Speed_Aiming = 0.97, - Speed_Reloading = 0.97, - Speed_Firing = 0.97, - - Features = "firearm", - } - - WEAPONS["mac11"] = { - Name = "MAC-11", - Description = "More fit for combat in a phone booth.", - Type = "smg", - - WModel = "models/weapons/w_smg_mac10.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.1 }, - - Sound_Fire = "MAC11.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "MAC11.Reload", - Sound_MagOut = "MAC11.MagOut", - Sound_MagIn = "MAC11.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/1400), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 16, - Damage = 19, - Spread = 60/60, - SpreadAdd = 30/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 10, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.3, - - Speed_Move = 0.97, - Speed_Aiming = 0.97, - Speed_Reloading = 0.97, - Speed_Firing = 0.97, - - Features = "firearm", - } - - WEAPONS["bizon"] = { - Name = "BIZON", - Description = "Unwieldy bullet storm.", - Type = "smg", - - WModel = "models/weapons/w_smg_bizon.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.34 }, - - Sound_Fire = "Bizon.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "Bizon.Reload", - Sound_MagOut = "Bizon.MagOut", - Sound_MagIn = "Bizon.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/700), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 40, - Damage = 20, - Spread = 40/60, - SpreadAdd = 10/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 1, - SpreadDecay_End = 10, - SpreadDecay_RampTime = 0.6, - - Speed_Move = 0.94, - Speed_Aiming = 0.94, - Speed_Reloading = 0.93, - Speed_Firing = 0.93, - - Features = "firearm", - } - - WEAPONS["chicom"] = { - Name = "QCW-CQB-21", - Description = "Subsonic bullpup SMG.", - Type = "smg", - - WModel = "models/weapons/w_rif_famas.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.34 }, - - Sound_Fire = "M92.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_Reload = "Bizon.Reload", - Sound_MagOut = "Bizon.MagOut", - Sound_MagIn = "Bizon.MagIn", - Sound_Cock = "MP5K.Cock", - - Delay = (60/1050), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 36, - Damage = 18, - Spread = 40/60, - SpreadAdd = 33/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 4, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.7, - - Speed_Move = 0.95, - Speed_Aiming = 0.95, - Speed_Reloading = 0.94, - Speed_Firing = 0.94, - - Features = "firearm", - } - -end - -do -- Shotguns - - WEAPONS["spas12"] = { - Name = "SPAS-12", - Description = "Heavy metal pump-action shotgun.", - Type = "shotgun", - - WModel = "models/weapons/w_shotgun.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - - Sound_Fire = "SPAS12.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "SPAS12.MagOut", - Sound_MagIn = "SPAS12.MagIn", - - Delay = (60/120), - Firemodes = FIREMODE_SEMI, - Ammo = 8, - Damage = 10, - Pellets = 8, - Spread = 150/60, - SpreadAdd = 150/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 2, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.7, - - Speed_Move = 0.93, - Speed_Aiming = 0.95, - Speed_Reloading = 0.85, - Speed_Firing = 0.75, - - Features = "firearm", - } - - WEAPONS["doublebarrel"] = { - Name = "D/B", - Description = "Pocket-sized double-barrelled rocket of fun!", - Type = "shotgun", - - WModel = "models/weapons/w_shot_shorty.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - - Sound_Fire = "SPAS12.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "SPAS12.MagOut", - Sound_MagIn = "SPAS12.MagIn", - - Delay = (60/120), - Firemodes = FIREMODE_SEMI, - Ammo = 2, - Damage = 10, - Pellets = 8, - Spread = 300/60, - SpreadAdd = 150/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 10, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.5, - - Speed_Move = 0.95, - Speed_Aiming = 0.95, - Speed_Reloading = 0.9, - Speed_Firing = 0.9, - - Features = "firearm", - } - - WEAPONS["overunder"] = { - Name = "O/U", - Description = "Full-length double-barrelled bar fight finisher.", - Type = "shotgun", - - WModel = "models/weapons/w_shot_kozlice.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - - Sound_Fire = "SPAS12.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "SPAS12.MagOut", - Sound_MagIn = "SPAS12.MagIn", - - Delay = (60/120), - Firemodes = FIREMODE_SEMI, - Ammo = 2, - Damage = 10, - Pellets = 8, - Spread = 130/60, - SpreadAdd = 130/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 10, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 0.5, - - Speed_Move = 0.93, - Speed_Aiming = 0.95, - Speed_Reloading = 0.85, - Speed_Firing = 0.85, - - Features = "firearm", - } - - WEAPONS["aa12"] = { - Name = "AA-12", - Description = "Magazine fed powerhouse.", - Type = "shotgun", - - WModel = "models/weapons/w_shot_br99.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, - - Sound_Fire = "AA12.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "AA12.MagOut", - Sound_MagIn = "AA12.MagIn", - - Delay = (60/180), - Firemodes = FIREMODE_AUTO, - Ammo = 8, - Damage = 8, - Pellets = 8, - Spread = 250/60, - SpreadAdd = 150/60, - SpreadAddMax = 20, - - SpreadDecay_Start = 700/60, - SpreadDecay_End = 30, - SpreadDecay_RampTime = 1, - - Reload_MagOut = 0.5, - Reload_MagIn = 1.5, - Reload_MagIn_Bonus1 = 1.2, - Reload_MagIn_Bonus2 = 1.2+0.1, - - Speed_Move = 0.92, - Speed_Aiming = 0.92, - Speed_Reloading = 0.5, - Speed_Firing = 0.334, - Speed_FiringTime = 0.5, - - Features = "firearm", - } - -end - -do -- Rifles - - WEAPONS["fnc"] = { - Name = "FNC PARA", - Description = "Run of the mill automatic assault rifle.", - Type = "rifle", - - Icon = Material( "benny/weapons/fnc.png", "smooth" ), - WModel = "models/weapons/w_rif_ar556.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "FNC.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "FNC.MagOut", - Sound_MagIn = "FNC.MagIn", - Sound_Cock = "FNC.Cock", - - Delay = (60/700), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 30, - Damage = 30, - Spread = 30/60, - SpreadAdd = 22/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 0, - SpreadDecay_End = 12, - SpreadDecay_RampTime = 0.2, - - Reload_MagOut = 0.3, - Reload_MagIn = 1.3, - Reload_MagIn_Bonus1 = 0.8, - Reload_MagIn_Bonus2 = 0.8+0.1, - - Speed_Move = 0.95, - Speed_Aiming = 0.95, - Speed_Reloading = 0.95, - Speed_Firing = 0.95, - - Features = "firearm", - } - - WEAPONS["qbz"] = { - Name = "QBZ-95", - Description = "Bullpup assault rifle. Low profile, great in close quarters.", - Type = "rifle", - - Icon = Material( "benny/weapons/fnc.png", "smooth" ), - WModel = "models/weapons/w_rif_bakm.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "QBBLSW.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "FNC.MagOut", - Sound_MagIn = "FNC.MagIn", - Sound_Cock = "FNC.Cock", - - Delay = (60/800), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 30, - Damage = 28, - Spread = 45/60, - SpreadAdd = 35/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 12, - SpreadDecay_End = 36, - SpreadDecay_RampTime = 0.6, - - Reload_MagOut = 0.4, - Reload_MagIn = 1.5, - Reload_MagIn_Bonus1 = 0.8, - Reload_MagIn_Bonus2 = 0.8+0.1, - - Speed_Move = 0.975, - Speed_Aiming = 0.975, - Speed_Reloading = 0.975, - Speed_Firing = 0.975, - - Features = "firearm", - } - - WEAPONS["m16a2"] = { - Name = "M16A2", - Description = "Burst-fire assault rifle. Precise and effective at range.", - Type = "rifle", - - Icon = Material( "benny/weapons/m16a2.png", "smooth" ), - WModel = "models/weapons/w_rif_m16a2.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.3 }, - - Sound_Fire = "M16A2.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "M16A2.MagOut", - Sound_MagIn = "M16A2.MagIn", - Sound_Cock = "M16A2.Cock", - - Delay = (60/700), - Firemodes = { - { Mode = 3 }, - { Mode = 1 }, + -- Firearm specific + Firemodes = { + { + Mode = 1, }, - Ammo = 30, - Damage = 32, - Spread = 22/60, - SpreadAdd = 11/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 0, - SpreadDecay_End = 12, - SpreadDecay_RampTime = 0.3, - - Reload_MagOut = 0.3, - Reload_MagIn = 1.3, - Reload_MagIn_Bonus1 = 0.6, - Reload_MagIn_Bonus2 = 0.6+0.1, - - Speed_Move = 0.95, - Speed_Aiming = 0.9, - Speed_Reloading = 0.95, - Speed_Firing = 0.9, - - Features = "firearm", - } - -end - -do -- Sniper rifles - - WEAPONS["barrett"] = { - Name = "BARRETT .50c", - Description = "Semi-automatic .50 slinger. Turns people into slushie!", - Type = "sniper", - - Icon = Material( "benny/weapons/m16a2.png", "smooth" ), - WModel = "models/weapons/w_snip_awp.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.1 }, - - Sound_Fire = "Barrett.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "Barrett.MagOut", - Sound_MagIn = "Barrett.MagIn", - Sound_Cock = "Barrett.Cock", - - ShootHolsterTime = 1, - - Delay = (60/140), - Firemodes = FIREMODE_SEMI, - Ammo = 5, - Damage = 99, - Spread = 5/60, - SpreadAdd = 9, - SpreadAddMax = 18, - - SpreadDecay_Start = 4, - SpreadDecay_End = 22, - SpreadDecay_RampTime = 1, - - Reload_MagOut = 0.5, - Reload_MagIn = 1.5, - Reload_MagIn_Bonus1 = 1.0, - Reload_MagIn_Bonus2 = 1.0+0.1, - - Speed_Move = 0.75, - Speed_Aiming = 0.75, - Speed_Reloading = 0.5, - Speed_Firing = 0.334, - Speed_FiringTime = 1, - - Features = "firearm", - } - -end - -do -- Machine guns - - WEAPONS["stoner63"] = { - Name = "STONER 63", - Description = "Box-fed light machine gun that maintains mid-range authority.", - Type = "machinegun", - - WModel = "models/weapons/w_mach_hk21e.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, - - Sound_Fire = "Stoner63.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "M16A2.MagOut", - Sound_MagIn = "M16A2.MagIn", - - Delay = (60/650), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 75, - Damage = 32, - Spread = 26/60, - SpreadAdd = 22/60, - SpreadAddMax = 10, - - SpreadDecay_Start = 4, - SpreadDecay_End = 36, - SpreadDecay_RampTime = 0.6, - - Speed_Move = 0.8, - Speed_Aiming = 0.75, - Speed_Reloading = 0.5, - Speed_Firing = 0.334, - - Features = "firearm", - } - - WEAPONS["qbblsw"] = { - Name = "QBB-LSW-42", - Description = "Bullpup mag-fed light machine gun that excels in close quarters.", - Type = "machinegun", - - WModel = "models/weapons/w_mach_mg36.mdl", - HoldType = "rpg", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_REVOLVER, 0.3 }, - - Sound_Fire = "QBBLSW.Fire", - Sound_DryFire = "Common.Dryfire.Rifle", - Sound_MagOut = "M16A2.MagOut", - Sound_MagIn = "M16A2.MagIn", - - Delay = (60/850), - Firemodes = FIREMODE_AUTOSEMI, - Ammo = 60, - Damage = 29, - Spread = 36/60, - SpreadAdd = 33/60, - SpreadAddMax = 15, - - SpreadDecay_Start = 6, - SpreadDecay_End = 36, - SpreadDecay_RampTime = 0.4, - - Speed_Move = 0.8, - Speed_Aiming = 0.8, - Speed_Reloading = 0.75, - Speed_Firing = 0.334, - - Features = "firearm", - } - -end - -do -- Grenades, nothing here is guaranteed. - - local function GrenadeFire( self, data, class, hand ) - local p = self:GetOwner() - if self:GetGrenadeDown() then - return true - end - if self:D_GetHolstering( hand ) > 0 then - return true - end - - self:SetGrenadeDown( true ) - self:SetGrenadeDownStart( CurTime() ) - - return true - end - - local function GrenadeReload( self, data ) - return true - end - - local function GrenadeCreate( self, data ) - -- PROTO: See to getting this done better. Maybe it's spawned while priming the nade for low CL-SV/phys delay? - local p = self:GetOwner() - local class = WeaponGet(data.Class) - local GENT = ents.Create( class.GrenadeEnt ) - GENT:SetOwner( p ) - local ang = p:EyeAngles() - ang.p = ang.p - 5 - GENT:SetPos( p:EyePos() + (ang:Forward()*16) ) - GENT:SetAngles( ang + Angle( 0, 0, -90 ) ) - GENT.Fuse = self:GetGrenadeDownStart() + class.GrenadeFuse - GENT:Spawn() - - local velocity = ang:Forward() * 1500 - velocity:Mul( Lerp( math.TimeFraction( 90, 0, ang.p ), 0, 1 ) ) - -- velocity:Add( p:EyeAngles():Up() * 500 * Lerp( math.TimeFraction( 0, -90, p:EyeAngles().p ), 0, 1 ) ) - - GENT:GetPhysicsObject():SetVelocity( velocity ) - end - - local function GrenadeThrow( self, data ) - local p = self:GetOwner() - local class = WeaponGet(data.Class) - self:SetGrenadeDown( false ) - -- TEMP: Do this right! - if !class.GrenadeCharge then self:SetGrenadeDownStart( CurTime() ) end - -- - local hand = (self:BTable( true ) and self:BTable( true ).Class == data.Class) or false - self:TPFire( hand ) - if SERVER then GrenadeCreate( self, data ) end - local id = self:D_GetID( hand ) - self:BHolster( hand ) - - if SERVER or (CLIENT and IsFirstTimePredicted()) then - p:INV_Discard( id ) - end - - -- local subsequent = p:INV_Find( data.Class )[1] - -- if subsequent then - -- self:BDeploy( hand, subsequent ) - -- end - end - - local function GrenadeThink( self, data, class, hand ) - local p = self:GetOwner() - local class = WeaponGet(data.Class) - if self:GetGrenadeDown() then - if true or ( CurTime() >= (self:GetGrenadeDownStart() + class.GrenadeFuse) ) then - GrenadeThrow( self, data ) - end - end - return true - end - - local function GrenadeHolster( self, data ) - if self:GetGrenadeDown() then - GrenadeThrow( self, data ) - end - return true - end - - WEAPONS["g_frag"] = { - Name = "FRAG GRENADE", - Description = "Pull the pin and throw it the hell away!", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_frag", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_fraggrenade.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_semtex"] = { - Name = "SEMTEX GRENADE", - Description = "Long, audible fuse, but sticks to whatever it touches.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_semtex", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_molotov"] = { - Name = "MOLOTOV COCKTAIL", - Description = "Alcoholic bottle of flame!", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_molotov", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_tknife"] = { - Name = "THROWING KNIFE", - Description = "Lightweight knife to throw and pick back up.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_tknife", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_smoke"] = { - Name = "SMOKE GRENADE", - Description = "Smoke bomb used to conceal a position, and makes enemies cough.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_smoke", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_flashbang"] = { - Name = "FLASHBANG", - Description = "Stun grenade that gives off a bright flash and a loud 'bang'.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_flashbang", - GrenadeFuse = 2, - GrenadeCharge = false, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - - WEAPONS["g_prox"] = { - Name = "PROXIMITY MINE", - Description = "Mine that bounces into the air.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "benny_grenade_prox", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", - } - -end - -do -- Equipment, nothing here is guaranteed. - - WEAPONS["e_medkit"] = { - Name = "MEDKIT", - Description = "Station that regenerates a portion of health.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", - } - - WEAPONS["e_ammo"] = { - Name = "AMMO CRATE", - Description = "Station that replenishes ammo.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", - } - -end - --- Ammo generator - -for class, data in SortedPairs( WEAPONS ) do - if data.Features == "firearm" then - WEAPONS["mag_" .. class] = { - Name = "MAG: " .. WEAPONS[class].Name, - Description = "Magazine for the " .. WEAPONS[class].Name .. ".", - Type = "magazine", - - WModel = "models/weapons/w_pist_glock18.mdl", - HoldType = "slam", - - Ammo = WEAPONS[class].Ammo, - - Features = "magazine", - } - end -end \ No newline at end of file + }, + + Damage = 0, + Delay = 60/600, + + Spread = 0, + SpreadAdd = 0, + SpreadAddMax = 1, + + SpreadDecay_Start = 1, + SpreadDecay_End = 2, + SpreadDecay_RampTime = 1, + + Func_Attack = function( self, hand ) + end, +}) + +ItemDef("base_grenade", { + Name = "Base Grenade", + Type = "grenade", + Base = "base", + Description = "Base for grenades", + Features = "grenade", + + WModel = "models/weapons/w_grenade.mdl", + HoldType = "slam", +}) + +ItemDef("base_magazine", { + Name = "Base Magazine", + Type = "magazine", + Base = "base", + Description = "Base for magazines", + Features = "magazine", + + WModel = "models/weapons/w_slam.mdl", + HoldType = "slam", +}) + +ItemDef("deagle", { + Name = "DEAGLE", + Description = "Autoloading .50 caliber pistol.", + Base = "base_firearm", + Type = "pistol", + + WModel = "models/weapons/w_pist_deagle.mdl", + HoldType = "revolver", + + Sound_Fire = "Anaconda.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Anaconda.MagOut", + Sound_MagIn = "Anaconda.MagIn", + Sound_Cock = "Deagle.Cock", +}) + +ItemDef("mag_deagle", { + Name = "MAG: DEAGLE 7-rnd", + Base = "base_magazine", + + Ammo = 7, +}) +--[[ +ItemDef("deagle", { + Name = "DEAGLE", + Description = "Autoloading .50 caliber pistol.", + Base = "base_firearm", + Type = "pistol", + + Icon = Material( "benny/weapons/mk23.png", "smooth" ), + WModel = "models/weapons/w_pist_deagle.mdl", + HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW, 0.5 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, + + Sound_Fire = "Anaconda.Fire", + Sound_DryFire = "Common.Dryfire.Pistol", + Sound_MagOut = "Anaconda.MagOut", + Sound_MagIn = "Anaconda.MagIn", + Sound_Cock = "Deagle.Cock", + + Delay = (60/180), + Firemodes = FIREMODE_SEMI, + Damage = 47, + Spread = 30/60, + SpreadAdd = 4, + SpreadAddMax = 15, + + SpreadDecay_Start = 8, + SpreadDecay_End = 25, + SpreadDecay_RampTime = 0.5, + + Speed_Move = 0.95, + Speed_Aiming = 0.95, + Speed_Reloading = 0.95, + Speed_Firing = 0.95, + Speed_FiringTime = 0.5, + + Features = "firearm", +}) +]] \ No newline at end of file