diff --git a/gamemodes/benny/entities/entities/b-item.lua b/gamemodes/benny/entities/entities/b-item.lua deleted file mode 100644 index cbce5a6..0000000 --- a/gamemodes/benny/entities/entities/b-item.lua +++ /dev/null @@ -1,59 +0,0 @@ -AddCSLuaFile() - -ENT.Type = "anim" -ENT.Base = "base_anim" -ENT.RenderGroup = RENDERGROUP_BOTH - -function ENT:Initialize() - self.DieTime = CurTime() + 3 -end - -function ENT:InitSpecial( model ) - self:SetModel( model ) - - -- Physics stuff - self:SetMoveType( MOVETYPE_VPHYSICS ) - self:SetSolid( SOLID_VPHYSICS ) - - -- Init physics only on server, so it doesn't mess up physgun beam - if ( SERVER ) then self:PhysicsInit( SOLID_VPHYSICS ) end - - self:SetCollisionGroup( COLLISION_GROUP_PROJECTILE ) - - -- Make prop to fall on spawn - self:PhysWake() - - if SERVER then - local p = self:GetPhysicsObject() - p:SetMass( 0 ) - end -end - -function ENT:Think() - if SERVER and self.DieTime <= CurTime() then - self:Remove() - end -end - -function ENT:PhysicsCollide( data, phys ) - if ( data.Speed > 200 ) and data.DeltaTime > 0.2 then - local ent = data.HitEntity - print(ent:Health()) - if ent:IsValid() and ent:Health() > 0 then - ent:EmitSound( ")benny/violence/bodysplat_mix2.ogg", 70, 100, 1 ) - - local dmg = DamageInfo() - dmg:SetDamageType( DMG_CLUB ) - dmg:SetDamage( 25 ) - dmg:SetAttacker( self:GetOwner() ) - dmg:SetInflictor( self ) - print( data.HitSpeed, data.HitSpeed:Length() ) - dmg:SetDamageForce( data.HitSpeed*-10 ) - dmg:SetDamagePosition( data.HitPos ) - - ent:TakeDamageInfo( dmg ) - else - self:EmitSound( "physics/metal/weapon_impact_hard1.wav" ) - end - end -end \ No newline at end of file diff --git a/gamemodes/benny/entities/entities/b-item_firearm.lua b/gamemodes/benny/entities/entities/b-item_firearm.lua deleted file mode 100644 index 33346a3..0000000 --- a/gamemodes/benny/entities/entities/b-item_firearm.lua +++ /dev/null @@ -1,3 +0,0 @@ - -ENT.Base = "b-item" - diff --git a/gamemodes/benny/entities/weapons/benny/cl_wm.lua b/gamemodes/benny/entities/weapons/benny/cl_wm.lua deleted file mode 100644 index f95ca60..0000000 --- a/gamemodes/benny/entities/weapons/benny/cl_wm.lua +++ /dev/null @@ -1,95 +0,0 @@ -function SWEP:DrawWorldModel() - local p = self:GetOwner() - do - local wm = self.CWM - local class = self:bWepClass( false ) - if class then - if !IsValid(wm) then - wm = ClientsideModel( class.WModel ) - self.CWM = wm - end - wm:SetModel( class.WModel ) - wm:SetNoDraw( true ) - if class.MAdj then - if wm:IsEffectActive( EF_BONEMERGE ) then - wm:RemoveEffects( EF_BONEMERGE ) - end - - -- Specify a good position - local offsetVec = class.MAdj - local offsetAng = class.MAdjA or angle_zero - - local boneid = p:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand - if !boneid then return end - - local matrix = p:GetBoneMatrix(boneid) - if !matrix then return end - - local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles()) - - wm:SetPos(newPos) - wm:SetAngles(newAng) - - wm:SetupBones() - else - if !wm:IsEffectActive( EF_BONEMERGE ) then - wm:AddEffects( EF_BONEMERGE ) - end - wm:SetPos(self:GetPos()) - wm:SetAngles(self:GetAngles()) - end - wm:SetParent( p ) - if true or self:GetUserAim() then wm:DrawModel() end - else - if IsValid(wm) then wm:Remove() end - end - end - do - local wm = self.CWM_Left - local class = self:bWepClass( true ) - if class then - if !IsValid(wm) then - wm = ClientsideModel( class.WModel ) - self.CWM_Left = wm - end - wm:SetModel( class.WModel ) - wm:SetNoDraw( true ) - - if IsValid(p) then - -- Specify a good position - wm:SetPos( vector_origin ) - wm:SetAngles( angle_zero ) - wm:SetupBones() - - local pv = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetTranslation() - local pa = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetAngles() - pv.x = -pv.x - pv.y = pv.y - pv.z = -pv.z - pa.p = -pa.p - pa.r = pa.r + 180 - - local boneid = p:LookupBone("ValveBiped.Bip01_L_Hand") -- Right Hand - if !boneid then return end - - local matrix = p:GetBoneMatrix(boneid) - if !matrix then return end - - local newPos, newAng = LocalToWorld(pv, pa, matrix:GetTranslation(), matrix:GetAngles()) - - wm:SetPos(newPos) - wm:SetAngles(newAng) - - wm:SetupBones() - else - wm:SetPos(self:GetPos()) - wm:SetAngles(self:GetAngles()) - wm:SetupBones() - end - - if true or self:GetUserAim() then wm:DrawModel() end - else - if IsValid(wm) then wm:Remove() end - end - end -end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/benny/sh_drop.lua b/gamemodes/benny/entities/weapons/benny/sh_drop.lua deleted file mode 100644 index 86a8239..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_drop.lua +++ /dev/null @@ -1,34 +0,0 @@ - -function SWEP:Drop( hand ) - if self:bWepClass( hand ) then - local p = self:GetOwner() - self:EmitSound( "weapons/slam/throw.wav", 70, 100, 1, CHAN_STATIC ) - - if SERVER then - local throw = ents.Create( "b-item" ) - throw:SetPos( p:EyePos() + p:EyeAngles():Forward()*16 ) - throw:SetAngles( p:EyeAngles() ) - throw:SetOwner( p ) - throw:InitSpecial(self:bWepClass( hand ).WModel) - throw:SetPhysicsAttacker( p ) - throw:Spawn() - local throwp = throw:GetPhysicsObject() - assert( throwp:IsValid(), "Benny Drop: Physics object invalid" ) - throwp:SetVelocityInstantaneous( (p:EyeAngles()+Angle(-7,0,0)):Forward()*1000 ) - if self:bWepClass( hand ).ClassName == "m16a2" then - throwp:SetAngleVelocityInstantaneous( Vector( 360*-0.2, 360*1, 360*0 ) ) - else - throwp:SetAngleVelocityInstantaneous( Vector( 360*-0.25, 360*10, 360*0.25 ) ) - end - end - - if SERVER or CLIENT and IsFirstTimePredicted() then - --InvDiscard( p, self:bGetInvID( hand ) ) - end - self:SetJustThrew( CurTime() + 0.25 ) - self:SetJustThrewHand( hand ) - self:bWepTable( hand ).Thrown = true - p:AddVCDSequenceToGestureSlot( GESTURE_SLOT_JUMP, p:SelectWeightedSequence( ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE ), 0, true ) - - end -end diff --git a/gamemodes/benny/entities/weapons/benny/sh_firing.lua b/gamemodes/benny/entities/weapons/benny/sh_firing.lua deleted file mode 100644 index d877303..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_firing.lua +++ /dev/null @@ -1,84 +0,0 @@ - - -function SWEP:PrimaryAttack() - if self:bWepTable( self:hFlipHand( false ) ) and self:bWepTable( self:hFlipHand( false ) ).Thrown then return true end - self:BFireLogic( self:hFlipHand( false ) ) - return true -end - -function SWEP:SecondaryAttack() - if self:bWepTable( self:hFlipHand( true ) ) and self:bWepTable( self:hFlipHand( true ) ).Thrown then return true end - self:BFireLogic( self:hFlipHand( true ) ) - return true -end - -function SWEP:BFireLogic( hand ) - if self:bWepClass( hand ) then - self:BFire( hand ) - elseif self:bWepClass( !hand ) then - self:BFireAlt( !hand ) - end -end - -function SWEP:BFire( hand ) - if self:bWepClass( hand ) and self:bWepClass( hand ).Func_Attack then - if self:bWepClass( hand ).Func_Attack( self, hand ) then return end - end -end - -function SWEP:BFireAlt( hand ) - if self:bWepClass( hand ) and self:bWepClass( hand ).Func_AttackAlt then - if self:bWepClass( hand ).Func_AttackAlt( self, hand ) then return end - end -end - -local bc = { effects = true, damage = true } -function SWEP:CallFire( hand ) - local p = self:GetOwner() - local class = self:bWepClass( hand ) - local spread = self:BSpread( hand ) - for i=1, self:GetStat( hand, "Pellets" ) do - local dir = self:GetOwner():EyeAngles() - - local radius = util.SharedRandom("benny_distance_"..tostring(hand), 0, 1, i ) - local circ = util.SharedRandom("benny_radius_"..tostring(hand), 0, math.rad(360), i ) - - dir:RotateAroundAxis( dir:Right(), spread * radius * math.sin( circ ) ) - dir:RotateAroundAxis( dir:Up(), spread * radius * math.cos( circ ) ) - dir:RotateAroundAxis( dir:Forward(), 0 ) - local tr = util.TraceLine( { - start = p:EyePos(), - endpos = p:EyePos() + dir:Forward() * 8192, - filter = p - } ) - - self:FireBullets( { - Attacker = p, - Damage = class.Damage, - Force = ( class.Damage / 10 ) * self:GetStat( hand, "Pellets" ), - Src = p:EyePos(), - Dir = dir:Forward(), - Tracer = 0, - IgnoreEntity = p, - Callback = function( atk, tr, dmginfo ) - if CLIENT and IsFirstTimePredicted() then - self:FireCL( hand, tr ) - end - return bc - end, - } ) - end -end - -function SWEP:FireCL( hand, tr ) - -- PROTO: This is shit! Replace it with a function that gets the right model. - local vStart = (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ).Pos - local vPoint = tr.HitPos - local effectdata = EffectData() - effectdata:SetStart( vStart ) - effectdata:SetOrigin( vPoint ) - effectdata:SetEntity( self ) - effectdata:SetScale( 1025*12 ) - effectdata:SetFlags( 1 ) - util.Effect( "Tracer", effectdata ) -end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/benny/sh_holdtypes.lua b/gamemodes/benny/entities/weapons/benny/sh_holdtypes.lua deleted file mode 100644 index 842416c..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_holdtypes.lua +++ /dev/null @@ -1,155 +0,0 @@ - - --- Holdtype thingys -do - local ActIndex = { - [ "pistol" ] = ACT_HL2MP_IDLE_PISTOL, - [ "smg" ] = ACT_HL2MP_IDLE_SMG1, - [ "grenade" ] = ACT_HL2MP_IDLE_GRENADE, - [ "ar2" ] = ACT_HL2MP_IDLE_AR2, - [ "shotgun" ] = ACT_HL2MP_IDLE_SHOTGUN, - [ "rpg" ] = ACT_HL2MP_IDLE_RPG, - [ "physgun" ] = ACT_HL2MP_IDLE_PHYSGUN, - [ "crossbow" ] = ACT_HL2MP_IDLE_CROSSBOW, - [ "melee" ] = ACT_HL2MP_IDLE_MELEE, - [ "slam" ] = ACT_HL2MP_IDLE_SLAM, - [ "normal" ] = ACT_HL2MP_IDLE, - [ "fist" ] = ACT_HL2MP_IDLE_FIST, - [ "melee2" ] = ACT_HL2MP_IDLE_MELEE2, - [ "passive" ] = ACT_HL2MP_IDLE_PASSIVE, - [ "knife" ] = ACT_HL2MP_IDLE_KNIFE, - [ "duel" ] = ACT_HL2MP_IDLE_DUEL, - [ "camera" ] = ACT_HL2MP_IDLE_CAMERA, - [ "magic" ] = ACT_HL2MP_IDLE_MAGIC, - [ "revolver" ] = ACT_HL2MP_IDLE_REVOLVER, - - [ "suitcase" ] = ACT_HL2MP_IDLE, - [ "melee_angry" ] = ACT_HL2MP_IDLE_MELEE_ANGRY, - [ "angry" ] = ACT_HL2MP_IDLE_ANGRY, - [ "scared" ] = ACT_HL2MP_IDLE_SCARED, - [ "zombie" ] = ACT_HL2MP_IDLE_ZOMBIE, - [ "cower" ] = ACT_HL2MP_IDLE_COWER, - } - - --[[--------------------------------------------------------- - Name: SetWeaponHoldType - Desc: Sets up the translation table, to translate from normal - standing idle pose, to holding weapon pose. - -----------------------------------------------------------]] - function SWEP:SetWeaponHoldType( t ) - - t = string.lower( t ) - local index = ActIndex[ t ] - - if ( index == nil ) then - Msg( "SWEP:SetWeaponHoldType - ActIndex[ \"" .. t .. "\" ] isn't set! (defaulting to normal)\n" ) - t = "normal" - index = ActIndex[ t ] - end - - self.ActivityTranslate = {} - self.ActivityTranslate[ ACT_MP_STAND_IDLE ] = index - self.ActivityTranslate[ ACT_MP_WALK ] = index + 1 - self.ActivityTranslate[ ACT_MP_RUN ] = index + 2 - self.ActivityTranslate[ ACT_MP_CROUCH_IDLE ] = index + 3 - self.ActivityTranslate[ ACT_MP_CROUCHWALK ] = index + 4 - self.ActivityTranslate[ ACT_MP_ATTACK_STAND_PRIMARYFIRE ] = index + 5 - self.ActivityTranslate[ ACT_MP_ATTACK_CROUCH_PRIMARYFIRE ] = index + 5 - self.ActivityTranslate[ ACT_MP_RELOAD_STAND ] = index + 6 - self.ActivityTranslate[ ACT_MP_RELOAD_CROUCH ] = index + 6 - self.ActivityTranslate[ ACT_MP_JUMP ] = index + 7 - self.ActivityTranslate[ ACT_RANGE_ATTACK1 ] = index + 8 - self.ActivityTranslate[ ACT_MP_SWIM ] = index + 9 - - -- "normal" jump animation doesn't exist - if ( t == "normal" ) then - self.ActivityTranslate[ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM - end - - if ( t == "suitcase" ) then - self.ActivityTranslate[ ACT_MP_STAND_IDLE ] = ACT_HL2MP_IDLE_SUITCASE - self.ActivityTranslate[ ACT_MP_WALK ] = ACT_HL2MP_WALK_SUITCASE - self.ActivityTranslate[ ACT_MP_JUMP ] = ACT_HL2MP_JUMP_SLAM - end - - if ( t == "passive" ) then - self.ActivityTranslate[ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE_CROUCH_SLAM - self.ActivityTranslate[ ACT_MP_CROUCHWALK ] = ACT_HL2MP_WALK_CROUCH_SLAM - end - - if ( t == "rpg" ) then - self.ActivityTranslate[ ACT_MP_CROUCH_IDLE ] = ACT_HL2MP_IDLE_CROUCH_AR2 - self.ActivityTranslate[ ACT_MP_CROUCHWALK ] = ACT_HL2MP_WALK_CROUCH_AR2 - end - - --self:SetupWeaponHoldTypeForAI( t ) - - end - - -- Default hold pos is the pistol - SWEP:SetWeaponHoldType( "pistol" ) - - --[[--------------------------------------------------------- - Name: weapon:TranslateActivity() - Desc: Translate a player's Activity into a weapon's activity - So for example, ACT_HL2MP_RUN becomes ACT_HL2MP_RUN_PISTOL - Depending on how you want the player to be holding the weapon - -----------------------------------------------------------]] - function SWEP:TranslateActivity( act ) - - if ( self.Owner:IsNPC() ) then - if ( self.ActivityTranslateAI[ act ] ) then - return self.ActivityTranslateAI[ act ] - end - return -1 - end - - if ( self.ActivityTranslate[ act ] != nil ) then - return self.ActivityTranslate[ act ] - end - - return -1 - - end -end - -SWEP.GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_SHOTGUN, 0.85 } -SWEP.GestureReload = { ACT_FLINCH_STOMACH, 0.3 } -SWEP.GestureDraw = { ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND, 0.75 } -SWEP.GestureHolster = { ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND, 0.65 } -function SWEP:TPFire( hand ) - if CLIENT and !IsFirstTimePredicted() then return end - local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureFire - if !target then - target = self.GestureFire - end - self:GetOwner():AddVCDSequenceToGestureSlot( GESTURE_SLOT_GRENADE, self:GetOwner():SelectWeightedSequence(target[1]), target[2], true ) -end -function SWEP:TPCustom( tg1, tg2 ) - if CLIENT and !IsFirstTimePredicted() then return end - self:GetOwner():AddVCDSequenceToGestureSlot( GESTURE_SLOT_GRENADE, self:GetOwner():SelectWeightedSequence(tg1), tg2, true ) -end -function SWEP:TPReload( hand ) - if CLIENT and !IsFirstTimePredicted() then return end - local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureReload - if !target then - target = self.GestureReload - end - self:GetOwner():AddVCDSequenceToGestureSlot( GESTURE_SLOT_GRENADE, self:GetOwner():SelectWeightedSequence(target[1]), target[2], true ) -end -function SWEP:TPDraw( hand ) - if CLIENT and !IsFirstTimePredicted() then return end - local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureDraw - if !target then - target = self.GestureDraw - end - self:GetOwner():AddVCDSequenceToGestureSlot( GESTURE_SLOT_GRENADE, self:GetOwner():SelectWeightedSequence(target[1]), target[2], true ) -end -function SWEP:TPHolster( hand ) - if CLIENT and !IsFirstTimePredicted() then return end - local target = self:bWepClass( hand ) and self:bWepClass( hand ).GestureHolster - if !target then - target = self.GestureHolster - end - self:GetOwner():AddVCDSequenceToGestureSlot( GESTURE_SLOT_GRENADE, self:GetOwner():SelectWeightedSequence(target[1]), target[2], true ) -end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/benny/sh_inv.lua b/gamemodes/benny/entities/weapons/benny/sh_inv.lua deleted file mode 100644 index 616d08a..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_inv.lua +++ /dev/null @@ -1,97 +0,0 @@ - -function SWEP:GetStat( hand, stat ) - local Hand = ((hand==true and "Left Hand") or (hand==false and "Right Hand")) - assert( self:bWepClass( hand ), "No weapon in " .. Hand .. " (Trying to get stat " .. stat .. ")" ) - local thereturn = (self:bWepClass( hand ) and self:bWepClass( hand )[stat]) - assert( thereturn, "No stat for " .. stat .. " ( " .. Hand .. " )" ) - return thereturn -end - -function BENNY_GetStat( class, stat ) - assert( class, "No class" ) - local thereturn = class[stat] - assert( thereturn, "No stat for " .. stat ) - return thereturn -end - -function SWEP:hFlipHand( hand ) - hand = hand or false - local p = self:GetOwner() - local lt = self:bWepClass( true ) - local flip = false - if lt then - if lt.Features == "firearm" then - flip = p:GetInfoNum( "benny_wep_ao_firearms", 1 )==1 - elseif lt.Features == "grenade" then - flip = p:GetInfoNum( "benny_wep_ao_grenades", 0 )==1 - else - flip = p:GetInfoNum( "benny_wep_ao_junk", 0 )==1 - end - else - --return false - end - return ((flip and !hand) or (!flip and hand)) -end - -function SWEP:C_AttackDown( hand ) - if self:hFlipHand() then hand = !hand end - return (hand == true) and self:GetOwner():KeyDown( IN_ATTACK2 ) or (hand == false) and self:GetOwner():KeyDown( IN_ATTACK ) -end - -function SWEP:BDeploy( hand, id ) - assert( isbool(hand), "You forgot the hand." ) - assert( isstring(id), "You forgot the ID." ) - if self:bGetInvID( hand ) == id then - -- This breaks prediction somewhat!! - -- return -- PROTO: If you're in the middle of holstering, cancel it - elseif self:bGetInvID( hand ) != "" then - return--self:BHolster( hand ) - end - local p = self:GetOwner() - local inv = p:INV_Get() - - local item = inv[id] - local class = WeaponGet(item.Class) - - assert( item, "That item doesn't exist. " .. tostring(item) ) - - 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 - local midi = inv[ mid ] - if !midi then - item.Loaded = "" - error( "Deploy: Magazine doesn't exist in the inventory!! " .. tostring(mid) .. " item.Loaded removed." ) - end - self:bSetMagInvID( hand, mid ) - self:bSetIntClip( hand, midi.Ammo ) - end -end - -function SWEP:BHolster( hand ) - if self:bGetInvID( hand ) == "" then - return -- What the hell are you holstering..? - end - - local p = self:GetOwner() - --B_Sound( self, "Common.Holster" ) - local item = self:bWepTable( hand ) - if item then - local class = WeaponGet(item.Class) - if class.Custom_Holster then class.Custom_Holster( self, item, class, hand ) end - end - - self:bSetInvID( hand, "" ) - self:bSetMagInvID( hand, "" ) - self:bSetIntClip( hand, 0 ) -end - -function SWEP:BSpread( hand ) - return self:bWepClass( 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 deleted file mode 100644 index 6c5adbb..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_reload.lua +++ /dev/null @@ -1,135 +0,0 @@ - --- Reload logic - -function SWEP:Reload( hand ) - if hand == nil then return end -- Needs to be called from the custom ones - local p = self:GetOwner() - local inv = p:INV_Get() - local wep_table = self:bWepTable( hand ) - local wep_class = self:bWepClass( hand ) - if wep_table then - if self:bWepClass( hand ) and self:bWepClass( hand ).Func_Reload then - if self:bWepClass( hand ).Func_Reload( self, hand ) then return end - end - if wep_class.Custom_Reload then - if wep_class.Custom_Reload( self, wep_table ) then return end - end - if self:bGetIntDelay( hand ) > CurTime() then - return false - end - local rt = self:bGetReloadTime( hand ) - if rt > 0 then - 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:bSetReloadTime( hand, 0 ) - return true - else - B_Sound( self, "Common.ReloadFail" ) - self:bSetReloadTime( hand, RealTime() ) - return false - end - else - return false - end - end - - local curmag = self:bGetMagInvID( hand ) - if curmag != "" then - self:bSetReloadTime( hand, RealTime() ) - self:bSetReloadType( hand, 2 ) - B_Sound( self, wep_class.Sound_MagOut ) - self:Reload_MagOut( hand, self:bGetMagInvID( hand ), inv ) - elseif self:GetBestLoadableMagazine( hand, wep_table.Class, inv, wep_table ) then - self:bSetReloadTime( hand, RealTime() ) - self:bSetReloadType( hand, 1 ) - B_Sound( self, wep_class.Sound_MagIn ) - else - B_Sound( self, "Common.NoAmmo" ) - end - self:TPReload( hand ) - end - return true -end - -function SWEP:Reload_MagOut( hand, curmag, optinv, optwep_table, optwep_class ) - local p = self:GetOwner() - local inv = optinv or p:INV_Get() - local wep_table = optwep_table or self:bWepTable( hand ) - local wep_class = optwep_class or self:bWepClass( hand ) - - 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:bSetMagInvID( hand, "" ) - wep_table.Loaded = "" - elseif inv[curmag].Ammo == 0 then - if SERVER or (CLIENT and IsFirstTimePredicted()) then - p:INV_Discard( curmag ) - end - end - - self:bSetMagInvID( hand, "" ) - self:bSetIntClip( hand, 0 ) - --B_Sound( self, wep_class.Sound_MagOut ) - wep_table.Loaded = "" -end - -function SWEP:GetLoadableMagazines( hand, class, optinv, optwep_table ) - local p = self:GetOwner() - local inv = optinv or p:INV_Get() - local wep_table = optwep_table or self:bWepTable( hand ) - local maglist = p:INV_FindMag( wep_table.Class ) - - local usedlist = {} - for _id, mrow in pairs( inv ) do - if mrow.Loaded and mrow.Loaded != "" then - usedlist[mrow.Loaded] = true - end - end - - return maglist -end - -function SWEP:GetBestLoadableMagazine( hand, class, optinv, optwep_table ) - local p = self:GetOwner() - local inv = optinv or p:INV_Get() - local wep_table = optwep_table or self:bWepTable( hand ) - local maglist = p:INV_FindMag( wep_table.Class ) - local mag = false - - local usedlist = {} - for _id, mrow in pairs( inv ) do - if mrow.Loaded and mrow.Loaded != "" then - usedlist[mrow.Loaded] = true - end - end - - for num, mid in ipairs( maglist ) do - if usedlist[mid] then - else - mag = mid - break - end - end - - return mag -end - -function SWEP:Reload_MagIn( hand, curmag, optinv, optwep_table, optwep_class ) - local p = self:GetOwner() - local inv = optinv or p:INV_Get() - local wep_table = optwep_table or self:bWepTable( hand ) - local wep_class = optwep_class or self:bWepClass( hand ) - local mag = self:GetBestLoadableMagazine( hand, wep_table.Class ) - - if mag then - self:bSetMagInvID( hand, mag ) - self:bSetIntClip( hand, inv[mag].Ammo ) - wep_table.Loaded = mag - B_Sound( self, wep_class.Sound_Cock ) - else - B_Sound( self, "Common.NoAmmo" ) - end -end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/benny/sh_stat2.lua b/gamemodes/benny/entities/weapons/benny/sh_stat2.lua deleted file mode 100644 index d62f257..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_stat2.lua +++ /dev/null @@ -1,156 +0,0 @@ - --- Stat2 - -function SWEP:bWepTable( alt ) - return self:GetOwner():INV_Get()[ ((alt==true) and self:GetWep2()) or ((alt==false) and self:GetWep1()) ] -end - -function SWEP:bWepClass( alt ) - local ta = self:bWepTable( alt ) - if ta then - return WeaponGet( ta.Class ) - else - return false - end -end - -function SWEP:bMagTable( alt ) - return self:GetOwner():INV_Get()[ ((alt==true) and self:GetWep2_Clip()) or ((alt==false) and self:GetWep1_Clip()) ] -end - -function SWEP:bMagClass( alt ) - local ta = self:bMagTable( alt ) - if ta then - return WeaponGet( ta.Class ) - else - return false - end -end - --- 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/sh_statregen.lua b/gamemodes/benny/entities/weapons/benny/sh_statregen.lua deleted file mode 100644 index 39d98bc..0000000 --- a/gamemodes/benny/entities/weapons/benny/sh_statregen.lua +++ /dev/null @@ -1,34 +0,0 @@ - -if SERVER then - util.AddNetworkString( "Benny_StatRegen" ) - function SWEP:BSend( ... ) - net.Start( "Benny_StatRegen" ) - net.WriteUInt( #{ ... }, 4 ) - for i, v in ipairs( { ... } ) do - net.WriteString( v[1] ) - net.WriteBool( v[2] ) - if v[2] then - net.WriteString( v[3] ) - else - net.WriteDouble( v[3] ) - end - end - net.Send( self:GetOwner() ) - end -else - net.Receive( "Benny_StatRegen", function( len, ply ) - local count = net.ReadUInt( 4 ) - - for i=1, count do - local stat = net.ReadString() - local str = net.ReadBool() - local data - if str then - data = net.ReadString() - else - data = net.ReadDouble() - end - LocalPlayer():GetActiveWeapon():bWepTable()[stat] = data - end - end) -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 deleted file mode 100644 index 01dda26..0000000 --- a/gamemodes/benny/entities/weapons/benny/shared.lua +++ /dev/null @@ -1,311 +0,0 @@ - --- The benny weapon handles the weapon pickups you find throughout the game. - -SWEP.Base = "weapon_base" - -SWEP.PrintName = "Benny Weapon Handler" - -SWEP.ViewModel = "models/weapons/c_pistol.mdl" -SWEP.ViewModelFOV = 10 -SWEP.WorldModel = "models/weapons/w_pistol.mdl" - -SWEP.Primary.ClipSize = 0 -SWEP.Primary.DefaultClip = 0 -SWEP.Primary.Automatic = true -SWEP.Primary.Ammo = "none" - -SWEP.Secondary.ClipSize = 0 -SWEP.Secondary.DefaultClip = 0 -SWEP.Secondary.Automatic = true -SWEP.Secondary.Ammo = "none" - -AddCSLuaFile( "sh_statregen.lua" ) -include ( "sh_statregen.lua" ) -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" ) -include ( "sh_reload.lua" ) -AddCSLuaFile( "sh_drop.lua" ) -include ( "sh_drop.lua" ) - -AddCSLuaFile( "cl_wm.lua" ) -if CLIENT then - include ( "cl_wm.lua" ) -end - -function SWEP:SetupDataTables() - self:NetworkVar( "Float", 0, "Aim" ) - self:NetworkVar( "Float", 1, "Delay1" ) - self:NetworkVar( "Float", 2, "Delay2" ) - self:NetworkVar( "Float", 3, "GrenadeDownStart" ) - self:NetworkVar( "Float", 4, "Wep1_Spread" ) - self:NetworkVar( "Float", 5, "Wep2_Spread" ) - self:NetworkVar( "Float", 6, "Wep1_ShotTime" ) - self:NetworkVar( "Float", 7, "Wep2_ShotTime" ) - self:NetworkVar( "Float", 8, "Wep1_Holstering" ) - self:NetworkVar( "Float", 9, "Wep2_Holstering" ) - self:NetworkVar( "Float", 10, "Wep1_Reloading" ) - self:NetworkVar( "Float", 11, "Wep2_Reloading" ) - self:NetworkVar( "Float", 12, "JustThrew" ) - self:NetworkVar( "String", 0, "Wep1" ) - self:NetworkVar( "String", 1, "Wep2" ) - self:NetworkVar( "String", 2, "Wep1_Clip" ) - self:NetworkVar( "String", 3, "Wep2_Clip" ) - self:NetworkVar( "Int", 0, "Wep1_Burst" ) - self:NetworkVar( "Int", 1, "Wep2_Burst" ) - self:NetworkVar( "Int", 2, "Wep1_Firemode" ) - self:NetworkVar( "Int", 3, "Wep2_Firemode" ) - self:NetworkVar( "Int", 4, "Wep1_ReloadType" ) - self:NetworkVar( "Int", 5, "Wep2_ReloadType" ) - self:NetworkVar( "Bool", 0, "UserAim" ) - self:NetworkVar( "Bool", 1, "GrenadeDown" ) - self:NetworkVar( "Bool", 2, "JustThrewHand" ) - - self:SetWep1_Firemode( 1 ) - self:SetWep2_Firemode( 1 ) - - self:SetWep1_Holstering( -1 ) - self:SetWep2_Holstering( -1 ) - - self:SetWep1_Reloading( -1 ) - self:SetWep2_Reloading( -1 ) -end - -function SWEP:B_Ammo( hand, value ) - local p = self:GetOwner() - local inv = p:INV_Get() - 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:bWepClass( alt ).Firemodes[ self:bGetFiremode( alt ) ] -end - -function SWEP:B_FiremodeName( alt ) - local mode = self:B_Firemode( alt ).Mode - if mode == 1 then - return "SEMI" - elseif mode == math.huge then - return "AUTO" - else - return mode .. "RND" - end -end - -hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_TempForAim", function( ply, button ) - local wep = ply:BennyCheck() - if wep then - if button == KEY_F then - if tobool(ply:GetInfoNum("benny_wep_toggleaim", 1)) then - wep:SetUserAim( !wep:GetUserAim() ) - else - wep:SetUserAim( true ) - end - end - - if button == ply:GetInfoNum("benny_bind_reload", KEY_R) then - wep:Reload( wep:hFlipHand( false ) ) - end - - if button == ply:GetInfoNum("benny_bind_reloada", KEY_T) then - wep:Reload( wep:hFlipHand( true ) ) - end - - if button == ply:GetInfoNum("benny_bind_drop", KEY_G) then - wep:Drop( wep:hFlipHand( false ) ) - end - - if button == ply:GetInfoNum("benny_bind_dropa", KEY_H) then - wep:Drop( wep:hFlipHand( true ) ) - end - end -end) - -hook.Add( "PlayerButtonUp", "Benny_PlayerButtonUp_TempForAim", function( ply, button ) - local wep = ply:BennyCheck() - if wep then - if button == KEY_F then - if !tobool(ply:GetInfoNum("benny_wep_toggleaim", 0)) then - wep:SetUserAim( false ) - end - end - end -end) - -function SWEP:BStartHolster( hand ) - if self:bGetHolsterTime( hand ) == -1 then - B_Sound( self, "Common.Holster" ) - -- print( "Holstering the " .. (hand and "LEFT" or "RIGHT") ) - self:bSetHolsterTime( hand, 0 ) - self:bSetReloadTime( hand, -1 ) - self:bSetReloadType( hand, 0 ) - end -end - -function SWEP:BThinkHolster( hand ) - if self:bGetHolsterTime( hand ) >= 0 then - self:bSetHolsterTime( hand, math.Approach( self:bGetHolsterTime( hand ), 1, FrameTime() / 0.35 ) ) - end - 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:bGetReqInvID( hand ) - local inv = p:INV_Get() - if req != "" and inv[req] then - self:BDeploy( hand, req ) - end - end -end - -function SWEP:Think() - local p = self:GetOwner() - local inv = p:INV_Get() - - local wep1 = self:bWepTable( false ) - local wep1c = self:bWepClass( false ) - local wep2 = self:bWepTable( true ) - local wep2c = self:bWepClass( 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:bGetReqInvID( hand ) != "" and !inv[self:bGetReqInvID( hand )] then - self:bSetReqInvID( hand, "" ) - end - 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:bGetReloadTime( hand ) > 0 then - -- hold - elseif self:GetJustThrew() > CurTime() then - -- hold - elseif self:bWepClass( hand ) and self:bGetShotTime( hand ) + self:GetStat( hand, "ShootHolsterTime" ) > CurTime() then - -- hold - else - if curr != "" then - -- require holster first - self:BStartHolster( hand ) - else - local otherhasthis = curr_o == req - if req != "" then - if otherhasthis then - self:BStartHolster( !hand ) - else - self:BDeploy( hand, req ) - end - else - self:BStartHolster( hand ) - end - end - end - end - - self:BThinkHolster( hand ) - - if self:GetJustThrew() != 0 and self:GetJustThrew() <= CurTime() then - if SERVER then - InvDiscard( p, self:bGetInvID( self:GetJustThrewHand() ) ) - end - self:SetJustThrew( 0 ) - end - - do -- Reload logic - if self:bGetReloadTime( hand ) != -1 then - local rlt = self:bGetReloadType( hand ) - -- TODO: Unshitify this. - 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:bGetMagInvID( hand ), inv ) - end - elseif rlt == 2 then - end - self:bSetReloadTime( hand, -1 ) - self:bSetReloadType( hand, 0 ) - -- Do reload stuff. - end - end - end - end - - self:SetAim( math.Approach( self:GetAim(), self:GetUserAim() and 1 or 0, FrameTime()/0.2 ) ) - - for i=1, 2 do - local hand = i==2 - if !self:C_AttackDown( hand ) then - self:bSetBurst( hand, 0 ) - end - end - - for i=1, 2 do - local hand = i==2 - local wep, wepc = self:bWepTable( hand ), self:bWepClass( hand ) - 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:bSetSpread( hand, math.Approach( self:bGetSpread( hand ), 0, decayfinal * FrameTime() ) ) - end - end - - local ht = "normal" - if self:bWepClass( false ) and self:bGetHolsterTime( false ) < 0 then - ht = "passive" - if self:GetUserAim() then - if self:GetJustThrew() != 0 then - ht = "melee" - elseif self:bWepClass( true ) then - ht = "duel" - else - ht = self:GetStat( false, "HoldType" ) - end - end - end - - if ht == "normal" and self:GetHoldType() != "normal" then - self:TPHolster( false ) - elseif ht != "normal" and self:GetHoldType() == "normal" then - self:TPDraw( false ) - end - - for i=1, 2 do - local hand = i==2 - if self:bWepClass( hand ) then - if self:bWepClass( hand ).Custom_Think then - self:bWepClass( hand ).Custom_Think( self, self:bWepTable( hand ), self:bWepClass( hand ), hand ) - end - end - end - - self:SetWeaponHoldType(ht) - self:SetHoldType(ht) - - return true -end - -function SWEP:Deploy() - return true -end - -function SWEP:Holster() - return true -end \ No newline at end of file diff --git a/gamemodes/benny/entities/weapons/itemhandler.lua b/gamemodes/benny/entities/weapons/itemhandler.lua new file mode 100644 index 0000000..294721a --- /dev/null +++ b/gamemodes/benny/entities/weapons/itemhandler.lua @@ -0,0 +1,200 @@ + +AddCSLuaFile() + +SWEP.Base = "weapon_base" +SWEP.AEItemHandler = true + +SWEP.ViewModel = "models/weapons/c_arms.mdl" +SWEP.ViewModelFOV = 74 +SWEP.ViewModelFlip = false +SWEP.UseHands = true +SWEP.WorldModel = "models/weapons/w_pistol.mdl" +SWEP.DrawWorldModel = true + + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = 0 +SWEP.Primary.Ammo = "none" +SWEP.Primary.Automatic = true + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = 0 +SWEP.Secondary.Ammo = "none" +SWEP.Secondary.Automatic = true + +function SWEP:SetupDataTables() + self:NetworkVar( "Entity", 0, "ActiveR" ) + self:NetworkVar( "Entity", 1, "ActiveL" ) +end + +function SWEP:ItemR( run ) + local active = self:GetActiveR() + if run and active:IsValid() then + return active.Class[run]( active.Class, active, self ) + else + return active:IsValid() and active or false + end +end + +function SWEP:ItemL( run ) + local active = self:GetActiveL() + if run and active:IsValid() then + active.Class[run]( active.Class, active, self ) + else + return active:IsValid() and active or false + end +end + +function SWEP:Initialize() +end + +local size = 8/2 +local tracedef = { + mins = Vector( -size, -size, -size ), + maxs = Vector( size, size, size ), +} +function SWEP:ItemCheckTrace() + local p = self:GetOwner() + p:LagCompensation( true ) + tracedef.filter = p + tracedef.start = p:EyePos() + tracedef.endpos = p:EyePos() + (p:GetAimVector() * 72) + local trace = util.TraceHull(tracedef) + p:LagCompensation( false ) + return trace +end + +function SWEP:SetActive( ent ) + local p = self:GetOwner() + if ent:GetOwner() != p then return false end + if self:GetActiveR():IsValid() then self:Deactive() end + self:SetActiveR( ent ) + self:ItemR( "Deploy" ) + return true +end + +function SWEP:Deactive() + local p = self:GetOwner() + self:SetActiveR( NULL ) +end + +function SWEP:PrimaryAttack() + local p = self:GetOwner() + if self:ItemR() then + self:ItemR("Attack") + else + local trace = self:ItemCheckTrace() + self:EquipItem( trace.Entity ) + end +end + +function SWEP:Reload() + if self:ItemR() then + self:ItemR("Reload") + end +end + +function SWEP:SecondaryAttack() + local p = self:GetOwner() + if p:KeyPressed(IN_ATTACK2) then + self:DropItem() + end +end + +if SERVER then + util.AddNetworkString("AEINV_PredictItem") +else + net.Receive("AEINV_PredictItem", function() + local ent = net.ReadEntity() + if ent:IsValid() then + ent:SetPredictable( net.ReadBool() ) + else + print("Tried to make an ent predictable") + end + end) +end + +function SWEP:EquipItem( ent ) + local p = self:GetOwner() + if CLIENT then print("FUCK OFF") debug.Trace() return end + if IsValid(ent) and ent.AEItem then + if ent:GetOwner() != NULL then + print( ent, "belongs to", ent:GetOwner(), "!! Not equipping." ) + return + end + if p:GetInventory()[ent] then + print( ent, "is in", p, "'s inventory!" ) + return + end + print("Pick up", ent) + + ent:AddEFlags( EFL_KEEP_ON_RECREATE_ENTITIES ) + ent:RemoveEffects( EF_ITEM_BLINK ) + ent:SetParent( p ) + ent:SetOwner( p ) + ent:SetPos( vector_origin ) + ent:SetAngles( Angle( 0, p:EyeAngles().y, 0 ) ) + ent:SetAcquisition( CurTime() ) + + ent:EmitSound( "ae/items/pickup.ogg", 70, 100, 1, CHAN_STATIC ) + + --self:SetActive( ent ) + local inv = p:GetInventory() + inv[ent] = true + inv:Sync() + + net.Start("AEINV_PredictItem") + net.WriteEntity( ent ) + net.WriteBool( true ) + net.Send( p ) + end +end + +function SWEP:DropItem() + local p = self:GetOwner() + local ent = self:GetActiveR() + if CLIENT then print("FUCK OFF") debug.Trace() return end + if ent:IsValid() then + ent:SetParent( NULL ) + ent:SetOwner( NULL ) + + local ep = ent:GetPhysicsObject() + ent:RemoveEFlags( EFL_KEEP_ON_RECREATE_ENTITIES ) + ent:AddEffects( EF_ITEM_BLINK ) + ent:SetPos( p:EyePos() + p:GetAimVector() * 0 ) + ent:SetAngles( p:EyeAngles() + Angle( 0, 180, 0 ) ) + + self:Deactive() + + local inv = p:GetInventory() + inv[ent] = nil + inv:Sync() + + local ep = ent:GetPhysicsObject() + ep:SetVelocity( p:GetAimVector() * 700 ) + ep:SetAngleVelocity( Vector( 0, -360*4, 0 ) ) + ep:Wake() + net.Start("AEINV_PredictItem") + net.WriteEntity( ent ) + net.WriteBool( false ) + net.Send( p ) + end +end + +function SWEP:Think() + local p = self:GetOwner() + + if p:IsValid() then + if self:ItemR() then + self:ItemR("Think") + end + else + print( self, "Thinking without an owner." ) + end +end + +function SWEP:Deploy() +end + +function SWEP:Holster() +end \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/items/sh_definitions.lua b/gamemodes/benny/gamemode/modules/items/sh_definitions.lua new file mode 100644 index 0000000..b830cb6 --- /dev/null +++ b/gamemodes/benny/gamemode/modules/items/sh_definitions.lua @@ -0,0 +1,117 @@ + +ITEMS = {} + +local itemmeta = {} + +function itemmeta:__tostring() + return "ItemDef [" .. self.ClassName .. "]" +end + +local ITEMHELPER = { + Get = function( self, key ) + return self.key + end, + GetRaw = function( self, key ) + return rawget( self, key ) + end, +} + +function itemmeta.__index( self, key ) + if ITEMHELPER[key] then return ITEMHELPER[key] end + if rawget(self, "BaseClass") then + return rawget(self, "BaseClass")[key] + end +end + +function AddItem( itemname, item ) + if item then + ITEMS[itemname] = item + item.ClassName = itemname + item.BaseClass = ITEMS[item.Base] + setmetatable( item, itemmeta ) + else + return ITEMS[itemname] + end +end + +AddItem( "base", { + PrintName = "Base Item", + + Vars = { + ["Float"] = { + "Acquisition", + }, + }, + + ["Initialize"] = function( class, ent, handler ) + print( class, "Initialized base initialization" ) + end, + + ["Deploy"] = function( class, ent, handler ) + end, + + ["Holster"] = function( class, ent, handler ) + end, + + ["Attack"] = function( class, ent, handler ) + end, + + ["Think"] = function( class, ent, handler ) + end, + + ["Reload"] = function( class, ent, handler ) + end, +}) + +AddItem( "base_firearm", { + PrintName = "Base Firearm", + Base = "base", + + Vars = { + ["Int"] = { + "Clip", + "BurstCount", + }, + ["Float"] = { + "Delay", + "DelayBurst", + "RefillTime", + "Accuracy_Reset", + "Accuracy_Amount", + "DelayReload", + }, + }, + + Delay = 0.1, + Pellets = 1, + ClipSize = 15, + BurstCount = math.huge, + BurstRunaway = false, + BurstAuto = false, + BurstDelay = 0, + + ["Initialize"] = function( class, ent, handler ) + ITEMS["base"].Initialize( class, ent, handler ) + + ent:SetClip( class.ClipSize ) + + print( class, "Initialized a firearm" ) + end, +}) + +AddItem( "mk23", { + PrintName = "MK.23", + Base = "base_firearm", + + Model = "models/weapons/w_pist_usp.mdl", + + ClipSize = 12, + Delay = (60/300), + FireSound = "weapons/usp/usp_unsil-1.wav", + + Accuracy = 5/60, + BurstCount = 1, + Accuracy_Add = 0.5, + Accuracy_Reset = 0.4, + Accuracy_Decay = 5, +}) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua b/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua deleted file mode 100644 index 01350cf..0000000 --- a/gamemodes/benny/gamemode/modules/meta/sh_itemdef.lua +++ /dev/null @@ -1,53 +0,0 @@ - ---[[ - 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 = {} - -ItemDefHelpers = { - Get = function( self, key ) - return self.key - end, - GetRaw = function( self, key ) - return rawget( self, key ) - end, -} - -function ItemDef.__index( self, key ) - if ItemDefHelpers[key] then return ItemDefHelpers[key] end - if rawget(self, "BaseClass") then - return 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] - - setmetatable( newdef, ItemDef ) - WEAPONS[classname] = newdef - 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 deleted file mode 100644 index b5814e4..0000000 --- a/gamemodes/benny/gamemode/modules/meta/sh_itemlive.lua +++ /dev/null @@ -1,5 +0,0 @@ - ---[[ - Your Name Is Benny - Item existance -]] \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua deleted file mode 100644 index 30ef2bd..0000000 --- a/gamemodes/benny/gamemode/modules/weapons/_sh_weapons.lua +++ /dev/null @@ -1,735 +0,0 @@ - -do -- Toolgun - - - 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 -- Handguns - -end - -do -- SMGs & PDWs - -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:bWepTable( true ) and self:bWepTable( 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 = "b-gr_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 = "b-gr_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 = "b-gr_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 = "b-gr_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 = "b-gr_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 = "b-gr_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 = "b-gr_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 deleted file mode 100644 index 530ea9d..0000000 --- a/gamemodes/benny/gamemode/modules/weapons/_sh_weapons_forlater.lua +++ /dev/null @@ -1,326 +0,0 @@ - ---[[ - - - - WEAPONS["m92"] = { - Name = "M92FS", - Description = "Accurate pistol, but low caliber won't do much against armor.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_elite_single.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "M92.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_Reload = "USP.Reload", - Sound_MagOut = "USP.MagOut", - Sound_MagIn = "USP.MagIn", - - Delay = (60/400), - Firemodes = FIREMODE_SEMI, - Ammo = 15, - Damage = 30, - - Features = "firearm", - } - - WEAPONS["p226"] = { - Name = "P226", - Description = "Special forces pistol in fast .357 ammo.", - Type = "pistol", - - Icon = Material( "benny/weapons/mk23.png", "smooth" ), - WModel = "models/weapons/w_pist_p228.mdl", - HoldType = "revolver", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Sound_Fire = "P226.Fire", - Sound_DryFire = "Common.Dryfire.Pistol", - Sound_Reload = "USP.Reload", - Sound_MagOut = "P226.MagOut", - Sound_MagIn = "P226.MagIn", - - Delay = (60/350), - Firemodes = FIREMODE_SEMI, - Ammo = 13, - Damage = 30, - - Features = "firearm", - } - - WEAPONS["cqb70"] = { - Name = "CS-70", - Description = "meow", - Type = "shotgun", - - WModel = "models/weapons/w_shot_cs3.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/120), - Firemodes = FIREMODE_SEMI, - Ammo = 4, - Damage = 10, - Pellets = 8, - Spread = 150/60, - - Features = "firearm", - } - - WEAPONS["m12ak"] = { - Name = "M12AK", - Description = "meow", - Type = "shotgun", - - WModel = "models/weapons/w_shot_saiga.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/160), - Firemodes = FIREMODE_SEMI, - Ammo = 5, - Damage = 10, - Pellets = 8, - Spread = 150/60, - - Features = "firearm", - } - -WEAPONS["g_gas"] = { - Name = "GAS GRENADE", - Description = "Short burst of gas that slows and disorient targets.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_gas", - 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_claymore"] = { - Name = "CLAYMORE", - Description = "Mine that shoots shrapnel in a cone.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_claymore", - 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_scrambler"] = { - Name = "SCRAMBLER", - Description = "Disrupts enemy radar based on proximity.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_scrambler", - 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_emp"] = { - Name = "EMP NADE", - Description = "Disrupts enemy equipment based on proximity.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_emp", - 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_shockcharge"] = { - Name = "SHOCK CHARGE", - Description = "Charge that stuns and forces enemies to fire their weapons.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_shockcharge", - 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_thermobaric"] = { - Name = "THERMOBARIC GRENADE", - Description = "Burns through armor.", - Type = "grenade", - - Custom_Fire = GrenadeFire, - Custom_Reload = GrenadeReload, - Custom_Think = GrenadeThink, - Custom_Holster = GrenadeHolster, - GrenadeEnt = "b-gr_thermobaric", - GrenadeFuse = 4, - GrenadeCharge = true, - - WModel = "models/weapons/w_eq_flashbang.mdl", - HoldType = "grenade", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_GRENADE, 0 }, - - Features = "grenade", -} - - - -WEAPONS["e_tacinsertion"] = { - Name = "TACTICAL INSERTION", - Description = "Flare that changes your deployment location.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_cover"] = { - Name = "DEPLOYABLE COVER", - Description = ".", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_ddos"] = { - Name = "DDOS", - Description = ".", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_trophysystem"] = { - Name = "TROPHY SYSTEM", - Description = "Disrupts enemy equipment.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_portableradar"] = { - Name = "PORTABLE RADAR", - Description = "Detects nearby enemies based on proximity.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_cameraspike"] = { - Name = "CAMERA SPIKE", - Description = "Mountable camera that gives you a live video feed.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_recondrone"] = { - Name = "RECON DRONE", - Description = "Pilotable hovering recon drone that automatically marks enemies.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_gasdrone"] = { - Name = "GAS DRONE", - Description = "Drone that dispenses toxic gas onto an area.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_suppressionmine"] = { - Name = "SUPPRESSION MINE", - Description = "Mine that detonates to dispense hard-to-see sleeping gas.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -WEAPONS["e_antiarmor"] = { - Name = "ANTI-ARMOR ROUNDS", - Description = "Ammo crate that dispenses armor to disable vehicles.", - Type = "equipment", - - WModel = "models/weapons/w_eq_flashbang.mdl", - - Features = "grenade", -} - -]] \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua b/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua deleted file mode 100644 index 0c0d04b..0000000 --- a/gamemodes/benny/gamemode/modules/weapons/sh_weapons.lua +++ /dev/null @@ -1,1459 +0,0 @@ - -local FIREMODE_AUTO = { - { Mode = math.huge }, -} -local FIREMODE_AUTOSEMI = { - { Mode = math.huge }, - { Mode = 1 }, -} -local FIREMODE_SEMI = { - { Mode = 1 }, -} - -do -- Sound definitions - - 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 ) - - -- Pistols - -- 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 ) - - -- 1911 - 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( "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 ) - - -- Nambu - 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( "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 ) - - -- USP - 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( "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 ) - - -- M92 - AddSound( "M92.Fire", { - "benny/weapons/m92/01.ogg", - "benny/weapons/m92/02.ogg", - "benny/weapons/m92/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - -- P226 - AddSound( "P226.Fire", { - "benny/weapons/p226/01.ogg", - "benny/weapons/p226/02.ogg", - "benny/weapons/p226/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - -- M92 - 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 ) - - -- P226 - 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 ) - - -- CZ-75A - AddSound( "CZ75A.MagOut", "benny/weapons/cz75a/magout.ogg", 70, 100, 0.5, CHAN_STATIC ) - AddSound( "CZ75A.MagIn", "benny/weapons/cz75a/magin.ogg", 70, 100, 0.5, CHAN_STATIC ) - - - -- SMGs - -- Bizon - 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( "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 ) - - -- MP5K - 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( "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 ) - - -- MAC11 - 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( "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 ) - - -- MP7 - 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( "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 ) - - -- TMP - 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( "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 ) - - - -- Rifles - -- FNC - 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( "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 ) - - -- M16A2 - 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( "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 ) - - - -- Shotguns - -- AA12 - AddSound( "AA12.Fire", "benny/weapons/aa12/01.ogg", 140, 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 ) - - -- SPAS-12 - 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( "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 ) - - - -- Machine Guns - -- QBB-LSW - 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 ) - - -- Stoner 63 - AddSound( "Stoner63.Fire", { - "benny/weapons/stoner63/01.ogg", - "benny/weapons/stoner63/02.ogg", - "benny/weapons/stoner63/03.ogg", - }, 140, 100, 0.5, CHAN_STATIC ) - - - -- Snipers - -- Barrett .50 - 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( "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 ) - - -end - -do -- Bases - - ItemDef("base", { - Name = "Base Item", - Category = "base", - Type = "base", - Description = "Base of everything", - Hide = true, - - WModel = "models/weapons/w_357.mdl", - - Speed_Move = 1, - Speed_Aiming = 1, - Speed_Reloading = 1, - Speed_Firing = 1, - Speed_FiringTime = 0.2, - ShootHolsterTime = 0, - - Init_Item = function( class, item, class_for ) - print( class, ": Base says hi") - end, - - Func_Attack = function( self, hand ) - end, - - Func_AttackAlt = function( self, hand ) - end, - - Func_Reload = function( self, hand ) - end, - - Func_Deploy = function( self, hand ) - end, - - Func_HolsterStart = function( self, hand ) - end, - - Func_HolsterFinish = function( self, hand ) - end, - }) - - ItemDef("base_firearm", { - Name = "Base Firearm", - Category = "base", - Base = "base", - Description = "Base for firearms", - Features = "firearm", - Hide = true, - - WModel = "models/weapons/w_pistol.mdl", - HoldType = "pistol", - - -- Firearm specific - Firemodes = { - { - Mode = 1, - }, - }, - - Damage = 0, - AmmoStd = 1, - Pellets = 1, - Delay = 60/600, - - Spread = 0, - SpreadAdd = 0, - SpreadAddMax = 1, - - SpreadDecay_Start = 1, - SpreadDecay_End = 2, - SpreadDecay_RampTime = 1, - - Reload_MagOut = 0.2, - Reload_MagIn = 0.8, - Reload_MagIn_Bonus1 = 0.56, - Reload_MagIn_Bonus2 = 0.56+0.1, - - Init_Item = function( class, item ) - if class.BaseClass:GetRaw( "Init_Item" ) then - class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item ) - end - print( class, ": Firearm init" ) - item.Loaded = "" - end, - - Func_Attack = function( self, hand ) - if self:GetAim() == 1 then - local p = self:GetOwner() - local wep_table = self:bWepTable( hand ) - local wep_class = self:bWepClass( hand ) - if self:bGetIntDelay( hand ) > CurTime() then - return - end - if self:bGetHolsterTime( hand ) > 0 then - return - end - if self:bGetIntClip( hand ) == 0 then - if self:bGetBurst( hand ) >= 1 then - return - end - B_Sound( self, wep_class.Sound_DryFire ) - self:bSetBurst( hand, self:bGetBurst( hand ) + 1 ) - return - end - if self:bGetBurst( hand ) >= self:B_Firemode( hand ).Mode then - return - end - - if !ConVarSV_Bool("cheat_infiniteammo") then - self:B_Ammo( hand, self:bGetIntClip( hand ) - 1 ) - end - - B_Sound( self, wep_class.Sound_Fire ) - self:TPFire( hand ) - self:CallFire( hand ) - - 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 - -- PROTO: This is shit! Replace it with a function that gets the right model. - if IsValid(hand and self.CWM_Left or self.CWM) and (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ) then - local vStart = (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ).Pos - local ed = EffectData() - ed:SetOrigin( vStart ) - ed:SetEntity( self ) - ed:SetAttachment( (hand and 16 or 0) + 1 ) - util.Effect( "benny_muzzleflash", ed ) - end - end - end - end, - - Func_AttackAlt = function( self, hand ) - if self:bGetIntDelay( hand ) > CurTime() then - return - end - self:bSetIntDelay( hand, CurTime() + 0.45 ) - - self:TPCustom( ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2, 0.36 ) - - local p = self:GetOwner() - - local tr = { - start = p:EyePos(), - endpos = p:EyePos() + p:EyeAngles():Forward()*64, - mins = Vector( -8, -8, -8 ), - maxs = Vector( 8, 8, 8 ), - filter = p, - collisiongroup = COLLISION_GROUP_PLAYER, - } - -- debugoverlay.SweptBox( tr.start, tr.endpos, tr.mins, tr.maxs, angle_zero, 3, Color( 255, 255, 255, 0 )) - - if p:IsPlayer() then p:LagCompensation( true ) end - tr = util.TraceHull(tr) - if p:IsPlayer() then p:LagCompensation( false ) end - - if tr.HitWorld then - self:EmitSound( "physics/concrete/concrete_block_impact_hard1.wav", 70, 150 + util.SharedRandom( "Benny_RifleMelee", -20, 20 ), 0.25 ) - elseif tr.Entity and tr.Entity != NULL then - self:EmitSound( "benny/violence/bodysplat_mix.ogg", 70, 100 + util.SharedRandom( "Benny_RifleMelee", -10, 10 ), 0.25 ) - - if SERVER then - local dmginfo = DamageInfo() - dmginfo:SetAttacker( p ) - dmginfo:SetInflictor( self ) - dmginfo:SetDamage( 34 ) - - dmginfo:SetDamagePosition( tr.HitPos ) - dmginfo:SetDamageForce( tr.Normal*100*34 ) - - tr.Entity:TakeDamageInfo( dmginfo ) - end - - else - self:EmitSound( "weapons/slam/throw.wav", 70, 200 + util.SharedRandom( "Benny_RifleMelee", -20, 20 ), 0.25 ) - end - end, - }) - - local q1, q2 = Vector( -1, -1, -1 ), Vector( 1, 1, 1 ) - ItemDef("base_melee", { - Name = "Base Melee", - Category = "melee", - Base = "base", - Description = "Base for melee weapons", - Features = "melee", - Hide = true, - - WModel = "models/weapons/w_crowbar.mdl", - HoldType = "melee", - - Damage = 34, - Force = 100, - Delay = 0.45, - Range = 64, - HullSize = 2, - - Init_Item = function( class, item ) - if class.BaseClass:GetRaw( "Init_Item" ) then - class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item ) - end - print( class, ": Melee init" ) - end, - - Func_Attack = function( self, hand ) - if self:bGetIntDelay( hand ) > CurTime() then - return - end - local wep_table = self:bWepTable( hand ) - local wep_class = self:bWepClass( hand ) - self:bSetIntDelay( hand, CurTime() + wep_class.Delay ) - - self:TPCustom( wep_class.GestureFire[1], wep_class.GestureFire[2] ) - - local p = self:GetOwner() - - q1[1] = -wep_class.HullSize - q1[2] = -wep_class.HullSize - q1[3] = -wep_class.HullSize - q2[1] = wep_class.HullSize - q2[2] = wep_class.HullSize - q2[3] = wep_class.HullSize - local range = p:EyeAngles():Forward() - range:Mul(wep_class.Range) - range:Add(p:EyePos()) - local tr = { - start = p:EyePos(), - endpos = range, - mins = q1, - maxs = q2, - filter = p, - collisiongroup = COLLISION_GROUP_PLAYER, - } - -- debugoverlay.SweptBox( tr.start, tr.endpos, tr.mins, tr.maxs, angle_zero, 3, Color( 255, 255, 255, 0 )) - - if p:IsPlayer() then p:LagCompensation( true ) end - tr = util.TraceHull(tr) - if p:IsPlayer() then p:LagCompensation( false ) end - - if tr.HitWorld then - self:EmitSound( "physics/concrete/concrete_block_impact_hard1.wav", 70, 150 + util.SharedRandom( "Benny_RifleMelee", -20, 20 ), 0.25 ) - elseif tr.Entity and tr.Entity != NULL then - self:EmitSound( "benny/violence/bodysplat_mix.ogg", 70, 100 + util.SharedRandom( "Benny_RifleMelee", -10, 10 ), 0.25 ) - - if SERVER then - local dmginfo = DamageInfo() - dmginfo:SetAttacker( p ) - dmginfo:SetInflictor( self ) - dmginfo:SetDamage( wep_class.Damage ) - - dmginfo:SetDamagePosition( tr.HitPos ) - dmginfo:SetDamageForce( tr.Normal*wep_class.Force*wep_class.Damage ) - - tr.Entity:TakeDamageInfo( dmginfo ) - end - - else - self:EmitSound( "weapons/slam/throw.wav", 70, 200 + util.SharedRandom( "Benny_RifleMelee", -20, 20 ), 0.25 ) - end - end, - - Func_AttackAlt = function( self, hand ) - end, - }) - - ItemDef("base_grenade", { - Name = "Base Grenade", - Category = "grenade", - Base = "base", - Description = "Base for grenades", - Features = "grenade", - Hide = true, - - Init_Item = function( class, item ) - if class.BaseClass:GetRaw( "Init_Item" ) then - class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item ) - end - print( class, ": Grenade init" ) - end, - - WModel = "models/weapons/w_grenade.mdl", - HoldType = "slam", - }) - - ItemDef("base_magazine", { - Name = "Base Magazine", - Category = "magazine", - Base = "base", - Description = "Base for magazines", - Features = "magazine", - Hide = true, - - -- - AmmoStd = 0, - AutoGenMag = false, - - Init_Item = function( class, item ) - if class.BaseClass:GetRaw( "Init_Item" ) then - class.BaseClass:GetRaw( "Init_Item" )( class.BaseClass, item ) - end - print( class, ": Clip init" ) - item.Ammo = class.Ammo - end, - - WModel = "models/weapons/w_slam.mdl", - HoldType = "slam", - }) - -end - -do -- Toolgun - - local ToolGunTools = { - ["ammocrate"] = function( self, p, tr ) - if SERVER then - local summon = ents.Create( "b-eq_ammo" ) - summon:SetPos( tr.HitPos + tr.HitNormal ) - summon:Spawn() - end - end, - ["summon_human"] = function( self, p, tr ) - if SERVER then - local summon = ents.Create( "b-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", - Base = "base", - Category = "special", - Equipable = true, - - WModel = "models/weapons/w_toolgun.mdl", - HoldType = "revolver", - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - - -- These for some reason aren't taken by the base correctly - Init_Item = function() - end, - Speed_Move = 1, - Speed_Aiming = 1, - Speed_Reloading = 1, - Speed_Firing = 1, - Speed_FiringTime = 0.2, - ShootHolsterTime = 0, - -- - - Func_Attack = 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, - - Func_Reload = function( self, data ) - if CLIENT then - CreateSelect() - end - - -- Return true to skip weapon logic - return true - end, - } - -end - -do -- Melee - - ItemDef("bat", { - Name = "ALUMINUM BAT", - Description = "Bonk!", - Base = "base_melee", - - MAdj = Vector( 3, -2, 3 ), - MAdjA = Angle( 0, 0, 180 ), - WModel = "models/benny/wep/melee_bat.mdl", - HoldType = "melee2", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - -- - Damage = 34, - Force = 100, - Delay = 0.45, - Range = 72, - HullSize = 2, - }) - - ItemDef("bat_wood", { - Name = "BASEBALL BAT", - Description = "There's my ball!", - Base = "base_melee", - - MAdj = Vector( 3, -2, 3 ), - MAdjA = Angle( 0, 0, 180 ), - WModel = "models/benny/wep/melee_bat.mdl", - HoldType = "melee2", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - -- - Damage = 34, - Force = 100, - Delay = 0.5, - Range = 72, - HullSize = 2, - }) - - ItemDef("machete", { - Name = "MACHETE", - Description = "Chop chop!", - Base = "base_melee", - - MAdj = Vector( 3, -2, 0 ), - MAdjA = Angle( 0, 0, 180 ), - WModel = "models/benny/wep/melee_machete.mdl", - HoldType = "melee", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE, 0.2 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - -- - Damage = 34, - Force = 100, - Delay = 0.4, - Range = 64, - HullSize = 2, - }) - - ItemDef("kabar", { - Name = "KABAR", - Description = "Shank shank!", - Base = "base_melee", - - MAdj = Vector( 3, -2, 0 ), - MAdjA = Angle( 0, 0, 180 ), - WModel = "models/benny/wep/melee_kabar.mdl", - HoldType = "knife", - GestureFire = { ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE2, 0.0 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - -- - Damage = 34, - Force = 100, - Delay = 0.35, - Range = 48, - HullSize = 2, - }) - - ItemDef("baton", { - Name = "BATON", - Description = "Excessive force!", - Base = "base_melee", - - MAdj = Vector( 3, -2, 0 ), - MAdjA = Angle( 0, 0, 180 ), - WModel = "models/benny/wep/melee_baton.mdl", - HoldType = "melee2", - GestureFire = { ACT_GMOD_GESTURE_MELEE_SHOVE_1HAND, 0.3 }, - GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 }, - - -- - Damage = 34, - Force = 100, - Delay = 0.45, - Range = 64, - HullSize = 2, - }) - -end - -do -- Pistols - - ItemDef("deagle", { - Name = "DEAGLE", - Description = "Autoloading .50 caliber pistol.", - Base = "base_firearm", - Category = "pistol", - - 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", - Sound_MagOut = "Anaconda.MagOut", - Sound_MagIn = "Anaconda.MagIn", - Sound_Cock = "Deagle.Cock", - - -- - AmmoStd = 7, - AutoGenMag = true, - 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, - }) - - ItemDef("cz75a", { - Name = "CZ-75A", - Description = "Automatic pocket machine pistol!", - Base = "base_firearm", - Category = "pistol", - - WModel = "models/weapons/w_pist_pmt.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 = 12, - AutoGenMag = true, - Delay = (60/1100), - 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, - }) - - 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, - }) - - ItemDef("1911", { - Name = "COBRA .45", - Description = "Hits hard. They don't make them like they used to!", - Base = "base_firearm", - Category = "pistol", - - 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", - - -- - AmmoStd = 8, - AutoGenMag = true, - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - 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, - }) - - ItemDef("mk23", { - Name = "MK. 23", - Description = "If it works for hardasses around the world, it'll work for you.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 12, - AutoGenMag = true, - Delay = (60/300), - Firemodes = FIREMODE_SEMI, - 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, - }) - - ItemDef("nambu", { - Name = "NAMBU .38", - Description = "Eastern revolver that hits as hard as it costs.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 6, - AutoGenMag = true, - Delay = (60/180), - Firemodes = FIREMODE_SEMI, - 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, - }) - - ItemDef("anaconda", { - Name = "ANACONDA", - Description = "Precise and kicks like a mule.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 6, - AutoGenMag = true, - Delay = (60/180), - Firemodes = FIREMODE_SEMI, - 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, - }) - -end - -do -- SMGs - - ItemDef("tmp", { - Name = "TMP", - Description = "Small, compact, and favored by private security.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 15, - AutoGenMag = true, - Delay = (60/650), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("mp7", { - Name = "MP7", - Description = "Small, pistol-sized, goes through kevlar like a knife.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 20, - AutoGenMag = true, - Delay = (60/900), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("mp5k", { - Name = "MP5K", - Description = "Quality manufacturing, but a cumbersome reload.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 15, - AutoGenMag = true, - Delay = (60/750), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("mac11", { - Name = "MAC-11", - Description = "More fit for combat in a phone booth.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 16, - AutoGenMag = true, - Delay = (60/1400), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("bizon", { - Name = "BIZON", - Description = "Unwieldy bullet storm.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 40, - AutoGenMag = true, - Delay = (60/700), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("chicom", { - Name = "QCW-CQB-21", - Description = "Subsonic bullpup SMG.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 36, - AutoGenMag = true, - Delay = (60/1050), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - -end - -do -- Rifles - - ItemDef("fnc", { - Name = "FNC PARA", - Description = "Run of the mill automatic assault rifle.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 30, - AutoGenMag = true, - Delay = (60/700), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("qbz", { - Name = "QBZ-95", - Description = "Bullpup assault rifle. Low profile, great in close quarters.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 30, - AutoGenMag = true, - Delay = (60/800), - Firemodes = FIREMODE_AUTOSEMI, - 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, - }) - - ItemDef("m16a2", { - Name = "M16A2", - Description = "Burst-fire assault rifle. Precise and effective at range.", - Base = "base_firearm", - Category = "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", - - -- - AmmoStd = 30, - AutoGenMag = true, - Delay = (60/700), - Firemodes = { - { Mode = 3 }, - { Mode = 1 }, - }, - 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, - }) - -end - -for i, v in SortedPairs( WEAPONS ) do - if v.AutoGenMag then - ItemDef("mag_" .. i, { - Name = "MAG: " .. v.Name, - Base = "base_magazine", - - Ammo = v.AmmoStd, - }) - end -end ---[[ -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