From 5a0815c22ef05f82451e2fa9f26005a928984bb7 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Mon, 1 Jan 2024 18:05:09 -0500 Subject: [PATCH] Fix mag display on Active, add Glock --- .../benny/gamemode/modules/player/cl_hud.lua | 2 +- .../gamemode/modules/weapons/sh_weapons.lua | 86 ++++++++++++++++--- 2 files changed, 77 insertions(+), 11 deletions(-) diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index ba11490..97ef47b 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -556,7 +556,7 @@ hook.Add( "HUDPaint", "Benny_HUDPaint", function() draw.SimpleText( "!! Mag desync.", "Benny_12", p_x + ss( 2 ), p_y - ss( 12+2 ), scheme["fg"], TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) end end - if wep_class.Ammo then -- Magazines + if wep_class.AmmoStd then -- Magazines local m_w, m_h = ss( 12 ), ss( 20 ) local m_x, m_y = p_x + p_w - m_w, p_y + p_h + ss(1)--p_x - m_w, p_y + p_h - m_h local bb = ss( 1 ) diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua index bf0263a..f411b72 100644 --- a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua +++ b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua @@ -1,17 +1,17 @@ +local FIREMODE_AUTO = { + { Mode = math.huge }, +} +local FIREMODE_AUTOSEMI = { + { Mode = math.huge }, + { Mode = 1 }, +} +local FIREMODE_SEMI = { + { Mode = 1 }, +} do -- Sound definitions - 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( "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( "Deagle.Cock", "benny/weapons/deagle/cock.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 ) @@ -20,6 +20,28 @@ do -- Sound definitions 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 ) + -- Deagle + AddSound( "Deagle.Cock", "benny/weapons/deagle/cock.ogg", 70, 100, 0.5, CHAN_STATIC ) + + -- Glock + 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( "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 ) + + -- Anaconda + 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( "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 ) + end do -- Bases @@ -162,6 +184,8 @@ do -- Pistols WModel = "models/weapons/w_pist_deagle.mdl", HoldType = "revolver", + GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.25 }, + GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, Sound_Fire = "Anaconda.Fire", Sound_DryFire = "Common.Dryfire.Pistol", @@ -190,6 +214,48 @@ do -- Pistols Speed_FiringTime = 0.5, }) + ItemDef("glock", { + Name = "GLOCK-18", + Description = "Bullet storm. Lasts about a second or so, just like you!", + Base = "base_firearm", + Category = "pistol", + + 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", + + -- + AmmoStd = 17, + AutoGenMag = true, + Delay = (60/900), + Firemodes = FIREMODE_AUTOSEMI, + 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, + }) + end for i, v in SortedPairs( WEAPONS ) do