diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /entities/weapons | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'entities/weapons')
41 files changed, 6756 insertions, 0 deletions
diff --git a/entities/weapons/rad_ak47/shared.lua b/entities/weapons/rad_ak47/shared.lua new file mode 100644 index 0000000..36d2799 --- /dev/null +++ b/entities/weapons/rad_ak47/shared.lua @@ -0,0 +1,37 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.PrintName = "AK-47" + SWEP.IconLetter = "b" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_ak47.mdl" +SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" + +SWEP.SprintPos = Vector (-1.3057, -4.167, 0.3971) +SWEP.SprintAng = Vector (-9.8658, -38.0733, 13.8555) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_AK47.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 55 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_awp/shared.lua b/entities/weapons/rad_awp/shared.lua new file mode 100644 index 0000000..f20fd07 --- /dev/null +++ b/entities/weapons/rad_awp/shared.lua @@ -0,0 +1,46 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "AWP" + SWEP.IconLetter = "r" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_awp.mdl" +SWEP.WorldModel = "models/weapons/w_snip_awp.mdl" + +SWEP.SprintPos = Vector(-2.4134, -2.7816, 0.4499) +SWEP.SprintAng = Vector(-4.2748, -48.8937, -0.0962) + +SWEP.ZoomModes = { 0, 35, 5 } +SWEP.ZoomSpeeds = { 0.25, 0.30, 0.30 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_AWP.Single" ) +SWEP.Primary.Recoil = 17.5 +SWEP.Primary.Damage = 175 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.SniperCone = 0.015 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.8 +SWEP.MaxShellDelay = 1.0 diff --git a/entities/weapons/rad_axe/shared.lua b/entities/weapons/rad_axe/shared.lua new file mode 100644 index 0000000..2411957 --- /dev/null +++ b/entities/weapons/rad_axe/shared.lua @@ -0,0 +1,213 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 80 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Axe" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_axe/v_axe.mdl" +SWEP.WorldModel = "models/weapons/w_axe.mdl" + +SWEP.HoldPos = Vector (1.1747, -16.6759, -5.7913) +SWEP.HoldAng = Vector (23.7548, -8.0105, -5.154) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact2.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 100 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + if SERVER then + + self.Owner:AddStamina( -4 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + +end + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + local line = {} + line.start = pos + line.endpos = pos + aim + line.filter = self.Owner + + local linetr = util.TraceLine( line ) + + local tr = {} + tr.start = pos + self.Owner:GetAimVector() * -5 + tr.endpos = pos + aim + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + local trace = util.TraceHull( tr ) + local ent = trace.Entity + local ent2 = linetr.Entity + + if not IsValid( ent ) and IsValid( ent2 ) then + + ent = ent2 + + end + + if not IsValid( ent ) then + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.AxeHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + ent:SetHeadshotter( self.Owner, true ) + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + local snd = table.Random( GAMEMODE.AxeHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_base/shared.lua b/entities/weapons/rad_base/shared.lua new file mode 100644 index 0000000..63ef374 --- /dev/null +++ b/entities/weapons/rad_base/shared.lua @@ -0,0 +1,958 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = false + SWEP.CSMuzzleFlashes = true + + SWEP.ViewModelFOV = 75 + SWEP.ViewModelFlip = true + + SWEP.PrintName = "BASE WEAPON" + SWEP.IconLetter = "c" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + SWEP.IconFont = "CSSelectIcons" + + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) + //draw.SimpleText( self.IconLetter, self.IconFont, x + wide/2, y + tall/2.5, Color( 15, 20, 200, 255 ), TEXT_ALIGN_CENTER ) + end + +end + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.SprintPos = Vector(0,0,0) +SWEP.SprintAng = Vector(0,0,0) + +SWEP.ZoomModes = { 0, 50, 10 } +SWEP.ZoomSpeeds = { 5, 5, 5 } + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Empty = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "Weapon_USP.Single" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 10 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.025 +SWEP.Primary.SniperCone = 0.025 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.Ammo = "Pistol" +SWEP.Primary.ClipSize = 50 +SWEP.Primary.DefaultClip = 200 +SWEP.Primary.Automatic = false + +SWEP.Secondary.Sound = Sound( "weapons/zoom.wav" ) +SWEP.Secondary.Laser = Sound( "weapons/ar2/ar2_empty.wav" ) +SWEP.Secondary.Delay = 0.5 + +SWEP.Secondary.Ammo = "none" +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false + +SWEP.LaserOffset = Vector(0,0,0) +SWEP.HolsterMode = false +SWEP.HolsterTime = 0 +SWEP.LastRunFrame = 0 + +SWEP.MinShellDelay = 0.3 +SWEP.MaxShellDelay = 0.6 + +SWEP.FalloffDistances = {} +SWEP.FalloffDistances[ "Sniper" ] = { Range = 3500, Falloff = 8000 } +SWEP.FalloffDistances[ "Rifle" ] = { Range = 2000, Falloff = 2000 } +SWEP.FalloffDistances[ "SMG" ] = { Range = 1500, Falloff = 1500 } +SWEP.FalloffDistances[ "Pistol" ] = { Range = 1000, Falloff = 500 } +SWEP.FalloffDistances[ "Buckshot" ] = { Range = 300, Falloff = 500 } + +SWEP.UseShellSounds = true +SWEP.ShellSounds = { "player/pl_shell1.wav", "player/pl_shell2.wav", "player/pl_shell3.wav" } +SWEP.BuckshotShellSounds = { "weapons/fx/tink/shotgun_shell1.wav", "weapons/fx/tink/shotgun_shell2.wav", "weapons/fx/tink/shotgun_shell3.wav" } + +SWEP.Pitches = {} +SWEP.Pitches[ "Pistol" ] = 100 +SWEP.Pitches[ "SMG" ] = 90 +SWEP.Pitches[ "Rifle" ] = 80 +SWEP.Pitches[ "Sniper" ] = 70 +SWEP.Pitches[ "Buckshot" ] = 100 + +function SWEP:GetViewModelPosition( pos, ang ) + + local newpos = nil + local newang = nil + local movetime = 0.25 + local duration = 0//self.Weapon:GetNWInt( "ViewTime", 0 ) + + local pang = self.Owner:EyeAngles() + local vel = self.Owner:GetVelocity() + + //if not newpos or not newang then + + // newpos = pos + // newang = ang + + //end + + local mul = 0 + + self.SwayScale = 1.0 + self.BobScale = 1.0 + + if ( self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 ) or GAMEMODE:ElementsVisible() or self.HolsterMode then + + self.SwayScale = 1.25 + self.BobScale = 1.25 + + if not self.SprintStart then + + self.SprintStart = CurTime() + + end + + mul = math.Clamp( ( CurTime() - self.SprintStart ) / movetime, 0, 1 ) + mul = -( mul - 1 ) ^ 2 + 1 + + newang = self.SprintAng + newpos = self.SprintPos + + else + + if self.SprintStart then + + self.SprintEnd = CurTime() + self.SprintStart = nil + + end + + if self.SprintEnd then + + mul = math.Clamp( ( CurTime() - self.SprintEnd ) / movetime, 0, 1 ) + mul = ( mul - 1 ) ^ 2 + + newang = self.SprintAng + newpos = self.SprintPos + + if mul == 0 then + + self.SprintEnd = nil + + end + + else + + mul = self:GetMoveScale( movetime, duration, mul ) + + end + end + + return self:MoveViewModelTo( newpos, newang, pos, ang, mul ) + +end + +function SWEP:GetMoveScale( movetime, duration, mul ) + + mul = 1 + + if CurTime() - movetime < duration then + + mul = math.Clamp( ( CurTime() - duration ) / movetime, 0, 1 ) + + end + + if self.Weapon:GetNWBool( "ReverseAnim", false ) then + + return -( mul - 1 ) ^ 3 + + end + + return ( mul - 1 ) ^ 3 + 1 + +end + +function SWEP:AngApproach( newang, ang, mul ) + + if not newang then return ang end + + ang:RotateAroundAxis( ang:Right(), newang.x * mul ) + ang:RotateAroundAxis( ang:Up(), newang.y * mul ) + ang:RotateAroundAxis( ang:Forward(), newang.z * mul ) + + return ang + +end + +function SWEP:PosApproach( newpos, pos, ang, mul ) + + local right = ang:Right() + local up = ang:Up() + local forward = ang:Forward() + + if not newpos then return pos end + + pos = pos + newpos.x * right * mul + pos = pos + newpos.y * forward * mul + pos = pos + newpos.z * up * mul + + return pos + +end + +function SWEP:MoveViewModelTo( newpos, newang, pos, ang, mul ) + + ang = self:AngApproach( newang, ang, mul ) + pos = self:PosApproach( newpos, pos, ang, mul ) + + return pos, ang + +end + +function SWEP:Initialize() + + self.Weapon:SetWeaponHoldType( self.HoldType ) + +end + +function SWEP:Deploy() + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + self.Owner:DrawViewModel( true ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Holster() + + return true + +end + +function SWEP:Think() + + self.Weapon:ReloadThink() + + if self.Owner:GetVelocity():Length() > 0 and self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + self.Weapon:UnZoom() + + end + +end + +function SWEP:SetZoomMode( num ) + + if num > #self.ZoomModes then + + num = 1 + + self.Weapon:UnZoom() + + end + + self.Weapon:SetNWInt( "Mode", num ) + + if self.Owner:GetFOV() != self.ZoomModes[num] then + + self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] ) + + end + +end + +function SWEP:GetZoomMode() + + return self.Weapon:GetNWInt( "Mode", 1 ) + +end + +function SWEP:UnZoom() + + if CLIENT then return end + + self.Weapon:SetZoomMode( 1 ) + self.Weapon:SetNWBool( "ReverseAnim", true ) + + self.Owner:DrawViewModel( true ) + +end + +function SWEP:Reload() + + if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + + self.Weapon:SetClip1( self.Primary.ClipSize ) + + return + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + self.Weapon:DoReload() + +end + +function SWEP:StartWeaponAnim( anim ) + + if IsValid( self.Owner ) then + + local vm = self.Owner:GetViewModel() + + local idealSequence = self:SelectWeightedSequence( anim ) + local nextSequence = self:FindTransitionSequence( self.Weapon:GetSequence(), idealSequence ) + + //vm:RemoveEffects( EF_NODRAW ) + //vm:SetPlaybackRate( pbr ) + + if nextSequence > 0 then + + vm:SendViewModelMatchingSequence( nextSequence ) + + else + + vm:SendViewModelMatchingSequence( idealSequence ) + + end + + return vm:SequenceDuration( vm:GetSequence() ) + + end + +end + +function SWEP:DoReload() + + local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD ) + + self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.080 ) + + self.ReloadTime = CurTime() + time + +end + +function SWEP:ReloadThink() + + if self.ReloadTime and self.ReloadTime <= CurTime() then + + self.ReloadTime = nil + self.Weapon:SetClip1( self.Primary.ClipSize ) + + end + +end + +function SWEP:CanSecondaryAttack() + + if self.HolsterMode or self.Owner:KeyDown( IN_SPEED ) or self.LastRunFrame > CurTime() then return false end + + if self.Weapon:Clip1() <= 0 and self.IsSniper then + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + return false + + end + + return true + +end + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.ReloadTime or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + + self.Weapon:EmitSound( self.Primary.Empty ) + + return false + + end + + if self.Weapon:Clip1() <= 0 then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + self.Weapon:DoReload() + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + return false + + end + + return true + +end + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + + if CLIENT then return end + + if self.UseShellSounds then + + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) + local tbl = self.ShellSounds + local pos = self.Owner:GetPos() + + if self.AmmoType == "Buckshot" then + + tbl = self.BuckshotShellSounds + + end + + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) + + end + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetClip1( self.Weapon:Clip1() - self.Primary.NumShots ) + self.Weapon:ShootEffects() + + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) + + else + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + + end + + if self.Weapon:GetZoomMode() > 1 then + + self.Weapon:UnZoom() + + end + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, self.Primary.NumShots * -1 ) + + end + +end + +function SWEP:SecondaryAttack() + + if not self.Weapon:CanSecondaryAttack() then return end + + self.Weapon:SetNextSecondaryFire( CurTime() + 0.25 ) + + if not self.IsSniper then + + self.Weapon:ToggleLaser() + + return + + end + + if SERVER then + + if self.Weapon:GetZoomMode() == 1 then + + self.Owner:DrawViewModel( false ) + + end + + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + + end + + self.Weapon:EmitSound( self.Secondary.Sound ) + +end + +function SWEP:ToggleLaser() + + self.Weapon:EmitSound( self.Secondary.Laser ) + self.Weapon:SetNWBool( "Laser", !self.Weapon:GetNWBool( "Laser", false ) ) + +end + +function SWEP:AdjustMouseSensitivity() + + local num = self.Weapon:GetNWInt( "Mode", 1 ) + local scale = ( self.ZoomModes[ num ] or 0 ) / 100 + + if scale == 0 then + + return nil + + end + + return scale + +end + +function SWEP:GetDamageFalloffScale( distance ) + + local scale = 1 + + if distance > self.FalloffDistances[ self.AmmoType ].Range then + + scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) ) + + end + + return math.Clamp( scale, 0.1, 1.0 ) + +end + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", numbullets ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.75, 0, 10 ) + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 0 + bullet.Force = damage * 2 + bullet.Damage = damage + bullet.AmmoType = "Pistol" + + //if self.IsSniper and self.AmmoType == "Sniper" then + + //bullet.TracerName = "sniper_tracer" + + //end + + bullet.Callback = function( attacker, tr, dmginfo ) + + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) + + if tr.Entity.NextBot then + + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) + + end + + if ( IsValid( tr.Entity ) and tr.Entity:IsPlayer() ) or math.random(1,5) != 1 then return end + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) + + end + + self.Owner:LagCompensation( true ) + + self.Owner:FireBullets( bullet ) + + self.Owner:LagCompensation( false ) + +end + +function SWEP:GetPenetrationDistance( mat_type ) + + if ( mat_type == MAT_PLASTIC || mat_type == MAT_WOOD || mat_type == MAT_ALIENFLESH || mat_type == MAT_FLESH || mat_type == MAT_GLASS ) then + + return 64 + + end + + return 32 + +end + +function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage ) + + if ( mat_type == MAT_GLASS || mat_type == MAT_ALIENFLESH || mat_type == MAT_FLESH ) then + return damage + elseif ( mat_type == MAT_PLASTIC || mat_type == MAT_WOOD ) then + return damage - distance + elseif( mat_type == MAT_TILE || mat_type == MAT_SAND || mat_type == MAT_DIRT ) then + return damage - ( distance * 1.2 ) + end + + return damage - ( distance * 1.8 ) + +end + +--[[function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce ) + + if ( !self or !IsValid( self.Weapon ) ) then return end + + if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then + + local effectdata = EffectData() + effectdata:SetOrigin( tr.HitPos ) + util.Effect( "BloodImpact", effectdata ) + + end + + // Don't go through more than 3 times + if ( bounce > 3 ) then return false end + + // Direction (and length) that we are gonna penetrate + local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType ) + + local PeneTrace = {} + PeneTrace.endpos = tr.HitPos + PeneTrace.start = tr.HitPos + PeneDir + PeneTrace.mask = MASK_SHOT + PeneTrace.filter = { self.Owner } + + local PeneTrace = util.TraceLine( PeneTrace ) + + // Bullet didn't penetrate. + if ( PeneTrace.StartSolid or PeneTrace.Fraction >= 1.0 or tr.Fraction <= 0.0 ) then return false end + + local distance = ( PeneTrace.HitPos - tr.HitPos ):Length() + local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() ) + + if new_damage > 0 then + + local bullet = + { + Num = 1, + Src = PeneTrace.HitPos, + Dir = tr.Normal, + Spread = Vector( 0, 0, 0 ), + Tracer = 0, + Force = 5, + Damage = new_damage, + AmmoType = "Pistol", + } + + bullet.Callback = function ( attacker, tr, dmginfo ) + + if IsValid( self ) and IsValid( self.Weapon ) then + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 ) + + end + + end + + local effectdata = EffectData() + effectdata:SetOrigin( PeneTrace.HitPos ) + effectdata:SetNormal( PeneTrace.Normal ) + util.Effect( "Impact", effectdata ) + + local func = function( attacker, bullet ) + + if IsValid( attacker ) then + + attacker.FireBullets( attacker, bullet, true ) + + end + + end + + timer.Simple( 0.05, function() func( attacker, bullet ) end ) + + if SERVER and tr.MatType != MAT_FLESH then + + sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) ) + + end + + end + +end]] + +function SWEP:BulletPenetration( attacker, tr, dmginfo, bounce ) + + if ( !self or not IsValid( self.Weapon ) ) then return end + + if IsValid( tr.Entity ) and string.find( tr.Entity:GetClass(), "npc" ) then + + local effectdata = EffectData() + effectdata:SetOrigin( tr.HitPos ) + util.Effect( "BloodImpact", effectdata ) + + end + + if ( bounce > 3 ) then return false end + + local PeneDir = tr.Normal * self:GetPenetrationDistance( tr.MatType ) + + local PeneTrace = {} + PeneTrace.endpos = tr.HitPos + PeneTrace.start = tr.HitPos + PeneDir + PeneTrace.mask = MASK_SHOT + PeneTrace.filter = { self.Owner } + + local PeneTrace = util.TraceLine( PeneTrace ) + + if ( PeneTrace.StartSolid || PeneTrace.Fraction >= 1.0 || tr.Fraction <= 0.0 ) then return false end + + local distance = ( PeneTrace.HitPos - tr.HitPos ):Length() + local new_damage = self:GetPenetrationDamageLoss( tr.MatType, distance, dmginfo:GetDamage() ) + + if new_damage > 0 then + + local bullet = + { + Num = 1, + Src = PeneTrace.HitPos, + Dir = tr.Normal, + Spread = Vector( 0, 0, 0 ), + Tracer = 0, + Force = 5, + Damage = new_damage, + AmmoType = "Pistol", + } + + bullet.Callback = function( a, b, c ) + + if IsValid( self ) and IsValid( self.Weapon ) then + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 ) + + end + + end + + local effectdata = EffectData() + effectdata:SetOrigin( PeneTrace.HitPos ); + effectdata:SetNormal( PeneTrace.Normal ); + util.Effect( "Impact", effectdata ) + + timer.Simple( 0.01, function() attacker:FireBullets( bullet, true ) end ) + + if SERVER and tr.MatType != MAT_FLESH and bounce == 0 then + + sound.Play( table.Random( GAMEMODE.Ricochet ), tr.HitPos, 100, math.random(90,120) ) + + end + + end + +end + +function SWEP:ShouldNotDraw() + + return self.Weapon:GetNWBool( "Laser", false ) + +end + +if CLIENT then + + SWEP.CrossRed = CreateClientConVar( "cl_redead_crosshair_r", 255, true, false ) + SWEP.CrossGreen = CreateClientConVar( "cl_redead_crosshair_g", 255, true, false ) + SWEP.CrossBlue = CreateClientConVar( "cl_redead_crosshair_b", 255, true, false ) + SWEP.CrossAlpha = CreateClientConVar( "cl_redead_crosshair_a", 255, true, false ) + SWEP.CrossLength = CreateClientConVar( "cl_redead_crosshair_length", 10, true, false ) + + SWEP.DotMat = Material( "Sprites/light_glow02_add_noz" ) + SWEP.LasMat = Material( "sprites/bluelaser1" ) + +end + +SWEP.CrosshairScale = 1 + +function SWEP:LaserDraw() + + local vm = self.Owner:GetViewModel() + + if IsValid( vm ) then + + local idx = vm:LookupAttachment( "1" ) + + if idx == 0 then idx = vm:LookupAttachment( "muzzle" ) end + + local trace = util.GetPlayerTrace( ply ) + local tr = util.TraceLine( trace ) + local tbl = vm:GetAttachment( idx ) + + local pos = tr.HitPos + + if vm:GetSequence() != ACT_VM_IDLE then + + self.AngDiff = ( tbl.Ang - self.LastGoodAng ):Forward() + + trace = {} + trace.start = tbl.Pos or Vector(0,0,0) + trace.endpos = trace.start + ( ( EyeAngles() + self.AngDiff ):Forward() * 99999 ) + trace.filter = { self.Owner, self.Weapon } + + local tr2 = util.TraceLine( trace ) + + pos = tr2.HitPos + + else + + self.LastGoodAng = tbl.Ang + + end + + cam.Start3D( EyePos(), EyeAngles() ) + + local dir = ( tbl.Ang ):Forward() + local start = tbl.Pos + + render.SetMaterial( self.LasMat ) + + for i=0,254 do + + render.DrawBeam( start, start + dir * 5, 2, 0, 12, Color( 255, 0, 0, 255 - i ) ) + + start = start + dir * 5 + + end + + local dist = tr.HitPos:Distance( EyePos() ) + local size = math.Rand( 6, 7 ) + local dotsize = dist / size ^ 2 + + render.SetMaterial( self.DotMat ) + render.DrawQuadEasy( pos, ( EyePos() - tr.HitPos ):GetNormal(), dotsize, dotsize, Color( 255, 0, 0, 255 ), 0 ) + + cam.End3D() + + end + +end + +function SWEP:DrawHUD() + + if self.Weapon:ShouldNotDraw() then return end + + if self.Weapon:GetNWBool( "Laser", false ) then return end + + local mode = self.Weapon:GetZoomMode() + + if not self.IsSniper or mode == 1 then + + local cone = self.Primary.Cone + local scale = cone + + if self.IsSniper then + + cone = self.Primary.SniperCone + scale = cone + + end + + local x = ScrW() * 0.5 + local y = ScrH() * 0.5 + local scalebywidth = ( ScrW() / 1024 ) * 10 + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = cone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( cone / 1.75, 0, 10 ) + + end + + scale = scale * scalebywidth + + local dist = math.abs( self.CrosshairScale - scale ) + self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) + + local gap = 40 * self.CrosshairScale + local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale + + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) + surface.DrawLine( x - length, y, x - gap, y ) + surface.DrawLine( x + length, y, x + gap, y ) + surface.DrawLine( x, y - length, x, y - gap ) + surface.DrawLine( x, y + length, x, y + gap ) + + return + + end + + if mode != 1 then + + local w = ScrW() + local h = ScrH() + local wr = ( h / 3 ) * 4 + + surface.SetTexture( surface.GetTextureID( "gmod/scope" ) ) + surface.SetDrawColor( 0, 0, 0, 255 ) + surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h ) + + surface.SetDrawColor( 0, 0, 0, 255 ) + surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h ) + surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h ) + surface.DrawLine( 0, h * 0.50, w, h * 0.50 ) + surface.DrawLine( w * 0.50, 0, w * 0.50, h ) + + end + +end + diff --git a/entities/weapons/rad_berettas/shared.lua b/entities/weapons/rad_berettas/shared.lua new file mode 100644 index 0000000..4ffeebd --- /dev/null +++ b/entities/weapons/rad_berettas/shared.lua @@ -0,0 +1,91 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Dual Berettas" + SWEP.IconLetter = "s" + SWEP.Slot = 2 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "duel" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_elite.mdl" +SWEP.WorldModel = "models/weapons/w_pist_elite.mdl" + +SWEP.SprintPos = Vector (-0.626, 0.5615, 3.5852) +SWEP.SprintAng = Vector (-25.2347, -3.1815, 0.3427) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.AnimPos = 1 + +SWEP.Anims = {} +SWEP.Anims[1] = ACT_VM_SECONDARYATTACK +SWEP.Anims[2] = ACT_VM_PRIMARYATTACK + +SWEP.Primary.Sound = Sound( "Weapon_Elite.Single" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.180 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = false + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( self.Anims[ self.AnimPos ] ) + + self.AnimPos = self.AnimPos + 1 + + if self.AnimPos > 2 then + + self.AnimPos = 1 + + end + +end + +--[[function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end]] diff --git a/entities/weapons/rad_cmp/shared.lua b/entities/weapons/rad_cmp/shared.lua new file mode 100644 index 0000000..35a68ef --- /dev/null +++ b/entities/weapons/rad_cmp/shared.lua @@ -0,0 +1,174 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 55 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "CMP-250" + SWEP.IconLetter = "f" + SWEP.Slot = 3 + SWEP.Slotpos = 1 + +end + +SWEP.HoldType = "smg" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_smg1.mdl" +SWEP.WorldModel = "models/weapons/w_smg1.mdl" + +SWEP.SprintPos = Vector (3.6907, -0.6364, -0.5846) +SWEP.SprintAng = Vector (-2.2928, 28.9069, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" +SWEP.FirstShot = true + +SWEP.Primary.Sound = Sound( "Weapon_smg1.Burst" ) +SWEP.Primary.Sound2 = Sound( "weapons/smg1/smg1_fireburst1.wav" ) +SWEP.Primary.ReloadSound = Sound( "Weapon_smg1.reload" ) +SWEP.Primary.Recoil = 12.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 3 +SWEP.Primary.Cone = 0.045 +SWEP.Primary.Delay = 0.600 + +SWEP.Primary.ClipSize = 18 +SWEP.Primary.Automatic = true + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetClip1( self.Weapon:Clip1() - self.Primary.NumShots ) + self.Weapon:ShootEffects() + + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) + + else + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + + end + + if self.Weapon:GetZoomMode() > 1 then + + self.Weapon:UnZoom() + + end + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, self.Primary.NumShots * -1 ) + self.Owner:EmitSound( self.Primary.Sound2, 100, math.random( 120, 130 ) ) + + end + +end + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.ReloadTime or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < self.Primary.NumShots then + + self.Weapon:EmitSound( self.Primary.Empty ) + + return false + + end + + if self.Weapon:Clip1() <= 0 then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + self.Weapon:DoReload() + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + return false + + end + + return true + +end + +--[[function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + if self.FirstShot then + + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.ShotDelay ) + self.AutoShoot = CurTime() + self.Primary.ShotDelay + + else + + self.Owner:EmitSound( self.Primary.Sound2, 100, math.random(95,105) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + + end + + self.FirstShot = !self.FirstShot + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end]] + +function SWEP:DoReload() + + local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD ) + + self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.100 ) + self.Weapon:EmitSound( self.Primary.ReloadSound ) + + self.ReloadTime = CurTime() + time + +end + +function SWEP:ReloadThink() + + if self.ReloadTime and self.ReloadTime <= CurTime() then + + self.ReloadTime = nil + self.Weapon:SetClip1( self.Primary.ClipSize ) + + end + +end
\ No newline at end of file diff --git a/entities/weapons/rad_crowbar/shared.lua b/entities/weapons/rad_crowbar/shared.lua new file mode 100644 index 0000000..54134ac --- /dev/null +++ b/entities/weapons/rad_crowbar/shared.lua @@ -0,0 +1,220 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 75 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Crowbar" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee2" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_crowbar.mdl" +SWEP.WorldModel = "models/weapons/w_crowbar.mdl" + +SWEP.HoldPos = Vector(8.72, 0, 3.319) +SWEP.HoldAng = Vector(0, 0, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact2.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 90 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.950 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang //self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + if SERVER then + + self.Owner:AddStamina( -3 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + +end + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + local line = {} + line.start = pos + line.endpos = pos + aim + line.filter = self.Owner + + local linetr = util.TraceLine( line ) + + local tr = {} + tr.start = pos + self.Owner:GetAimVector() * -5 + tr.endpos = pos + aim + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + local trace = util.TraceHull( tr ) + local ent = trace.Entity + local ent2 = linetr.Entity + + if not IsValid( ent ) and IsValid( ent2 ) then + + ent = ent2 + + end + + if not IsValid( ent ) then + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + if math.random(1,3) == 1 then + + ent:SetHeadshotter( self.Owner, true ) + + end + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_deagle/shared.lua b/entities/weapons/rad_deagle/shared.lua new file mode 100644 index 0000000..1bc4118 --- /dev/null +++ b/entities/weapons/rad_deagle/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "Desert Eagle" + SWEP.IconLetter = "f" + SWEP.Slot = 2 + SWEP.Slotpos = 1 + +end + +SWEP.HoldType = "revolver" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_deagle.mdl" +SWEP.WorldModel = "models/weapons/w_pist_deagle.mdl" + +SWEP.SprintPos = Vector (-4.2232, -5.1203, -2.0386) +SWEP.SprintAng = Vector (12.7496, -52.6848, -7.5206) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_Deagle.Single" ) +SWEP.Primary.Recoil = 11.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.030 +SWEP.Primary.Delay = 0.380 + +SWEP.Primary.ClipSize = 7 +SWEP.Primary.Automatic = false
\ No newline at end of file diff --git a/entities/weapons/rad_experimental/shared.lua b/entities/weapons/rad_experimental/shared.lua new file mode 100644 index 0000000..f8da7b8 --- /dev/null +++ b/entities/weapons/rad_experimental/shared.lua @@ -0,0 +1,154 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.ViewModelFOV = 60 + + SWEP.PrintName = "PPW-952" + SWEP.IconLetter = "m" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_irifle.mdl" +SWEP.WorldModel = "models/weapons/w_irifle.mdl" + +//SWEP.SprintPos = Vector (4.9288, -2.4157, 2.2032) +//SWEP.SprintAng = Vector (0.8736, 40.1165, 28.0526) + +SWEP.SprintPos = Vector(0.55, -5.119, -1.025) +SWEP.SprintAng = Vector(7.44, 25.079, 16.26) + +SWEP.IsSniper = false +SWEP.AmmoType = "Prototype" +SWEP.LaserOffset = Angle( -90, -0.9, 0 ) +SWEP.LaserScale = 0.25 +//SWEP.IronsightsFOV = 60 + +SWEP.Gore = Sound( "npc/roller/mine/rmine_explode_shock1.wav" ) + +SWEP.Primary.Sound = Sound( "Airboat.FireGunHeavy" ) +SWEP.Primary.Sound2 = Sound( "npc/scanner/scanner_electric2.wav" ) +SWEP.Primary.Recoil = 19.5 +SWEP.Primary.Damage = 350 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.010 +SWEP.Primary.Delay = 1.400 + +SWEP.Primary.ClipSize = 3 +SWEP.Primary.Automatic = true + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,100) ) + self.Weapon:EmitSound( self.Primary.Sound2, 100, math.random(120,130) ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", numbullets ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.75, 0, 10 ) + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 1 + bullet.Force = damage * 2 + bullet.Damage = 1 + bullet.AmmoType = "Pistol" + bullet.TracerName = "AirboatGunHeavyTracer" + + bullet.Callback = function ( attacker, tr, dmginfo ) + + if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then + + if tr.Entity:IsPlayer() and tr.Entity:Team() == TEAM_ZOMBIES then + + tr.Entity:SetModel( table.Random( GAMEMODE.Corpses ) ) + + end + + local dmg = DamageInfo() + dmg:SetDamage( 500 ) + dmg:SetDamageType( DMG_BLAST ) + dmg:SetAttacker( self.Owner ) + dmg:SetInflictor( self.Weapon ) + + tr.Entity:EmitSound( self.Gore, 100, math.random(90,110) ) + tr.Entity:TakeDamageInfo( dmg ) + + end + + local ed = EffectData() + ed:SetOrigin( tr.HitPos ) + ed:SetNormal( tr.HitNormal ) + util.Effect( "energy_explosion", ed, true, true ) + + end + + self.Owner:FireBullets( bullet ) + +end diff --git a/entities/weapons/rad_famas/shared.lua b/entities/weapons/rad_famas/shared.lua new file mode 100644 index 0000000..b7966f4 --- /dev/null +++ b/entities/weapons/rad_famas/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "FAMAS" + SWEP.IconLetter = "v" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_famas.mdl" +SWEP.WorldModel = "models/weapons/w_rif_famas.mdl" + +SWEP.SprintPos = Vector(4.9288, -2.4157, 2.2032) +SWEP.SprintAng = Vector(0.8736, 40.1165, 28.0526) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_famas.Single" ) +SWEP.Primary.Recoil = 7.5 +SWEP.Primary.Damage = 45 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_firegun/shared.lua b/entities/weapons/rad_firegun/shared.lua new file mode 100644 index 0000000..a8e3ae8 --- /dev/null +++ b/entities/weapons/rad_firegun/shared.lua @@ -0,0 +1,190 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.ViewModelFOV = 60 + + SWEP.PrintName = "HEAT Cannon" + SWEP.IconLetter = "m" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "physgun" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_physcannon.mdl" +SWEP.WorldModel = "models/weapons/w_physics.mdl" + +//SWEP.SprintPos = Vector (4.9288, -2.4157, 2.2032) +//SWEP.SprintAng = Vector (0.8736, 40.1165, 28.0526) + +SWEP.SprintPos = Vector(5.36, -0.401, 2.88) +SWEP.SprintAng = Vector(-3.201, 26.799, 5.4) + +SWEP.IsSniper = false +SWEP.AmmoType = "Prototype" +SWEP.LaserOffset = Angle( -90, -0.9, 0 ) +SWEP.LaserScale = 0.25 +//SWEP.IronsightsFOV = 60 + +SWEP.Burn = Sound( "ambient/fire/ignite.wav" ) +SWEP.Burn2 = Sound( "Weapon_Mortar.Impact" ) + +SWEP.Primary.Sound = Sound( "Weapon_mortar.single" ) +SWEP.Primary.Sound2 = Sound( "weapons/physcannon/physcannon_charge.wav" ) +SWEP.Primary.Recoil = 15.5 +SWEP.Primary.Damage = 80 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.015 +SWEP.Primary.Delay = 1.700 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK ) + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,100) ) + //self.Weapon:EmitSound( self.Primary.Sound3, 100, 80 ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + self.Owner:EmitSound( self.Primary.Sound2 ) + + end + + self.ReloadTime = CurTime() + self.Primary.Delay + +end + +function SWEP:ReloadThink() + + if self.ReloadTime and self.ReloadTime <= CurTime() then + + self.ReloadTime = nil + self.Weapon:SetClip1( self.Primary.ClipSize ) + + end + +end + +function SWEP:Reload() + +end + +SWEP.Decals = { "Scorch", "SmallScorch" } + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", numbullets ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.75, 0, 10 ) + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 1 + bullet.Force = damage * 2 + bullet.Damage = 1 + bullet.AmmoType = "Pistol" + bullet.TracerName = "fire_tracer" + + bullet.Callback = function ( attacker, tr, dmginfo ) + + if IsValid( tr.Entity ) and IsValid( self ) and IsValid( self.Owner ) and SERVER then + + if tr.Entity:IsPlayer() then + + tr.Entity:TakeDamage( self.Primary.Damage, self.Owner ) + + else + + tr.Entity:TakeDamage( math.Clamp( math.min( 20, tr.Entity:Health() - 5 ), 1, 20 ), self.Owner ) + + end + + if tr.Entity.NextBot or ( tr.Entity:IsPlayer() and tr.Entity:Team() != TEAM_ARMY ) then + + tr.Entity:DoIgnite( self.Owner ) + tr.Entity:EmitSound( self.Burn, 100, math.random(90,110) ) + + end + + end + + sound.Play( self.Burn2, tr.HitPos ) + + local ed = EffectData() + ed:SetOrigin( tr.HitPos ) + ed:SetNormal( tr.HitNormal ) + util.Effect( "fire_explosion", ed, true, true ) + + if tr.HitNormal.z > 0.5 and tr.HitWorld then + + local ed = EffectData() + ed:SetOrigin( tr.HitPos ) + ed:SetMagnitude( 0.5 ) + util.Effect( "smoke_crater", ed, true, true ) + + end + + util.Decal( table.Random( self.Decals ), tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal ) + + end + + self.Owner:FireBullets( bullet ) + +end diff --git a/entities/weapons/rad_fiveseven/shared.lua b/entities/weapons/rad_fiveseven/shared.lua new file mode 100644 index 0000000..28ce60e --- /dev/null +++ b/entities/weapons/rad_fiveseven/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "FN Five-Seven" + SWEP.IconLetter = "y" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "pistol" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_fiveseven.mdl" +SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl" + +SWEP.SprintPos = Vector (1.3846, -0.6033, -7.1994) +SWEP.SprintAng = Vector (33.9412, 15.0662, 6.288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_fiveseven.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_g3/shared.lua b/entities/weapons/rad_g3/shared.lua new file mode 100644 index 0000000..8e9d8b7 --- /dev/null +++ b/entities/weapons/rad_g3/shared.lua @@ -0,0 +1,76 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "G3 SG1" + SWEP.IconLetter = "i" + SWEP.Slot = 4 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_g3sg1.mdl" +SWEP.WorldModel = "models/weapons/w_snip_g3sg1.mdl" + +SWEP.SprintPos = Vector(-2.8398, -3.656, 0.5519) +SWEP.SprintAng = Vector(0.1447, -34.0929, 0) + +SWEP.ZoomModes = { 0, 35, 10 } +SWEP.ZoomSpeeds = { 0.25, 0.40, 0.40 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_G3SG1.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 100 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.002 +SWEP.Primary.SniperCone = 0.035 +SWEP.Primary.Delay = 0.380 + +SWEP.Primary.ClipSize = 20 +SWEP.Primary.Automatic = true + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) + self.Weapon:ShootEffects() + + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) + + else + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + + end + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end
\ No newline at end of file diff --git a/entities/weapons/rad_galil/shared.lua b/entities/weapons/rad_galil/shared.lua new file mode 100644 index 0000000..246ab86 --- /dev/null +++ b/entities/weapons/rad_galil/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "IMI Galil" + SWEP.IconLetter = "v" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_galil.mdl" +SWEP.WorldModel = "models/weapons/w_rif_galil.mdl" + +SWEP.SprintPos = Vector (5.6501, -4.3222, 2.1819) +SWEP.SprintAng = Vector (-10.5144, 47.7303, 2.2908) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_Galil.Single" ) +SWEP.Primary.Recoil = 7.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.110 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_glock/shared.lua b/entities/weapons/rad_glock/shared.lua new file mode 100644 index 0000000..fd00c73 --- /dev/null +++ b/entities/weapons/rad_glock/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "Glock 19" + SWEP.IconLetter = "c" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "pistol" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl" +SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl" + +SWEP.SprintPos = Vector (0.6553, 0.446, 3.2583) +SWEP.SprintAng = Vector (-15.5938, -2.8864, -1.5457) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_Glock.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 15 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua new file mode 100644 index 0000000..516f491 --- /dev/null +++ b/entities/weapons/rad_grenade/shared.lua @@ -0,0 +1,151 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "HE Grenade" + SWEP.IconLetter = "h" + SWEP.Slot = 3 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "grenade" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_eq_fraggrenade.mdl" +SWEP.WorldModel = "models/weapons/w_eq_fraggrenade.mdl" + +SWEP.SprintPos = Vector (10.9603, -1.1484, -0.4996) +SWEP.SprintAng = Vector (13.9974, 21.7915, 59.3288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThrowPower = 350 + +SWEP.Primary.Sound = Sound( "WeaponFrag.Throw" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 1 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.100 +SWEP.Primary.Delay = 2.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then + + self.LastRunFrame = CurTime() + 0.3 + + end + + end + + if self.ThrowTime then + + if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then + + self.ThrowAnim = true + + if self.ThrowPower > 1000 then + + self.Weapon:SendWeaponAnim( ACT_VM_THROW ) + + end + + end + + if self.ThrowTime < CurTime() then + + self.ThrowTime = nil + self.ReloadTime = CurTime() + 0.75 + + if CLIENT then return end + + local tbl = item.GetByModel( "models/weapons/w_eq_fraggrenade_thrown.mdl" ) + + if self.Owner:HasItem( tbl.ID ) then + + self.Owner:RemoveFromInventory( tbl.ID ) + + end + + local ent = ents.Create( "sent_grenade" ) + ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 ) + ent:SetOwner( self.Owner ) + ent:SetAngles( self.Owner:GetAimVector():Angle() ) + ent:SetSpeed( self.ThrowPower ) + ent:Spawn() + + if not self.Owner:HasItem( tbl.ID ) then + + self.Owner:StripWeapon( "rad_grenade" ) + + end + + end + + end + + if self.ReloadTime and self.ReloadTime < CurTime() then + + self.ReloadTime = nil + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + end + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:ShootEffects() + + self.ThrowTime = CurTime() + 1.25 + self.ThrowAnim = false + self.ThrowPower = 800 + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:ShootEffects() + + self.ThrowTime = CurTime() + 1.25 + self.ThrowAnim = false + self.ThrowPower = 3000 + +end + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + +end + +function SWEP:DrawHUD() + +end + diff --git a/entities/weapons/rad_hammer/shared.lua b/entities/weapons/rad_hammer/shared.lua new file mode 100644 index 0000000..5bf20ee --- /dev/null +++ b/entities/weapons/rad_hammer/shared.lua @@ -0,0 +1,483 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 80 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Hammer" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "melee" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_hammer/v_hammer.mdl" +SWEP.WorldModel = "models/weapons/w_hammer.mdl" + +SWEP.Barricade = Model( "models/props_debris/wood_board04a.mdl" ) + +SWEP.HoldPos = Vector (1.1747, -16.6759, -5.7913) +SWEP.HoldAng = Vector (23.7548, -8.0105, -5.154) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Click = Sound( "Buttons.snd14" ) +SWEP.Deny = Sound( "HL1/fvox/buzz.wav" ) + +SWEP.Primary.Hit = Sound( "weapons/crowbar/crowbar_impact1.wav" ) +SWEP.Primary.Sound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.100 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +SWEP.Position = 35 +SWEP.BuildAng = 0 + +function SWEP:GetViewModelPosition( pos, ang ) + + return self.Weapon:MoveViewModelTo( self.HoldPos, self.HoldAng, pos, ang, 1 ) + +end + +function SWEP:ReleaseGhost() + + if IsValid( self.GhostEntity ) then + + self.GhostEntity:Remove() + self.GhostEntity = nil + + end + +end + +function SWEP:MakeGhost( model, pos, angle ) + + self.GhostEntity = ents.CreateClientProp( model ) + //self.GhostEntity:SetModel( model ) + self.GhostEntity:SetPos( pos ) + self.GhostEntity:SetAngles( angle ) + self.GhostEntity:Spawn() + + self.GhostEntity:SetSolid( SOLID_VPHYSICS ) + self.GhostEntity:SetMoveType( MOVETYPE_NONE ) + self.GhostEntity:SetNotSolid( true ) + self.GhostEntity:SetRenderMode( RENDERMODE_TRANSALPHA ) + self.GhostEntity:SetColor( Color( 255, 255, 255, 200 ) ) + +end + +function SWEP:UpdateGhost() + + if not IsValid( self.GhostEntity ) then return end + + local tr = util.GetPlayerTrace( self.Owner ) + local trace = util.TraceLine( tr ) + + if not trace.Hit then return end + + local ang = ( trace.HitNormal * -1 ):Angle() + Angle( 0, 0, math.NormalizeAngle( 90 + self.Weapon:GetNWInt( "BuildAng", 0 ) ) ) + local pos = trace.HitPos + + local trlength = self.Weapon:GetOwner():GetPos() - trace.HitPos + trlength = trlength:Length() + + if trlength < 150 and ( trace.HitWorld or trace.Entity:GetClass() == "prop_door_rotating" ) then + + self.GhostEntity:SetColor( Color( 50, 255, 50, 200 ) ) + + else + + self.GhostEntity:SetColor( Color( 255, 50, 50, 200 ) ) + + end + + if not trace.HitWorld and not trace.Entity:GetClass() == "prop_door_rotating" then + + self.GhostEntity:SetColor( Color( 255, 50, 50, 200 ) ) + self.GhostEntity:SetModel( self.Barricade ) + self.GhostEntity:SetPos( pos + ( self.GhostEntity:GetUp() * self.Position ) ) + self.GhostEntity:SetAngles( ang ) + + elseif string.find( trace.Entity:GetClass(), "prop_door" ) then + + self.GhostEntity:SetModel( "models/props_c17/tools_wrench01a.mdl" ) + self.GhostEntity:SetPos( trace.HitPos + trace.HitNormal * 5 ) + self.GhostEntity:SetAngles( ( trace.HitNormal * -1 ):Angle() + Angle(0,90,90) ) + + else + + self.GhostEntity:SetModel( self.Barricade ) + self.GhostEntity:SetPos( pos + ( self.GhostEntity:GetUp() * self.Position ) ) + self.GhostEntity:SetAngles( ang ) + + end + +end + +function SWEP:SetPlacePosition( ent ) + + local tr = util.GetPlayerTrace( self:GetOwner() ) + local trace = util.TraceLine( tr ) + + if not trace.Hit then return end + + local ang = ( trace.HitNormal * -1 ):Angle() + Angle( 0, 0, math.NormalizeAngle( 90 + self.Weapon:GetNWInt( "BuildAng", 0 ) ) ) + ent:SetAngles( ang ) + + local pos = trace.HitPos + ent:SetPos( pos + ( ent:GetUp() * self.Position ) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + phys:EnableMotion( false ) + + end + +end + +function SWEP:Deploy() + + if SERVER then + + self.Owner:DrawViewModel( true ) + self.Owner:NoticeOnce( "Toggle build mode with your reload key", GAMEMODE.Colors.Blue, 5, 2 ) + + else + + self.Weapon:ReleaseGhost() + + end + + self.InIron = false + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Holster() + + if CLIENT then + + self.Weapon:ReleaseGhost() + + end + + return true + +end + +function SWEP:Reload() + + if CLIENT then return end + + if ( self.ReloadTime or 0 ) < CurTime() then + + self.ReloadTime = CurTime() + 0.75 + + self.Weapon:SetNWBool( "BuildMode", !self.Weapon:GetNWBool( "BuildMode", false ) ) + + self.Owner:EmitSound( self.Click, 50, 120 ) + self.Owner:NoticeOnce( "Rotate your barricade by right clicking", GAMEMODE.Colors.Blue, 5, 2 ) + + end + +end + +function SWEP:SecondaryAttack() + + if CLIENT then return end + + if ( self.SecondDelay or 0 ) < CurTime() and self.Weapon:GetNWBool( "BuildMode", false ) then + + self.SecondDelay = CurTime() + 0.25 + self.BuildAng = self.BuildAng + 45 + + if self.BuildAng == 360 then + + self.BuildAng = 0 + + end + + self.Weapon:SetNWInt( "BuildAng", self.BuildAng ) + self.Owner:EmitSound( self.Click ) + + end + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:GetNWBool( "BuildMode", false ) then + + if SERVER then + + self.Owner:AddStamina( -2 ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + + else + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:BarricadeTrace() + + end + +end + +function SWEP:BarricadeTrace() + + if CLIENT then return end + + local trace = util.GetPlayerTrace( self.Owner ) + local tr = util.TraceLine( trace ) + local trlength = self.Weapon:GetOwner():GetPos() - tr.HitPos + trlength = trlength:Length() + + local has, id = self.Owner:GetWood() + + if not has then + + self.Owner:Notice( "You don't have enough wood", GAMEMODE.Colors.Red ) + self.Owner:EmitSound( self.Deny, 50, 100 ) + + return + + end + + if tr.HitWorld and trlength < 150 then + + self.Owner:Notice( "Built a barricade using 1 piece of wood", GAMEMODE.Colors.Green ) + self.Owner:NoticeOnce( "You can also repair doors", GAMEMODE.Colors.Blue, 5, 2 ) + + local prop = ents.Create( "prop_physics" ) + prop:SetModel( self.Barricade ) + prop:Spawn() + prop:SetHealth( 350 ) + prop:SetCustomCollisionCheck() + prop.IsWood = true + + self.Weapon:SetPlacePosition( prop ) + + elseif string.find( tr.Entity:GetClass(), "prop_door" ) and trlength < 150 then + + self.Owner:Notice( "Fortified a door using 1 piece of wood", GAMEMODE.Colors.Green ) + + tr.Entity.MaxHits = 30 + tr.Entity.Hits = 0 + + else + + self.Owner:Notice( "You can't build a barricade here", GAMEMODE.Colors.Red ) + self.Owner:EmitSound( self.Deny, 50, 100 ) + + return + + end + + self.Owner:AddStamina( -15 ) + self.Owner:RemoveFromInventory( id ) + self.Owner:AddStat( "Wood" ) + self.Owner:AddCash( 1 ) + + self.Owner:EmitSound( table.Random( GAMEMODE.Drill ), 100, math.random(90,110) ) + self.Owner:EmitSound( table.Random( GAMEMODE.WoodHammer ), 100, math.random(90,110) ) + +end + +function SWEP:MeleeTrace( dmg ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + local line = {} + line.start = pos + line.endpos = pos + aim + line.filter = self.Owner + + local linetr = util.TraceLine( line ) + + local tr = {} + tr.start = pos + self.Owner:GetAimVector() * -5 + tr.endpos = pos + aim + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + local trace = util.TraceHull( tr ) + local ent = trace.Entity + local ent2 = linetr.Entity + + if not IsValid( ent ) and IsValid( ent2 ) then + + ent = ent2 + + end + + if not IsValid( ent ) then + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(60,80) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + + if ent:IsPlayer() then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + local snd = table.Random( GAMEMODE.BluntHit ) + ent:EmitSound( snd, 100, math.random(90,110) ) + + if math.random(1,3) == 1 then + + ent:SetHeadshotter( self.Owner, true ) + + end + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:Think() + + if CLIENT then + + if self.Weapon:GetNWBool( "BuildMode", false ) then + + if not self.GhostEntity then + + self.Weapon:MakeGhost( self.Barricade, self.Owner:GetPos() + Vector(0,0,100), Angle(0,0,0)) + + else + + self.Weapon:UpdateGhost() + + end + + elseif IsValid( self.GhostEntity ) then + + self.Weapon:ReleaseGhost() + + end + + end + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + if self.Weapon:GetZoomMode() != 1 then + + self.Weapon:UnZoom() + + end + + end + + if self.MoveTime and self.MoveTime < CurTime() and SERVER then + + self.MoveTime = nil + self.Weapon:SetZoomMode( self.Weapon:GetZoomMode() + 1 ) + self.Owner:DrawViewModel( false ) + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua new file mode 100644 index 0000000..3dda5dc --- /dev/null +++ b/entities/weapons/rad_incendiarygrenade/shared.lua @@ -0,0 +1,151 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "Incendiary Grenade" + SWEP.IconLetter = "h" + SWEP.Slot = 3 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "grenade" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_eq_flashbang.mdl" +SWEP.WorldModel = "models/weapons/w_eq_flashbang.mdl" + +SWEP.SprintPos = Vector (10.9603, -1.1484, -0.4996) +SWEP.SprintAng = Vector (13.9974, 21.7915, 59.3288) + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThrowPower = 300 + +SWEP.Primary.Sound = Sound( "WeaponFrag.Throw" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 1 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.100 +SWEP.Primary.Delay = 2.300 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = false + +function SWEP:Think() + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() > 0 and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then + + self.LastRunFrame = CurTime() + 0.3 + + end + + end + + if self.ThrowTime then + + if self.ThrowTime - 0.3 < CurTime() and not self.ThrowAnim then + + self.ThrowAnim = true + + if self.ThrowPower > 1000 then + + self.Weapon:SendWeaponAnim( ACT_VM_THROW ) + + end + + end + + if self.ThrowTime < CurTime() then + + self.ThrowTime = nil + self.ReloadTime = CurTime() + 0.75 + + if CLIENT then return end + + local tbl = item.GetByModel( "models/weapons/w_eq_flashbang.mdl" ) + + if self.Owner:HasItem( tbl.ID ) then + + self.Owner:RemoveFromInventory( tbl.ID ) + + end + + local ent = ents.Create( "sent_grenade_incendiary" ) + ent:SetPos( self.Owner:GetShootPos() + self.Owner:GetRight() * 5 + self.Owner:GetUp() * -5 ) + ent:SetOwner( self.Owner ) + ent:SetAngles( self.Owner:GetAimVector():Angle() ) + ent:SetSpeed( self.ThrowPower ) + ent:Spawn() + + if not self.Owner:HasItem( tbl.ID ) then + + self.Owner:StripWeapon( "rad_incendiarygrenade" ) + + end + + end + + end + + if self.ReloadTime and self.ReloadTime < CurTime() then + + self.ReloadTime = nil + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + end + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:ShootEffects() + + self.ThrowTime = CurTime() + 1.25 + self.ThrowAnim = false + self.ThrowPower = 800 + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SendWeaponAnim( ACT_VM_PULLBACK_LOW ) + self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:ShootEffects() + + self.ThrowTime = CurTime() + 1.25 + self.ThrowAnim = false + self.ThrowPower = 3000 + +end + +function SWEP:ShootEffects() + + if SERVER then + + self.Owner:ViewBounce( self.Primary.Recoil ) + + end + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + +end + +function SWEP:DrawHUD() + +end + diff --git a/entities/weapons/rad_inv/shared.lua b/entities/weapons/rad_inv/shared.lua new file mode 100644 index 0000000..50e7691 --- /dev/null +++ b/entities/weapons/rad_inv/shared.lua @@ -0,0 +1,562 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Quick Inventory" + SWEP.IconLetter = "H" + SWEP.Slot = 0 + SWEP.Slotpos = 1 + +end + +SWEP.HoldType = "normal" +SWEP.Base = "rad_base" + +SWEP.ViewModel = "" +SWEP.WorldModel = "" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.ClipSize = 1 + +SWEP.Scroll = Sound( "ui/buttonrollover.wav" ) +SWEP.Selection = Sound( "ui/buttonclickrelease.wav" ) +SWEP.Cancel = Sound( "common/wpn_denyselect.wav" ) + +SWEP.YPos = 10 +SWEP.XPos = 10 +SWEP.NumPanels = 5 +SWEP.PanelSize = 80 + +function SWEP:Holster() + + if SERVER then return true end + + if self.Deployed then + + self.Deployed = false + + self.Weapon:RemovePanels() + + end + + return true + +end + +function SWEP:Deploy() + + if SERVER then + + self.Weapon:SetNWInt( "InvPos", 1 ) + self.Weapon:SetNWBool( "Synch", false ) + self.Weapon:SetNWBool( "UseMode", false ) + + self.Owner:SynchInventory() + + self.Owner:NoticeOnce( "Right click to scroll through your inventory", GAMEMODE.Colors.Blue, 5, 2 ) + self.Owner:NoticeOnce( "Left click to select an item and use it", GAMEMODE.Colors.Blue, 5, 4 ) + + return true + + end + + if not self.Deployed then + + self.Deployed = true + self.LastInv = Inv_Size() + self.InvPos = 1 + + self.Weapon:GeneratePanels() + + end + + return true + +end + +function SWEP:GeneratePanels() + + self.InvPanels = {} + self.YPosTbl = {} + self.InvItems = Inv_UniqueItems() + + if Inv_Size() == 0 then return end + + for i=1, math.min( self.NumPanels, #self.InvItems ) do + + local id = self.Weapon:GetNWInt( "InvPos", 1 ) + i - 1 + + if id > #self.InvItems then + + id = math.Clamp( id - #self.InvItems, 1, #self.InvItems ) + + end + + local panel = vgui.Create( "ItemPanel" ) + panel:SetItemTable( item.GetByID( self.InvItems[id] ) ) + + if i == 1 then + + panel:SetPos( -self.PanelSize, self.YPos ) + panel:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 ) + panel:SetSizeOverride( self.PanelSize * 1.5 ) + panel.YPos = self.YPos + + else + + panel:SetPos( -self.PanelSize, self.YPos + ( self.PanelSize * ( i - 1 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i ) ) + panel:SetSize( self.PanelSize, self.PanelSize ) + panel:SetSizeOverride( self.PanelSize ) + panel.YPos = self.YPos + ( self.PanelSize * ( i - 2 ) ) + ( self.PanelSize * 1.5 ) + ( 5 * i ) + + end + + self.YPosTbl[i] = panel.YPos + + table.insert( self.InvPanels, panel ) + + end + +end + +function SWEP:AddPanel() // call after removing a panel + + local id = self.Weapon:GetNWInt( "InvPos", 1 ) - 1 + local inv = Inv_UniqueItems() + + if id < 1 then + + id = #inv + + end + + local i = #self.InvPanels + local tbl = item.GetByID( inv[id] ) + + local panel = vgui.Create( "ItemPanel" ) + panel:SetItemTable( tbl ) + panel:SetPos( -self.PanelSize, self.YPosTbl[ i + 1 ] ) + panel:SetSize( self.PanelSize, self.PanelSize ) + panel:SetSizeOverride( self.PanelSize ) + panel.YPos = self.YPosTbl[ i + 1 ] + + table.insert( self.InvPanels, panel ) + +end + +function SWEP:RemovePanels() + + for k,v in pairs( self.InvPanels ) do + + v:Remove() + + end + + self.InvPanels = {} + self.InvItems = {} + self.YPosTbl = {} + +end + +function SWEP:RemovePanel() + + if not self.InvPanels[1] then return end + + self.InvPanels[1].Removal = true + +end + +function SWEP:RemoveAllPanels() + + for k,v in pairs( self.InvPanels ) do + + v.Removal = true + + end + +end + +function SWEP:SecondaryAttack() + + if CLIENT then return end + + self.Weapon:SetNextSecondaryFire( CurTime() + 0.3 ) + + if self.Weapon:GetNWBool( "UseMode", false ) then + + local inv = self.Owner:GetUniqueInventory() + local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + local tbl = item.GetByID( inv[pos] ) + + self.Weapon:SetNWInt( "FuncPos", self.Weapon:GetNWInt( "FuncPos", 1 ) + 1 ) + + if tbl.Weapon then + + if self.Weapon:GetNWInt( "FuncPos", 1 ) > 2 then + + self.Weapon:SetNWInt( "FuncPos", 1 ) + + end + + return + + end + + if self.Weapon:GetNWInt( "FuncPos", 1 ) > ( #self.Functions + 2 ) then + + self.Weapon:SetNWInt( "FuncPos", 1 ) + + end + + else + + local size = #self.Owner:GetUniqueInventory() + local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + 1 + + if pos > size then + + pos = 1 + + end + + self.Weapon:SetNWInt( "InvPos", pos ) + + end + + self.Owner:ClientSound( self.Scroll ) + +end + +function SWEP:PrimaryAttack() + + if CLIENT then return end + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + local inv = self.Owner:GetUniqueInventory() + local pos = self.Weapon:GetNWInt( "InvPos", 1 ) + local tbl = item.GetByID( inv[pos] ) + + if not tbl then return end + + if self.Weapon:GetNWBool( "UseMode", false ) then + + local fpos = self.Weapon:GetNWInt( "FuncPos", 1 ) + + if tbl.Weapon then + + if fpos == 1 then + + self.Owner:ClientSound( self.Cancel ) + + else + + self.Functions[1]( self.Owner, tbl.ID ) + + end + + self.Weapon:SetNWBool( "UseMode", false ) + self.Weapon:SetNWInt( "FuncPos", 1 ) + self.Weapon:SetNWInt( "InvPos", 1 ) + self.Weapon:Synch() + + return + + end + + if fpos == 1 then + + self.Owner:ClientSound( self.Cancel ) + + elseif fpos == 2 then + + self.Weapon:DropItem( tbl.ID, 1 ) + + else + + self.Functions[ fpos - 2 ]( self.Owner, tbl.ID ) + + end + + self.Weapon:SetNWBool( "UseMode", false ) + self.Weapon:SetNWInt( "FuncPos", 1 ) + self.Weapon:SetNWInt( "InvPos", 1 ) + self.Weapon:Synch() + + else + + self.Weapon:SetNWBool( "UseMode", !self.Weapon:SetNWBool( "UseMode", false ) ) + + self.Functions = tbl.Functions + + self.Owner:ClientSound( self.Selection ) + + end + +end + +function SWEP:DropItem( id, count ) + + if not self.Owner:HasItem( id ) then return end + + local tbl = item.GetByID( id ) + + if count == 1 then + + if self.Owner:HasItem( id ) then + + local makeprop = true + + if tbl.DropFunction then + + makeprop = tbl.DropFunction( self.Owner, id, true ) + + end + + if makeprop then + + local prop = ents.Create( "prop_physics" ) + prop:SetPos( self.Owner:GetItemDropPos() ) + prop:SetAngles( self.Owner:GetAimVector():Angle() ) + prop:SetModel( tbl.Model ) + prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) + prop:Spawn() + prop.IsItem = true + prop.Removal = CurTime() + 5 * 60 + + end + + self.Owner:RemoveFromInventory( id, true ) + self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) ) + + end + + return + + end + + local items = {} + + for i=1, count do + + if self.Owner:HasItem( id ) then + + table.insert( items, id ) + + end + + end + + local loot = ents.Create( "sent_lootbag" ) + + for k,v in pairs( items ) do + + loot:AddItem( v ) + + end + + loot:SetAngles( self.Owner:GetAimVector():Angle() ) + loot:SetPos( self.Owner:GetItemDropPos() ) + loot:SetRemoval( 60 * 5 ) + loot:Spawn() + + self.Owner:EmitSound( Sound( "items/ammopickup.wav" ) ) + self.Owner:RemoveMultipleFromInventory( items ) + + if tbl.DropFunction then + + tbl.DropFunction( self.Owner, id ) + + end + +end + +function SWEP:Synch() + + umsg.Start( "InvSWEP", self.Owner ) + umsg.End() + +end + +function RecvSynch() + + InvSWEPSynch = true + +end +usermessage.Hook( "InvSWEP", RecvSynch ) + +function SWEP:Think() + + if SERVER then return end + + if not self.Deployed then return end + + local removing = false + + if InvSWEPSynch or self.LastInv != Inv_Size() then + + removing = true + InvSWEPSynch = false + + self.Weapon:RemoveAllPanels() + + end + + self.LastInv = Inv_Size() + + if #self.InvPanels < 1 then + + self.Weapon:GeneratePanels() + + end + + if removing then return end + + if self.Shuffle and #self.InvPanels < 5 then + + for k,v in pairs( self.InvPanels ) do + + v.YPos = self.YPosTbl[k] + + end + + self.Weapon:AddPanel() + + self.Shuffle = false + + end + + if self.InvPos != self.Weapon:GetNWInt( "InvPos", 1 ) then + + self.InvPos = self.Weapon:GetNWInt( "InvPos", 1 ) + + self.Weapon:RemovePanel() + + end + +end + +function SWEP:DrawOption( i, name ) + + surface.SetFont( "InventoryFont" ) + + local w,h = surface.GetTextSize( name ) + local col = Color( 255, 255, 255 ) + + if i == self.Weapon:GetNWInt( "FuncPos", 1 ) then + + col = Color( 50, 255, 50 ) + + end + + draw.RoundedBox( 4, self.PanelSize * 1.5 + 20, 12 + ( i - 1 ) * 25, w + 8, h, Color( 0, 0, 0, 200 ) ) + draw.SimpleText( name, "InventoryFont", self.PanelSize * 1.5 + 24 + ( w * 0.5 ), 12 + ( i - 1 ) * 25 + ( h * 0.5 ), col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + +end + +function SWEP:DrawHUD() + + if self.Weapon:GetNWBool( "UseMode", false ) then + + local inv = Inv_UniqueItems() + local tbl = item.GetByID( inv[ self.Weapon:GetNWInt( "InvPos", 1 ) ] ) + + if not tbl then return end + + if tbl.Weapon then + + self.Weapon:DrawOption( 1, "cancel" ) + self.Weapon:DrawOption( 2, "drop" ) + + return + + end + + for i=1, #tbl.Functions + 2 do + + if i == 1 then + + self.Weapon:DrawOption( i, "cancel" ) + + elseif i == 2 then + + self.Weapon:DrawOption( i, "drop" ) + + else + + self.Weapon:DrawOption( i, string.lower( tbl.Functions[ i - 2 ]( 0, 0, true ) ) ) + + end + + end + + end + + for k,v in pairs( self.InvPanels or {} ) do + + v.LastX = math.Clamp( math.max( ( v.LastX or self.PanelSize + self.XPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.XPos ) + v.LastY = math.Clamp( math.max( ( v.LastY or self.YPos ) - ( FrameTime() * 700 ), 1 ), 0, self.PanelSize + self.YPos ) + + if v.LastX != 0 or v.LastY != 0 then // automatically bring the panel into the screen + + v:SetPos( self.XPos - v.LastX, v.YPos - v.LastY ) + + if v.YPos == self.YPosTbl[1] then + + v:SetSize( self.PanelSize * 1.5, self.PanelSize * 1.5 ) + v:SetSizeOverride( self.PanelSize * 1.5 ) + + end + + end + + if v.Removal then + + v.RemoveX = math.Clamp( ( v.RemoveX or self.XPos ) - ( FrameTime() * 700 ), -1 * ( self.PanelSize * 2 ), self.PanelSize + self.XPos ) + + if v.RemoveX != -1 * ( self.PanelSize * 2 ) then + + v:SetPos( v.RemoveX, v.YPos ) + + else + + v:Remove() + + table.remove( self.InvPanels, k ) + + local all = true + + for c,d in pairs( self.InvPanels ) do + + if not d.Removal then + + all = false + + end + + end + + if not all then + + self.Shuffle = true + + end + + break + + end + + end + + end + +end diff --git a/entities/weapons/rad_itemplacer/shared.lua b/entities/weapons/rad_itemplacer/shared.lua new file mode 100644 index 0000000..12dad13 --- /dev/null +++ b/entities/weapons/rad_itemplacer/shared.lua @@ -0,0 +1,295 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + ClientItemPlacerTbl = {} + ClientItemPlacerTbl[ "teh" ] = {} + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = true + SWEP.CSMuzzleFlashes = true + + SWEP.ViewModelFOV = 74 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Item Placement Tool" + SWEP.Slot = 5 + SWEP.Slotpos = 5 + + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) + + end + +end + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.Primary.Swap = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "NPC_CombineCamera.Click" ) +SWEP.Primary.Delete1 = Sound( "Weapon_StunStick.Melee_Hit" ) +SWEP.Primary.Delete = Sound( "Weapon_StunStick.Melee_HitWorld" ) + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 99999 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.AmmoType = "Knife" + +SWEP.ItemTypes = { "info_player_zombie", +"info_player_army", +"info_lootspawn", +"info_npcspawn", +"info_evac", +"point_radiation" } + +SWEP.ServersideItems = { "info_player_zombie", +"info_player_army", +"info_lootspawn", +"info_npcspawn", +"info_evac", +"point_radiation" } + +SWEP.SharedItems = {} + +function SWEP:Initialize() + + if SERVER then + + self.Weapon:SetWeaponHoldType( self.HoldType ) + + end + +end + +function SWEP:Synch() + + for k,v in pairs( self.ServersideItems ) do + + local ents = ents.FindByClass( v ) + local postbl = {} + + for c,d in pairs( ents ) do + + table.insert( postbl, d:GetPos() ) + + end + + net.Start( "ItemPlacerSynch" ) + net.WriteString( v ) + net.WriteTable( postbl ) + net.Send( self.Owner ) + + //local tbl = { Name = v, Ents = postbl } + + //datastream.StreamToClients( { self.Owner }, "ItemPlacerSynch", tbl ) + + end + +end + +net.Receive( "ItemPlacerSynch", function( len ) + + ClientItemPlacerTbl[ net.ReadString() ] = net.ReadTable() + +end ) + +--[[function PlacerSynch( handler, id, encoded, decoded ) + + ClientItemPlacerTbl[ decoded.Name ] = decoded.Ents + +end +datastream.Hook( "ItemPlacerSynch", PlacerSynch )]] + +function SWEP:Deploy() + + if SERVER then + + self.Weapon:Synch() + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Think() + + if CLIENT then return end + + if self.Owner:KeyDown( IN_USE ) and ( ( self.NextDel or 0 ) < CurTime() ) then + + self.NextDel = CurTime() + 1 + + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) + + local closest + local dist = 1000 + + for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do + + if v:GetPos():Distance( tr.HitPos ) < dist then + + dist = v:GetPos():Distance( tr.HitPos ) + closest = v + + end + + end + + if IsValid( closest ) then + + closest:Remove() + + self.Owner:EmitSound( self.Primary.Delete1 ) + + self.Weapon:Synch() + + end + + end + +end + +function SWEP:Reload() + + if CLIENT then return end + + for k,v in pairs( ents.FindByClass( self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] ) ) do + + v:Remove() + + end + + self.Weapon:Synch() + + self.Owner:EmitSound( self.Primary.Delete ) + +end + +function SWEP:Holster() + + return true + +end + +function SWEP:ShootEffects() + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + +end + +function SWEP:PlaceItem() + + local itemtype = self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ] + + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) + + local ent = ents.Create( itemtype ) + ent:SetPos( tr.HitPos + tr.HitNormal * 5 ) + ent:Spawn() + ent.AdminPlaced = true + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SetNextPrimaryFire( CurTime() + 1 ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Weapon:PlaceItem() + + self.Weapon:Synch() + + end + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SetNextSecondaryFire( CurTime() + 0.5 ) + + self.Weapon:EmitSound( self.Primary.Swap ) + + if SERVER then + + self.Weapon:SetNWInt( "ItemType", self.Weapon:GetNWInt( "ItemType", 1 ) + 1 ) + + if self.Weapon:GetNWInt( "ItemType", 1 ) > #self.ItemTypes then + + self.Weapon:SetNWInt( "ItemType", 1 ) + + end + + end + +end + +function SWEP:DrawHUD() + + draw.SimpleText( "PRIMARY FIRE: Place Item SECONDARY FIRE: Change Item Type +USE: Delete Nearest Item Of Current Type RELOAD: Remove All Of Current Item Type", "AmmoFontSmall", ScrW() * 0.5, ScrH() - 120, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + draw.SimpleText( "CURRENT ITEM TYPE: "..self.ItemTypes[ self.Weapon:GetNWInt( "ItemType", 1 ) ], "AmmoFontSmall", ScrW() * 0.5, ScrH() - 100, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + + for k,v in pairs( self.SharedItems ) do + + for c,d in pairs( ents.FindByClass( v ) ) do + + local pos = d:GetPos():ToScreen() + + if pos.visible then + + draw.SimpleText( v, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) ) + + end + + end + + end + + for k,v in pairs( ClientItemPlacerTbl ) do + + for c,d in pairs( v ) do + + local vec = Vector( d[1], d[2], d[3] ) + + local pos = vec:ToScreen() + + if pos.visible then + + draw.SimpleText( k, "AmmoFontSmall", pos.x, pos.y - 15, Color(80,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + draw.RoundedBox( 0, pos.x - 2, pos.y - 2, 4, 4, Color(255,255,255) ) + + end + + end + + end + +end + + diff --git a/entities/weapons/rad_knife/shared.lua b/entities/weapons/rad_knife/shared.lua new file mode 100644 index 0000000..8b06c17 --- /dev/null +++ b/entities/weapons/rad_knife/shared.lua @@ -0,0 +1,199 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Knife" + SWEP.IconLetter = "j" + SWEP.Slot = 1 + SWEP.Slotpos = 0 + +end + +SWEP.HoldType = "knife" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_knife_t.mdl" +SWEP.WorldModel = "models/weapons/w_knife_t.mdl" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" + +SWEP.Primary.Hit = Sound( "Weapon_Knife.HitWall" ) +SWEP.Primary.HitFlesh = Sound( "Weapon_Knife.Hit" ) +SWEP.Primary.Sound = Sound( "Weapon_Knife.Slash" ) +SWEP.Primary.Deploy = Sound( "Weapon_Knife.Deploy" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 0.950 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang + +end + +function SWEP:SecondaryAttack() + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:MeleeTrace( self.Primary.Damage ) + + if SERVER then + + self.Owner:AddStamina( -1 ) + + end + +end + +function SWEP:Think() + +end + +function SWEP:MeleeTrace( dmg ) + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 64 + + local line = {} + line.start = pos + line.endpos = pos + aim + line.filter = self.Owner + + local linetr = util.TraceLine( line ) + + local tr = {} + tr.start = pos + self.Owner:GetAimVector() * -5 + tr.endpos = pos + aim + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + local trace = util.TraceHull( tr ) + local ent = trace.Entity + local ent2 = linetr.Entity + + if not IsValid( ent ) and IsValid( ent2 ) then + + ent = ent2 + + end + + if not IsValid( ent ) then + + self.Owner:EmitSound( self.Primary.Sound, 100, math.random(90,110) ) + return + + elseif not ent:IsWorld() then + + self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) + self.Owner:AddStamina( -2 ) + + if ent:IsPlayer() then + + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + if ent:Team() != self.Owner:Team() then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + end + + elseif string.find( ent:GetClass(), "npc" ) then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + self.Owner:DrawBlood() + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif !ent:IsPlayer() then + + if string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + end + + end + + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + if ent.IsWooden then + + ent:Fire( "break", 0, 0 ) + + else + + ent:SetPhysicsAttacker( self.Owner ) + ent:TakeDamage( 10, self.Owner, self.Weapon ) + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 200 ) + + end + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end + +function SWEP:Deploy() + + if SERVER then + + self.Owner:DrawViewModel( true ) + self.Owner:EmitSound( self.Primary.Deploy, 100, math.random(90,110) ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end diff --git a/entities/weapons/rad_m1014/shared.lua b/entities/weapons/rad_m1014/shared.lua new file mode 100644 index 0000000..9d4ca65 --- /dev/null +++ b/entities/weapons/rad_m1014/shared.lua @@ -0,0 +1,299 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "M1014 Shotgun" + SWEP.IconLetter = "B" + SWEP.Slot = 3 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "shotgun" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_shot_xm1014.mdl" +SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "weapons/shotgun/shotgun_fire6.wav" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.080 +SWEP.Primary.Delay = 0.320 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = true + +function SWEP:Deploy() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + + end + + self.InIron = false + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then + + self.Weapon:EmitSound( self.Primary.Empty ) + return false + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return false + + end + + if self.Weapon:Clip1() <= 0 then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + return false + + end + + return true + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if self.Weapon:GetZoomMode() > 1 then + + self.Weapon:UnZoom() + + end + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end + +function SWEP:Reload() + + if self.HolsterMode or self.Weapon:Clip1() == self.Primary.ClipSize then return end + + if self.Weapon:Clip1() < self.Primary.ClipSize and not self.Weapon:GetNWBool( "Reloading", false ) then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + end + +end + +function SWEP:Think() + + if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then + + self.HolsterTime = CurTime() + 2 + --[[self.HolsterMode = !self.HolsterMode + + if self.HolsterMode then + + self.Owner:SetLuaAnimation( self.HoldType ) + + else + + self.Owner:StopAllLuaAnimations( 0.5 ) + + end]] + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then + + // Finsished reload + if self.Weapon:Clip1() >= self.Primary.ClipSize then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return + + end + + // Next cycle + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + + // Add ammo + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + end + + end + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + end + +end + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", 1 ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.25, 0, 10 ) + + end + + local tracer = 1 + + if ( zoommode or 1 ) > 1 then + + tracer = 0 + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 0 + bullet.Force = damage * 2 + bullet.Damage = damage + bullet.AmmoType = "Pistol" + bullet.TracerName = tracername + bullet.Callback = function ( attacker, tr, dmginfo ) + + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) + + if tr.Entity.NextBot then + + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) + + end + + if math.random(1,6) == 1 then + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) + + end + + end + + self.Owner:FireBullets( bullet ) + +end + +function SWEP:DrawHUD() + + if self.Weapon:ShouldNotDraw() then return end + + if not self.IsSniper and not self.Owner:GetNWBool( "InIron", false ) then + + local x = ScrW() * 0.5 + local y = ScrH() * 0.5 + local scalebywidth = ( ScrW() / 1024 ) * 10 + local scale = self.Primary.Cone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = self.Primary.Cone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) + + end + + scale = scale * scalebywidth + + local dist = math.abs( self.CrosshairScale - scale ) + self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) + + local gap = 40 * self.CrosshairScale + local length = gap + self.CrossLength:GetInt() + + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) + surface.DrawLine( x - length, y, x - gap, y ) + surface.DrawLine( x + length, y, x + gap, y ) + surface.DrawLine( x, y - length, x, y - gap ) + surface.DrawLine( x, y + length, x, y + gap ) + + end + +end diff --git a/entities/weapons/rad_m249/shared.lua b/entities/weapons/rad_m249/shared.lua new file mode 100644 index 0000000..7e72cd2 --- /dev/null +++ b/entities/weapons/rad_m249/shared.lua @@ -0,0 +1,40 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = false + + SWEP.PrintName = "M249 SAW" + SWEP.IconLetter = "z" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_mach_m249para.mdl" +SWEP.WorldModel = "models/weapons/w_mach_m249para.mdl" + +SWEP.SprintPos = Vector (4.0541, -2.0077, -5.4061) +SWEP.SprintAng = Vector (11.4322, 40.43, -7.9447) + +SWEP.IsSniper = false +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_M249.Single" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 75 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.090 + +SWEP.Primary.ClipSize = 100 +SWEP.Primary.Automatic = true + diff --git a/entities/weapons/rad_mac10/shared.lua b/entities/weapons/rad_mac10/shared.lua new file mode 100644 index 0000000..3e95b6e --- /dev/null +++ b/entities/weapons/rad_mac10/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "MAC 10" + SWEP.IconLetter = "l" + SWEP.Slot = 3 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "revolver" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_mac10.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mac10.mdl" + +SWEP.SprintPos = Vector(-4.7699, -7.2246, -2.8428) +SWEP.SprintAng = Vector(4.4604, -47.001, 6.8488) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_mac10.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.050 +SWEP.Primary.Delay = 0.080 + +SWEP.Primary.ClipSize = 40 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_mp5/shared.lua b/entities/weapons/rad_mp5/shared.lua new file mode 100644 index 0000000..e41ef49 --- /dev/null +++ b/entities/weapons/rad_mp5/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "HK MP5" + SWEP.IconLetter = "x" + SWEP.Slot = 3 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "smg" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_mp5.mdl" +SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_MP5Navy.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.085 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_p228/shared.lua b/entities/weapons/rad_p228/shared.lua new file mode 100644 index 0000000..56c1415 --- /dev/null +++ b/entities/weapons/rad_p228/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "P228 Compact" + SWEP.IconLetter = "y" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "pistol" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_p228.mdl" +SWEP.WorldModel = "models/weapons/w_pist_p228.mdl" + +SWEP.SprintPos = Vector(-0.8052, 0, 3.0657) +SWEP.SprintAng = Vector(-16.9413, -5.786, 4.0159) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_P228.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_p90/shared.lua b/entities/weapons/rad_p90/shared.lua new file mode 100644 index 0000000..2055466 --- /dev/null +++ b/entities/weapons/rad_p90/shared.lua @@ -0,0 +1,42 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "FN P90" + SWEP.IconLetter = "l" + SWEP.Slot = 3 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "rpg" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_p90.mdl" +SWEP.WorldModel = "models/weapons/w_smg_p90.mdl" + +SWEP.SprintPos = Vector(-4.7699, -7.2246, -2.8428) +SWEP.SprintAng = Vector(4.4604, -47.001, 6.8488) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.LaserOffset = Angle( 39.9, -50, -90 ) +SWEP.LaserScale = 0.75 + +SWEP.Primary.Sound = Sound( "Weapon_p90.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 40 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.075 + +SWEP.Primary.ClipSize = 50 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_propplacer/shared.lua b/entities/weapons/rad_propplacer/shared.lua new file mode 100644 index 0000000..77a0e96 --- /dev/null +++ b/entities/weapons/rad_propplacer/shared.lua @@ -0,0 +1,382 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + + SWEP.Weight = 1 + SWEP.AutoSwitchTo = false + SWEP.AutoSwitchFrom = false + +end + +if CLIENT then + + SWEP.DrawAmmo = true + SWEP.DrawCrosshair = true + SWEP.CSMuzzleFlashes = true + + SWEP.ViewModelFOV = 74 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Prop Placement Tool" + SWEP.Slot = 5 + SWEP.Slotpos = 7 + + function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha ) + + end + +end + +SWEP.HoldType = "pistol" + +SWEP.ViewModel = "models/weapons/v_pistol.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.Primary.Swap = Sound( "weapons/clipempty_rifle.wav" ) +SWEP.Primary.Sound = Sound( "NPC_CombineCamera.Click" ) +SWEP.Primary.Delete = Sound( "Weapon_StunStick.Melee_HitWorld" ) + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.DefaultClip = 99999 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "pistol" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" + +SWEP.AmmoType = "Knife" + +SWEP.PropList = { "models/props_c17/oildrum001.mdl", +"models/props_c17/canister02a.mdl", +"models/props_c17/furniturewashingmachine001a.mdl", +"models/props_c17/pulleywheels_large01.mdl", +"models/props_c17/pulleywheels_small01.mdl", +"models/props_c17/chair02a.mdl", +"models/props_c17/concrete_barrier001a.mdl", +"models/props_c17/door01_left.mdl", +"models/props_c17/fence01a.mdl", +"models/props_c17/fence01b.mdl", +"models/props_c17/fence03a.mdl", +"models/props_c17/lockers001a.mdl", +"models/props_c17/traffic_light001a.mdl", +"models/props_c17/trappropeller_engine.mdl", +"models/props_c17/furniturebathtub001a.mdl", +"models/props_c17/furniturefridge001a.mdl", +"models/props_interiors/refrigerator01a.mdl", +"models/props_interiors/refrigeratordoor01a.mdl", +"models/props_interiors/vendingmachinesoda01a.mdl", +"models/props_wasteland/cargo_container01.mdl", +"models/props_wasteland/controlroom_storagecloset001a.mdl", +"models/props_wasteland/laundry_cart001.mdl", +"models/props_wasteland/controlroom_chair001a.mdl", +"models/props_wasteland/controlroom_desk001a.mdl", +"models/props_wasteland/controlroom_desk001b.mdl", +"models/props_wasteland/controlroom_filecabinet002a.mdl", +"models/props_wasteland/controlroom_filecabinet001a.mdl", +"models/props_wasteland/laundry_cart002.mdl", +"models/props_wasteland/dockplank01b.mdl", +"models/props_wasteland/barricade001a.mdl", +"models/props_wasteland/barricade002a.mdl", +"models/props_wasteland/wheel01.mdl", +"models/props_wasteland/buoy01.mdl", +"models/props_wasteland/prison_bedframe001b.mdl", +"models/props_wasteland/kitchen_fridge001a.mdl", +"models/props_vehicles/car001a_hatchback.mdl", +"models/props_vehicles/car001b_hatchback.mdl", +"models/props_vehicles/car002a_physics.mdl", +"models/props_vehicles/car002b_physics.mdl", +"models/props_vehicles/car003a_physics.mdl", +"models/props_vehicles/car003b_physics.mdl", +"models/props_vehicles/car004a_physics.mdl", +"models/props_vehicles/car004b_physics.mdl", +"models/props_vehicles/car005b_physics.mdl", +"models/props_vehicles/van001a_physics.mdl", +"models/props_vehicles/generatortrailer01.mdl", +"models/props_vehicles/trailer002a.mdl", +"models/props_vehicles/truck001a.mdl", +"models/props_vehicles/carparts_door01a.mdl", +"models/props_vehicles/carparts_wheel01a.mdl", +"models/props_vehicles/carparts_tire01a.mdl", +"models/props_vehicles/carparts_axel01a.mdl", +"models/props_vehicles/tire001b_truck.mdl", +"models/props_vehicles/tire001a_tractor.mdl", +"models/props_trainstation/train003.mdl", +"models/props_canal/boat001a.mdl", +"models/props_canal/boat001b.mdl", +"models/props_canal/boat002b.mdl", +"models/props_debris/metal_panel01a.mdl", +"models/props_debris/metal_panel02a.mdl", +"models/props_junk/trashdumpster02b.mdl", +"models/props_junk/ravenholmsign.mdl", +"models/props_junk/ibeam01a.mdl", +"models/props_junk/ibeam01a_cluster01.mdl", +"models/props_junk/wood_pallet001a.mdl", +"models/props_junk/propanecanister001a.mdl", +"models/props_junk/pushcart01a.mdl", +"models/props_junk/cinderblock01a.mdl", +"models/props_junk/wood_crate001a.mdl", +"models/props_junk/wood_crate002a.mdl", +"models/props_junk/trashdumpster01a.mdl", +"models/props_junk/wheebarrow01a.mdl", +"models/props_junk/metalgascan.mdl", +"models/props_junk/trashdumpster02.mdl", +//"models/props/de_train/barrel.mdl", +"models/props/de_train/pallet_barrels.mdl", +"models/props/de_prodigy/tirestack.mdl", +"models/props/de_prodigy/tirestack2.mdl", +"models/props/de_prodigy/tirestack3.mdl", +"models/props/de_prodigy/concretebags.mdl", +"models/props/de_prodigy/concretebags2.mdl", +"models/props/de_prodigy/concretebags3.mdl", +"models/props/de_prodigy/concretebags4.mdl", +"models/props/de_prodigy/pushcart.mdl", +"models/props/de_prodigy/spoolwire.mdl", +"models/props/de_prodigy/spool.mdl", +"models/props/de_prodigy/ammo_can_02.mdl", +"models/props/de_prodigy/ammo_can_01.mdl", +"models/props/de_prodigy/ammo_can_03.mdl", +"models/props/de_nuke/cinderblock_stack.mdl", +"models/props/cs_militia/militiarock05.mdl", +"models/props/cs_militia/sawhorse.mdl", +"models/props/cs_militia/table_kitchen.mdl", +"models/props/cs_militia/footlocker01_open.mdl", +"models/props/cs_militia/footlocker01_closed.mdl", +"models/props_junk/MetalBucket01a.mdl", +"models/props_junk/MetalBucket02a.mdl", +"models/props_junk/plasticbucket001a.mdl", +"models/props_wasteland/kitchen_shelf001a.mdl", +"models/props_c17/chair_stool01a.mdl", +"models/props_c17/chair_office01a.mdl", +"models/props_c17/SuitCase001a.mdl", +"models/props_interiors/Radiator01a.mdl", +"models/props_junk/bicycle01a.mdl", +"models/props_lab/citizenradio.mdl", +"models/props_lab/kennel_physics.mdl", +"models/props_lab/partsbin01.mdl", +"models/props_vehicles/carparts_muffler01a.mdl", +"models/props/cs_office/shelves_metal.mdl", +"models/props_phx/construct/concrete_barrier01.mdl", +"models/props_phx/construct/concrete_barrier00.mdl", +"models/props/cs_assault/handtruck.mdl", +"models/props/de_nuke/nuclearcontainerboxclosed.mdl", +"models/props/de_nuke/crate_small.mdl", +"models/props_vehicles/trailer001a.mdl", +"models/props_lab/lockers.mdl", +"models/props_trainstation/train002.mdl", +"models/props_vehicles/wagon001a.mdl", +"models/props_wasteland/gear01.mdl", +"models/props_wasteland/cafeteria_bench001a.mdl", +"models/props_wasteland/cafeteria_table001a.mdl", +"models/props/CS_militia/crate_extrasmallmill.mdl", +"models/props/CS_militia/microwave01.mdl", +"models/props/CS_militia/paintbucket01.mdl", +"models/props/CS_militia/refrigerator01.mdl", +"models/props/CS_militia/toilet.mdl", +"models/props/CS_militia/wood_table.mdl", +"models/props/cs_italy/it_mkt_table2.mdl", +"models/props/de_inferno/wine_barrel.mdl", +"models/props_c17/streetsign004f.mdl", +"models/props_c17/FurnitureDresser001a.mdl", +"models/props_vehicles/truck003a.mdl", +"models/items/car_battery01.mdl", +"models/props_c17/canister_propane01a.mdl", +"models/props_junk/metal_paintcan001b.mdl"} + +function SWEP:Initialize() + + if SERVER then + + self.Weapon:SetWeaponHoldType( self.HoldType ) + + end + +end + +function SWEP:Deploy() + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:Think() + + if CLIENT then return end + + if self.Owner:KeyDown( IN_USE ) and ( ( self.NextDel or 0 ) < CurTime() ) then + + self.NextDel = CurTime() + 1 + + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) + + local closest + local dist = 1000 + + for k,v in pairs( ents.FindByClass( "prop_physics" ) ) do + + if v:GetPos():Distance( tr.HitPos ) < dist and v.AdminPlaced then + + dist = v:GetPos():Distance( tr.HitPos ) + closest = v + + end + + end + + if IsValid( closest ) then + + closest:Remove() + + self.Owner:EmitSound( self.Primary.Delete ) + + end + + end + +end + +function SWEP:Reload() + + if CLIENT then return end + + for k,v in pairs( ents.FindByClass( "prop_physics" ) ) do + + if v.AdminPlaced then + + v:Remove() + + end + + end + + self.Owner:EmitSound( self.Primary.Delete ) + +end + +function SWEP:Holster() + + return true + +end + +function SWEP:ShootEffects() + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + +end + +function SWEP:PlaceItem() + + if not self.Owner:IsAdmin() or not self.Owner:IsSuperAdmin() then return end + + if not self.Owner.PropPos then self.Owner.PropPos = 1 end + + if self.Owner.PropPos < 1 or self.Owner.PropPos > #self.PropList then return end + + local tr = util.TraceLine( util.GetPlayerTrace( self.Owner ) ) + + local ent = ents.Create( "prop_physics" ) + ent:SetPos( tr.HitPos + tr.HitNormal * 50 ) + ent:SetModel( self.PropList[ self.Owner.PropPos ] ) + ent:SetSkin( math.random( 0, 6 ) ) + ent:Spawn() + ent.AdminPlaced = true + +end + +function SWEP:PrimaryAttack() + + self.Weapon:SetNextPrimaryFire( CurTime() + 1 ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Weapon:PlaceItem() + + end + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SetNextSecondaryFire( CurTime() + 0.5 ) + + self.Weapon:EmitSound( self.Primary.Swap ) + + if CLIENT then + + self.Weapon:Menu() + + end + +end + +function SWEP:DrawHUD() + + draw.SimpleText( "PRIMARY FIRE: Create Prop SECONDARY FIRE: Choose Prop Model +USE: Delete Nearest Prop RELOAD: Remove All Placed Props", "AmmoFontSmall", ScrW() * 0.5, ScrH() - 100, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) + +end + +if CLIENT then + + function SWEP:Menu() + + if ( self.MenuTime or 0 ) > CurTime() then return end + + self.MenuTime = CurTime() + 1 + + gui.EnableScreenClicker( true ) + + local frame = vgui.Create( "PanelBase" ) + frame:SetSize( 300, 370 ) + frame:Center() + //frame:ShowCloseButton( false ) + + local plist = vgui.Create( "DPanelList", frame ) + plist:SetPos( 15, 15 ) + plist:SetSize( 270, 340 ) + plist:SetSpacing( 0 ) + plist:EnableHorizontal( true ) + plist:EnableVerticalScrollbar( true ) + + for k, v in pairs( self.PropList ) do + + local icon = vgui.Create( "SpawnIcon", plist ) + icon:SetModel( v ) + icon:SetToolTip() + icon:SetSize( 64, 64 ) + icon.OnMousePressed = function( mc ) + + RunConsoleCommand( "chooseprop", tostring( k ) ) + + gui.EnableScreenClicker( false ) + surface.PlaySound( Sound( "buttons/button14.wav" ) ) + + frame:Remove() + + end + + plist:AddItem( icon ) + + end + + end + + return + +end + +function ChooseProp( ply, cmd, args ) + + ply.PropPos = tonumber( args[1] ) + +end + +concommand.Add( "chooseprop", ChooseProp ) diff --git a/entities/weapons/rad_revolver/shared.lua b/entities/weapons/rad_revolver/shared.lua new file mode 100644 index 0000000..2b34184 --- /dev/null +++ b/entities/weapons/rad_revolver/shared.lua @@ -0,0 +1,71 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Colt Python" + SWEP.IconLetter = "f" + SWEP.Slot = 2 + SWEP.Slotpos = 1 + +end + +SWEP.HoldType = "revolver" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true + +SWEP.ViewModel = "models/weapons/c_357.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" + +SWEP.SprintPos = Vector (2.4955, 2.1219, 2.9007) +SWEP.SprintAng = Vector (-10.2034, 15.2433, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_357.Single" ) +SWEP.Primary.Recoil = 13.5 +SWEP.Primary.Damage = 50 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.030 +SWEP.Primary.Delay = 0.850 + +SWEP.Primary.ClipSize = 6 +SWEP.Primary.Automatic = false + +function SWEP:ShootEffects() + + if SERVER then + + self.Owner:ViewBounce( self.Primary.Recoil ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + + if CLIENT then return end + + local tbl = self.ShellSounds[ ( self.Primary.ShellType or 1 ) ] + local pos = self.Owner:GetPos() + + //timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl.Wavs ), pos, 75, tbl.Pitch ) end ) + + --[[local ed = EffectData() + ed:SetOrigin( self.Owner:GetShootPos() ) + ed:SetEntity( self.Weapon ) + ed:SetAttachment( self.Weapon:LookupAttachment( "2" ) ) + ed:SetScale( ( self.Primary.ShellType or SHELL_9MM ) ) + util.Effect( "weapon_shell", ed, true, true )]] + +end
\ No newline at end of file diff --git a/entities/weapons/rad_scout/shared.lua b/entities/weapons/rad_scout/shared.lua new file mode 100644 index 0000000..d7fa4d0 --- /dev/null +++ b/entities/weapons/rad_scout/shared.lua @@ -0,0 +1,46 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "Steyr Scout" + SWEP.IconLetter = "n" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_snip_scout.mdl" +SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" + +SWEP.SprintPos = Vector(-1.7763, -1.9796, 1.677) +SWEP.SprintAng = Vector(-11.9431, -36.4352, 0) + +SWEP.ZoomModes = { 0, 40, 10 } +SWEP.ZoomSpeeds = { 0.25, 0.40, 0.40 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Sniper" + +SWEP.Primary.Sound = Sound( "Weapon_Scout.Single" ) +SWEP.Primary.Recoil = 15.5 +SWEP.Primary.Damage = 110 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.001 +SWEP.Primary.SniperCone = 0.035 +SWEP.Primary.Delay = 1.400 + +SWEP.Primary.ClipSize = 10 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.8 +SWEP.MaxShellDelay = 1.0 diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua new file mode 100644 index 0000000..9d22ef2 --- /dev/null +++ b/entities/weapons/rad_sg552/shared.lua @@ -0,0 +1,159 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "SG 552" + SWEP.IconLetter = "A" + SWEP.Slot = 4 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "ar2" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_rif_sg552.mdl" +SWEP.WorldModel = "models/weapons/w_rif_sg552.mdl" + +SWEP.SprintPos = Vector (-2.629, -4.8963, 1.4033) +SWEP.SprintAng = Vector (-7.3401, -31.7536, 3.9563) + +SWEP.ZoomModes = { 0, 35 } +SWEP.ZoomSpeeds = { 0.25, 0.35 } + +SWEP.IsSniper = true +SWEP.AmmoType = "Rifle" + +SWEP.Primary.Sound = Sound( "Weapon_SG552.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 60 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.005 +SWEP.Primary.SniperCone = 0.020 +SWEP.Primary.Delay = 0.210 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true + +function SWEP:SetZoomMode( num ) + + if num > 2 then + + num = 1 + + self.Weapon:UnZoom() + + end + + self.Weapon:SetNWInt( "Mode", num ) + self.Owner:SetFOV( self.ZoomModes[num], self.ZoomSpeeds[num] ) + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 ) + + return + + end + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) + self.Weapon:ShootEffects() + + if self.IsSniper and self.Weapon:GetZoomMode() == 1 then + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.SniperCone, 1 ) + + else + + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + + end + + --[[if self.Weapon:GetZoomMode() > 1 then + + self.Weapon:UnZoom() + + end]] + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end + +function SWEP:DrawHUD() + + if self.Weapon:ShouldNotDraw() then return end + + local mode = self.Weapon:GetZoomMode() + + local cone = self.Primary.Cone + local scale = cone + + if mode == 1 then + + cone = self.Primary.SniperCone + scale = cone + + end + + local x = ScrW() * 0.5 + local y = ScrH() * 0.5 + local scalebywidth = ( ScrW() / 1024 ) * 10 + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = cone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( cone / 1.75, 0, 10 ) + + end + + scale = scale * scalebywidth + + local dist = math.abs( self.CrosshairScale - scale ) + self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) + + local gap = 40 * self.CrosshairScale + local length = gap + self.CrossLength:GetInt() //20 * self.CrosshairScale + + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) + surface.DrawLine( x - length, y, x - gap, y ) + surface.DrawLine( x + length, y, x + gap, y ) + surface.DrawLine( x, y - length, x, y - gap ) + surface.DrawLine( x, y + length, x, y + gap ) + + if mode != 1 then + + local w = ScrW() + local h = ScrH() + local wr = ( h / 3 ) * 4 + + surface.SetTexture( surface.GetTextureID( "gmod/scope" ) ) + surface.SetDrawColor( 0, 0, 0, 255 ) + surface.DrawTexturedRect( ( w / 2 ) - wr / 2, 0, wr, h ) + + surface.SetDrawColor( 0, 0, 0, 255 ) + surface.DrawRect( 0, 0, ( w / 2 ) - wr / 2, h ) + surface.DrawRect( ( w / 2 ) + wr / 2, 0, w - ( ( w / 2 ) + wr / 2 ), h ) + + end + +end
\ No newline at end of file diff --git a/entities/weapons/rad_shotgun/shared.lua b/entities/weapons/rad_shotgun/shared.lua new file mode 100644 index 0000000..d754462 --- /dev/null +++ b/entities/weapons/rad_shotgun/shared.lua @@ -0,0 +1,320 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "Winchester 1887" + SWEP.IconLetter = "k" + SWEP.Slot = 3 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "shotgun" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_shot_m3super91.mdl" +SWEP.WorldModel = "models/weapons/w_annabelle.mdl" + +SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "weapons/shotgun/shotgun_fire6.wav" ) +SWEP.Primary.Pump = Sound( "Weapon_M3.Pump" ) +SWEP.Primary.Recoil = 8.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.085 +SWEP.Primary.Delay = 0.500 + +SWEP.Primary.ClipSize = 5 +SWEP.Primary.Automatic = false + +SWEP.MinShellDelay = 0.5 +SWEP.MaxShellDelay = 0.7 + +function SWEP:Deploy() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then + + self.Weapon:EmitSound( self.Primary.Empty ) + return false + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return false + + end + + if self.Weapon:Clip1() <= 0 then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + return false + + end + + return true + +end + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + + if self.UseShellSounds then + + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) + local tbl = self.BuckshotShellSounds + local pos = self.Owner:GetPos() + + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) + + end + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end + +function SWEP:Reload() + + if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end + + if self.Weapon:Clip1() < self.Primary.ClipSize then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + end + +end + +function SWEP:PumpIt() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP ) + self.Weapon:EmitSound( self.Primary.Pump ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + +end + +function SWEP:Think() + + if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then + + self.HolsterTime = CurTime() + 2 + self.HolsterMode = !self.HolsterMode + + if self.HolsterMode then + + self.Owner:SetLuaAnimation( self.HoldType ) + + else + + self.Owner:StopAllLuaAnimations( 0.5 ) + + end + + end + + if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then + + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:PumpIt() + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then + + // Finsished reload + if self.Weapon:Clip1() >= self.Primary.ClipSize then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return + + end + + // Next cycle + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + + // Add ammo + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + end + + end + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) then + + self.LastRunFrame = CurTime() + 0.3 + + end + + end + +end + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", 1 ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.25, 0, 10 ) + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 0 + bullet.Force = damage * 2 + bullet.Damage = damage + bullet.AmmoType = "Pistol" + bullet.TracerName = tracername + bullet.Callback = function ( attacker, tr, dmginfo ) + + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) + + if tr.Entity.NextBot then + + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) + + end + + if math.random(1,6) == 1 then + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) + + end + + end + + self.Owner:FireBullets( bullet ) + +end + +function SWEP:DrawHUD() + + if self.Weapon:ShouldNotDraw() then return end + + local x = ScrW() * 0.5 + local y = ScrH() * 0.5 + local scalebywidth = ( ScrW() / 1024 ) * 10 + local scale = self.Primary.Cone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = self.Primary.Cone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) + + end + + scale = scale * scalebywidth + + local dist = math.abs( self.CrosshairScale - scale ) + self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) + + local gap = 40 * self.CrosshairScale + local length = gap + self.CrossLength:GetInt() + + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) + surface.DrawLine( x - length, y, x - gap, y ) + surface.DrawLine( x + length, y, x + gap, y ) + surface.DrawLine( x, y - length, x, y - gap ) + surface.DrawLine( x, y + length, x, y + gap ) + +end diff --git a/entities/weapons/rad_spas12/shared.lua b/entities/weapons/rad_spas12/shared.lua new file mode 100644 index 0000000..c3bcfb7 --- /dev/null +++ b/entities/weapons/rad_spas12/shared.lua @@ -0,0 +1,342 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 55 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "SPAS-12" + SWEP.IconLetter = "k" + SWEP.Slot = 3 + SWEP.Slotpos = 3 + +end + +SWEP.HoldType = "shotgun" + +SWEP.Base = "rad_base" + +SWEP.UseHands = true +SWEP.UseShellSounds = false + +SWEP.ViewModel = "models/weapons/c_shotgun.mdl" +SWEP.WorldModel = "models/weapons/w_shotgun.mdl" + +//SWEP.SprintPos = Vector(-0.6026, -2.715, 0.0137) +//SWEP.SprintAng = Vector(-3.4815, -21.9362, 0.0001) +SWEP.SprintPos = Vector (1.4752, 0.0296, -3.577) +SWEP.SprintAng = Vector (5.8948, 20.2814, 0) + +SWEP.IsSniper = false +SWEP.AmmoType = "Buckshot" + +SWEP.Primary.Sound = Sound( "Weapon_Shotgun.Double" ) +SWEP.Primary.Pump = Sound( "Weapon_Shotgun.Special1" ) +SWEP.Primary.ReloadSound = Sound( "Weapon_Shotgun.Reload" ) +SWEP.Primary.Recoil = 9.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 8 +SWEP.Primary.Cone = 0.080 +SWEP.Primary.Delay = 0.500 + +SWEP.Primary.ClipSize = 8 +SWEP.Primary.Automatic = false + +function SWEP:Deploy() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 ) + + if SERVER then + + self.Weapon:SetZoomMode( 1 ) + + end + + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + return true + +end + +function SWEP:CanPrimaryAttack() + + if self.HolsterMode or self.LastRunFrame > CurTime() then return false end + + if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then + + self.Weapon:EmitSound( self.Primary.Empty ) + return false + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return false + + end + + if self.Weapon:Clip1() <= 0 and not self.Weapon:GetNWBool( "Reloading", false ) then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + return false + + end + + return true + +end + +function SWEP:ShootEffects() + + if IsFirstTimePredicted() then + + self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * self.Primary.Recoil, math.Rand( -0.05, 0.05 ) * self.Primary.Recoil, 0 ) ) + + end + + self.Owner:MuzzleFlash() + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + + if self.UseShellSounds then + + local pitch = self.Pitches[ self.AmmoType ] + math.random( -3, 3 ) + local tbl = self.BuckshotShellSounds + local pos = self.Owner:GetPos() + + timer.Simple( math.Rand( self.MinShellDelay, self.MaxShellDelay ), function() sound.Play( table.Random( tbl ), pos, 50, pitch ) end ) + + end + +end + +function SWEP:PrimaryAttack() + + if not self.Weapon:CanPrimaryAttack() then + + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + return + + end + + self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 ) + + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(95,105) ) + self.Weapon:ShootBullets( self.Primary.Damage, self.Primary.NumShots, self.Primary.Cone, self.Weapon:GetZoomMode() ) + self.Weapon:TakePrimaryAmmo( 1 ) + self.Weapon:ShootEffects() + + if SERVER then + + self.Owner:AddAmmo( self.AmmoType, -1 ) + + end + +end + +function SWEP:Reload() + + if self.Weapon:Clip1() == self.Primary.ClipSize or self.Weapon:Clip1() > self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) or self.HolsterMode or self.ReloadTime then return end + + if self.Weapon:Clip1() < self.Primary.ClipSize then + + self.Weapon:SetNWBool( "Reloading", true ) + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.5 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + + //self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + end + +end + +function SWEP:PumpIt() + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_PUMP ) + self.Weapon:EmitSound( self.Primary.Pump ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + +end + +function SWEP:Think() + + if self.Owner:KeyDown( IN_WALK ) and self.HolsterTime < CurTime() then + + self.HolsterTime = CurTime() + 2 + self.HolsterMode = !self.HolsterMode + + --[[if self.HolsterMode then + + self.Owner:SetLuaAnimation( self.HoldType ) + + else + + self.Owner:StopAllLuaAnimations( 0.5 ) + + end]] + + end + + if self.Weapon:GetVar( "PumpTime", 0 ) != 0 and self.Weapon:GetVar( "PumpTime", 0 ) < CurTime() then + + self.Weapon:SetVar( "PumpTime", 0 ) + self.Weapon:PumpIt() + + end + + if self.Weapon:GetNWBool( "Reloading", false ) then + + if self.Weapon:GetVar( "ReloadTimer", 0 ) < CurTime() then + + // Finsished reload + if self.Weapon:Clip1() >= self.Primary.ClipSize then + + self.Weapon:SetNWBool( "Reloading", false ) + self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 ) + + self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) + + return + + end + + // Next cycle + self.Weapon:SetVar( "ReloadTimer", CurTime() + 0.75 ) + self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) + + // Add ammo + self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) + + // Sound + self.Weapon:EmitSound( self.Primary.ReloadSound, 100, math.random(90,110) ) + + end + + end + + if self.Owner:GetVelocity():Length() > 0 then + + if self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetNWFloat( "Weight", 0 ) < 50 then + + self.LastRunFrame = CurTime() + 0.3 + + end + + end + +end + +function SWEP:ShootBullets( damage, numbullets, aimcone, zoommode ) + + if SERVER then + + self.Owner:AddStat( "Bullets", 1 ) + + end + + local scale = aimcone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = aimcone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( aimcone / 1.25, 0, 10 ) + + end + + local tracer = 1 + + if ( zoommode or 1 ) > 1 then + + tracer = 0 + + end + + local bullet = {} + bullet.Num = numbullets + bullet.Src = self.Owner:GetShootPos() + bullet.Dir = self.Owner:GetAimVector() + bullet.Spread = Vector( scale, scale, 0 ) + bullet.Tracer = 0 + bullet.Force = damage * 2 + bullet.Damage = damage + bullet.AmmoType = "Pistol" + bullet.TracerName = tracername + bullet.Callback = function ( attacker, tr, dmginfo ) + + dmginfo:ScaleDamage( self:GetDamageFalloffScale( tr.HitPos:Distance( self.Owner:GetShootPos() ) ) ) + + if tr.Entity.NextBot then + + tr.Entity:OnLimbHit( tr.HitGroup, dmginfo ) + + end + + if math.random(1,6) == 1 then + + self.Weapon:BulletPenetration( attacker, tr, dmginfo, 0 ) + + end + + end + + self.Owner:FireBullets( bullet ) + +end + +function SWEP:DrawHUD() + + if self.Weapon:ShouldNotDraw() then return end + + local x = ScrW() * 0.5 + local y = ScrH() * 0.5 + local scalebywidth = ( ScrW() / 1024 ) * 10 + local scale = self.Primary.Cone + + if self.Owner:KeyDown( IN_FORWARD ) or self.Owner:KeyDown( IN_BACK ) or self.Owner:KeyDown( IN_MOVELEFT ) or self.Owner:KeyDown( IN_MOVERIGHT ) then + + scale = self.Primary.Cone * 1.75 + + elseif self.Owner:KeyDown( IN_DUCK ) or self.Owner:KeyDown( IN_WALK ) then + + scale = math.Clamp( self.Primary.Cone / 1.25, 0, 10 ) + + end + + scale = scale * scalebywidth + + local dist = math.abs( self.CrosshairScale - scale ) + self.CrosshairScale = math.Approach( self.CrosshairScale, scale, FrameTime() * 2 + dist * 0.05 ) + + local gap = 40 * self.CrosshairScale + local length = gap + self.CrossLength:GetInt() + + surface.SetDrawColor( self.CrossRed:GetInt(), self.CrossGreen:GetInt(), self.CrossBlue:GetInt(), self.CrossAlpha:GetInt() ) + surface.DrawLine( x - length, y, x - gap, y ) + surface.DrawLine( x + length, y, x + gap, y ) + surface.DrawLine( x, y - length, x, y - gap ) + surface.DrawLine( x, y + length, x, y + gap ) + +end diff --git a/entities/weapons/rad_tmp/shared.lua b/entities/weapons/rad_tmp/shared.lua new file mode 100644 index 0000000..f0a794a --- /dev/null +++ b/entities/weapons/rad_tmp/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "TMP" + SWEP.IconLetter = "x" + SWEP.Slot = 3 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "rpg" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_tmp.mdl" +SWEP.WorldModel = "models/weapons/w_smg_tmp.mdl" + +SWEP.SprintPos = Vector (2.0027, -0.751, 0.1411) +SWEP.SprintAng = Vector (-1.2669, -27.7284, 10.4434) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_USP.SilencedShot" ) +SWEP.Primary.Recoil = 4.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.035 +SWEP.Primary.Delay = 0.075 + +SWEP.Primary.ClipSize = 30 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_ump45/shared.lua b/entities/weapons/rad_ump45/shared.lua new file mode 100644 index 0000000..b8191ca --- /dev/null +++ b/entities/weapons/rad_ump45/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "HK UMP45" + SWEP.IconLetter = "q" + SWEP.Slot = 3 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "smg" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_smg_ump45.mdl" +SWEP.WorldModel = "models/weapons/w_smg_ump45.mdl" + +SWEP.SprintPos = Vector (-1.0859, -4.2523, -1.1534) +SWEP.SprintAng = Vector (-4.8822, -38.3984, 14.6527) + +SWEP.IsSniper = false +SWEP.AmmoType = "SMG" + +SWEP.Primary.Sound = Sound( "Weapon_UMP45.Single" ) +SWEP.Primary.Recoil = 6.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.045 +SWEP.Primary.Delay = 0.100 + +SWEP.Primary.ClipSize = 25 +SWEP.Primary.Automatic = true diff --git a/entities/weapons/rad_usp/shared.lua b/entities/weapons/rad_usp/shared.lua new file mode 100644 index 0000000..91db700 --- /dev/null +++ b/entities/weapons/rad_usp/shared.lua @@ -0,0 +1,39 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFlip = true + + SWEP.PrintName = "USP Compact" + SWEP.IconLetter = "a" + SWEP.Slot = 2 + SWEP.Slotpos = 2 + +end + +SWEP.HoldType = "pistol" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/weapons/v_pist_usp.mdl" +SWEP.WorldModel = "models/weapons/w_pistol.mdl" + +SWEP.SprintPos = Vector (0.4776, 0.446, 3.1631) +SWEP.SprintAng = Vector (-15.3501, -1.3761, -1.5457) + +SWEP.IsSniper = false +SWEP.AmmoType = "Pistol" + +SWEP.Primary.Sound = Sound( "Weapon_USP.Single" ) +SWEP.Primary.Recoil = 5.5 +SWEP.Primary.Damage = 30 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Cone = 0.040 +SWEP.Primary.Delay = 0.150 + +SWEP.Primary.ClipSize = 12 +SWEP.Primary.Automatic = false diff --git a/entities/weapons/rad_z_banshee/shared.lua b/entities/weapons/rad_z_banshee/shared.lua new file mode 100644 index 0000000..00e881a --- /dev/null +++ b/entities/weapons/rad_z_banshee/shared.lua @@ -0,0 +1,131 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Claws" + SWEP.IconLetter = "C" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + killicon.AddFont( "rad_z_banshee", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) + +end + +SWEP.Base = "rad_z_base" + +SWEP.ViewModel = "models/Zed/weapons/v_banshee.mdl" + +SWEP.Taunt = Sound( "npc/stalker/go_alert2a.wav" ) + +SWEP.Die = { "npc/headcrab_poison/ph_scream1.wav", +"npc/headcrab_poison/ph_scream2.wav", +"npc/headcrab_poison/ph_scream3.wav"} + +SWEP.Primary.Hit = Sound( "npc/antlion/shell_impact3.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/antlion/foot4.wav" ) +SWEP.Primary.Sound = Sound( "npc/zombie/zo_attack1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 25 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.900 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Right click to use your scream ability", GAMEMODE.Colors.Blue, 5, 10 ) + self.Owner:NoticeOnce( "Your scream will disorient nearby people", GAMEMODE.Colors.Blue, 5, 12 ) + +end + +function SWEP:Holster() + + if SERVER then + + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(40,60) ) + + end + + return true + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SetNextSecondaryFire( CurTime() + 8 ) + + if SERVER then + + self.Owner:VoiceSound( self.Taunt, 100, math.random( 90, 100 ) ) + + local hit = false + + for k,v in pairs( team.GetPlayers( TEAM_ARMY ) ) do + + local dist = v:GetPos():Distance( self.Owner:GetPos() ) + + if dist <= 350 then + + local scale = 1 - ( dist / 350 ) + local count = math.Round( scale * 4 ) + + umsg.Start( "Drunk", v ) + umsg.Short( count ) + umsg.End() + + umsg.Start( "ScreamHit", v ) + umsg.End() + + v:TakeDamage( scale * 20, self.Owner, self.Weapon ) + v:SetDSP( 34, false ) + + self.Owner:AddZedDamage( 5 ) + + hit = true + + end + + end + + if hit then + + self.Owner:Notice( "You disoriented a human", GAMEMODE.Colors.Green ) + + end + + end + +end + +function SWEP:PrimaryAttack() + + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(130,150) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + + self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 ) + +end + +function SWEP:OnHitHuman( ent, dmg ) + + if ent:GetRadiation() != 5 then + + ent:AddRadiation( 1 ) + + self.Owner:AddZedDamage( 10 ) + + end + + self.Owner:AddZedDamage( dmg ) + self.Owner:DrawBlood( 4 ) + self.Owner:Notice( "You irradiated a human", GAMEMODE.Colors.Green ) + +end
\ No newline at end of file diff --git a/entities/weapons/rad_z_base/shared.lua b/entities/weapons/rad_z_base/shared.lua new file mode 100644 index 0000000..0748b8d --- /dev/null +++ b/entities/weapons/rad_z_base/shared.lua @@ -0,0 +1,289 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Claws" + SWEP.IconLetter = "C" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + killicon.AddFont( "rad_z_common", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ); + +end + +SWEP.HoldType = "slam" + +SWEP.Base = "rad_base" + +SWEP.ViewModel = "models/zed/weapons/v_undead.mdl" + +SWEP.IsSniper = false +SWEP.AmmoType = "Knife" +SWEP.ThinkTime = 0 + +SWEP.Primary.Door = Sound( "Wood_Plank.Break" ) +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/idle1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:GetViewModelPosition( pos, ang ) + + return pos, ang + +end + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Hit people to infect them", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +function SWEP:Deploy() + + self.Owner:DrawWorldModel( false ) + + if SERVER then + + self.Weapon:NoobHelp() + + end + + return true + +end + +function SWEP:Holster() + + if SERVER then + + self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) ) + + end + + return true + +end + +function SWEP:SecondaryAttack() + + self.Weapon:SetNextSecondaryFire( CurTime() + 2.5 ) + + if SERVER then + + self.Owner:VoiceSound( table.Random( self.Taunt ), 100, math.random( 90, 100 ) ) + + end + +end + +function SWEP:PrimaryAttack() + + self.Weapon:EmitSound( self.Primary.Sound, 100, math.random(90,110) ) + self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) + + self.ThinkTime = CurTime() + ( self.Primary.Delay * 0.3 ) + +end + +function SWEP:Think() + + if self.ThinkTime != 0 and self.ThinkTime < CurTime() then + + self.Weapon:MeleeTrace( self.Primary.Damage ) + + self.ThinkTime = 0 + + end + +end + +function SWEP:OnHitHuman( ent, dmg ) + + if not ent:IsInfected() then + + ent:SetInfected( true ) + + self.Owner:Notice( "You infected a human", GAMEMODE.Colors.Green ) + self.Owner:AddZedDamage( 15 ) + + end + + self.Owner:AddZedDamage( dmg ) + self.Owner:DrawBlood( 3 ) + +end + +function SWEP:MeleeTrace( dmg ) + + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + + self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) + + if CLIENT then return end + + self.Weapon:SetNWString( "CurrentAnim", "zattack" .. math.random(1,3) ) + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + + local pos = self.Owner:GetShootPos() + local aim = self.Owner:GetAimVector() * 80 + + local line = {} + line.start = pos + line.endpos = pos + aim + line.filter = self.Owner + + local linetr = util.TraceLine( line ) + + local tr = {} + tr.start = pos + self.Owner:GetAimVector() * -5 + tr.endpos = pos + aim + tr.filter = self.Owner + tr.mask = MASK_SHOT_HULL + tr.mins = Vector(-20,-20,-20) + tr.maxs = Vector(20,20,20) + + local trace = util.TraceHull( tr ) + local ent = trace.Entity + local ent2 = linetr.Entity + + if not IsValid( ent ) and IsValid( ent2 ) then + + ent = ent2 + + end + + if not IsValid( ent ) then + + self.Owner:EmitSound( self.Primary.Miss, 100, math.random(90,110) ) + + return + + elseif not ent:IsWorld() then + + if ent:IsPlayer() and ent:Team() == TEAM_ARMY then + + ent:TakeDamage( dmg, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + self.Weapon:OnHitHuman( ent, dmg ) + + local ed = EffectData() + ed:SetOrigin( trace.HitPos ) + util.Effect( "BloodImpact", ed, true, true ) + + elseif string.find( ent:GetClass(), "npc" ) then + + ent:TakeDamage( 20, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.HitFlesh, 100, math.random(90,110) ) + + elseif !ent:IsPlayer() then + + if ent:GetClass() == "prop_door_rotating" then + + if not ent.Hits then + + ent.Hits = 1 + ent.MaxHits = math.random(5,10) + + ent:EmitSound( Sound( "Wood_Plank.Break" ) ) + + else + + ent.Hits = ent.Hits + 1 + + if ent.Hits > ent.MaxHits then + + local prop = ents.Create( "prop_physics" ) + prop:SetPos( ent:GetPos() ) + prop:SetAngles( ent:GetAngles() + Angle(10,0,2) ) + prop:SetModel( ent:GetModel() ) + prop:SetSkin( ent:GetSkin() ) + prop:SetCollisionGroup( COLLISION_GROUP_WEAPON ) + prop:Spawn() + + local dir = ent:GetPos() - self.Owner:GetShootPos() + dir:Normalize() + + local phys = prop:GetPhysicsObject() + + if IsValid( phys ) then + + phys:ApplyForceCenter( dir * phys:GetMass() * 800 ) + + end + + ent:EmitSound( Sound( "Wood_Crate.Break" ) ) + ent:Remove() + + return + + else + + ent:EmitSound( Sound( "Wood_Plank.Break" ) ) + + end + + end + + elseif string.find( ent:GetClass(), "breakable" ) then + + ent:TakeDamage( 50, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + if ent:GetClass() == "func_breakable_surf" then + + ent:Fire( "shatter", "1 1 1", 0 ) + + return + + end + + end + + local phys = ent:GetPhysicsObject() + + if IsValid( phys ) then + + ent:SetPhysicsAttacker( self.Owner ) + ent:EmitSound( self.Primary.Hit, 100, math.random(90,110) ) + + if ent.IsWood then + + ent:TakeDamage( 75, self.Owner, self.Weapon ) + ent:EmitSound( self.Primary.Door ) + + else + + ent:TakeDamage( 25, self.Owner, self.Weapon ) + + end + + phys:Wake() + phys:ApplyForceCenter( self.Owner:GetAimVector() * phys:GetMass() * 400 ) + + end + + end + + end + +end + +function SWEP:DrawHUD() + +end diff --git a/entities/weapons/rad_z_contagion/shared.lua b/entities/weapons/rad_z_contagion/shared.lua new file mode 100644 index 0000000..0bfb142 --- /dev/null +++ b/entities/weapons/rad_z_contagion/shared.lua @@ -0,0 +1,66 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Claws" + SWEP.IconLetter = "C" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + killicon.AddFont( "rad_z_contagion", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) + +end + +SWEP.Base = "rad_z_base" + +SWEP.ViewModel = "models/Zed/weapons/v_ghoul.mdl" + +SWEP.Taunt = {"npc/zombie/zombie_voice_idle1.wav", +"npc/zombie/zombie_voice_idle2.wav", +"npc/zombie/zombie_voice_idle3.wav", +"npc/zombie/zombie_voice_idle4.wav", +"npc/zombie/zombie_voice_idle5.wav", +"npc/zombie/zombie_voice_idle7.wav", +"npc/zombie/zombie_voice_idle8.wav", +"npc/zombie/zombie_voice_idle9.wav", +"npc/zombie/zombie_voice_idle10.wav", +"npc/zombie/zombie_voice_idle12.wav", +"npc/zombie/zombie_voice_idle13.wav", +"npc/zombie/zombie_voice_idle14.wav" } + +SWEP.Die = { "npc/zombie/zombie_die1.wav", +"npc/zombie/zombie_die2.wav", +"npc/zombie/zombie_die3.wav", +"npc/zombie/zombie_voice_idle6.wav", +"npc/zombie/zombie_voice_idle11.wav" } + +SWEP.Primary.Sound = Sound( "npc/zombie/zombie_pain1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 45 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.800 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "You will unleash a toxic shower when you die", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +function SWEP:OnHitHuman( ent, dmg ) + + ent:ViewBounce( 20 ) + + self.Owner:AddZedDamage( dmg ) + self.Owner:DrawBlood( 5 ) + +end diff --git a/entities/weapons/rad_z_leaper/shared.lua b/entities/weapons/rad_z_leaper/shared.lua new file mode 100644 index 0000000..e123b48 --- /dev/null +++ b/entities/weapons/rad_z_leaper/shared.lua @@ -0,0 +1,96 @@ +if SERVER then + + AddCSLuaFile( "shared.lua" ) + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Claws" + SWEP.IconLetter = "C" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + killicon.AddFont( "rad_z_leaper", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) + +end + +SWEP.Base = "rad_z_base" +SWEP.HoldType = "slam" +SWEP.ViewModel = "models/Zed/weapons/v_wretch.mdl" + +SWEP.Taunt = { "npc/fast_zombie/fz_frenzy1.wav", +"npc/barnacle/barnacle_pull1.wav", +"npc/barnacle/barnacle_pull2.wav", +"npc/barnacle/barnacle_pull3.wav", +"npc/barnacle/barnacle_pull4.wav" } + +SWEP.Die = { "npc/fast_zombie/fz_alert_close1.wav", +"npc/fast_zombie/fz_alert_far1.wav" } + +SWEP.Scream = Sound( "npc/fast_zombie/fz_scream1.wav" ) + +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/wake1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 15 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.200 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true + +SWEP.JumpTime = 0 + +function SWEP:NoobHelp() + + self.Owner:NoticeOnce( "Your attacks cause bleeding", GAMEMODE.Colors.Blue, 5, 10 ) + +end + +function SWEP:Think() + + if self.ThinkTime != 0 and self.ThinkTime < CurTime() then + + self.Weapon:MeleeTrace( self.Primary.Damage ) + + self.ThinkTime = 0 + + end + + if CLIENT then return end + + if self.JumpTime < CurTime() and self.Owner:KeyDown( IN_SPEED ) then + + local vec = self.Owner:GetAimVector() + vec.z = math.Clamp( vec.z, 0.40, 0.75 ) + + self.JumpTime = CurTime() + 8 + + self.Owner:SetVelocity( vec * 800 ) + self.Owner:EmitSound( self.Scream, 100, math.random( 90, 110 ) ) + + end + +end + +function SWEP:OnHitHuman( ent, dmg ) + + if not ent:IsBleeding() then + + ent:SetBleeding( true ) + + self.Owner:Notice( "You made a human bleed", GAMEMODE.Colors.Green ) + self.Owner:AddZedDamage( 10 ) + + end + + self.Owner:AddZedDamage( dmg ) + self.Owner:DrawBlood( 5 ) + +end diff --git a/entities/weapons/rad_z_runner/shared.lua b/entities/weapons/rad_z_runner/shared.lua new file mode 100644 index 0000000..feeae59 --- /dev/null +++ b/entities/weapons/rad_z_runner/shared.lua @@ -0,0 +1,44 @@ +if SERVER then + + AddCSLuaFile("shared.lua") + +end + +if CLIENT then + + SWEP.ViewModelFOV = 70 + SWEP.ViewModelFlip = false + + SWEP.PrintName = "Claws" + SWEP.IconLetter = "C" + SWEP.Slot = 0 + SWEP.Slotpos = 0 + + killicon.AddFont( "rad_z_runner", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ); + +end + +SWEP.HoldType = "slam" + +SWEP.Base = "rad_z_base" + +SWEP.Taunt = { "npc/zombie/zombie_alert1.wav", +"npc/zombie/zombie_alert2.wav", +"npc/zombie/zombie_alert3.wav" } + +SWEP.Die = { "vo/npc/vortigaunt/vortigese02.wav", +"vo/npc/vortigaunt/vortigese03.wav", +"vo/npc/vortigaunt/vortigese05.wav", +"vo/npc/vortigaunt/vortigese07.wav" } + +SWEP.Primary.Hit = Sound( "npc/zombie/claw_strike1.wav" ) +SWEP.Primary.HitFlesh = Sound( "npc/zombie/claw_strike2.wav" ) +SWEP.Primary.Sound = Sound( "npc/fast_zombie/idle1.wav" ) +SWEP.Primary.Miss = Sound( "npc/zombie/claw_miss1.wav" ) +SWEP.Primary.Recoil = 3.5 +SWEP.Primary.Damage = 35 +SWEP.Primary.NumShots = 1 +SWEP.Primary.Delay = 1.500 + +SWEP.Primary.ClipSize = 1 +SWEP.Primary.Automatic = true |
