summaryrefslogtreecommitdiff
path: root/entities/weapons
diff options
context:
space:
mode:
Diffstat (limited to 'entities/weapons')
-rw-r--r--entities/weapons/rad_ak47/shared.lua6
-rw-r--r--entities/weapons/rad_awp/shared.lua6
-rw-r--r--entities/weapons/rad_base/shared.lua601
-rw-r--r--entities/weapons/rad_berettas/shared.lua42
-rw-r--r--entities/weapons/rad_deagle/shared.lua8
-rw-r--r--entities/weapons/rad_experimental/shared.lua86
-rw-r--r--entities/weapons/rad_famas/shared.lua4
-rw-r--r--entities/weapons/rad_firegun/shared.lua110
-rw-r--r--entities/weapons/rad_fiveseven/shared.lua6
-rw-r--r--entities/weapons/rad_g3/shared.lua34
-rw-r--r--entities/weapons/rad_galil/shared.lua4
-rw-r--r--entities/weapons/rad_glock/shared.lua6
-rw-r--r--entities/weapons/rad_grenade/shared.lua89
-rw-r--r--entities/weapons/rad_incendiarygrenade/shared.lua89
-rw-r--r--entities/weapons/rad_inv/shared.lua410
-rw-r--r--entities/weapons/rad_itemplacer/shared.lua164
-rw-r--r--entities/weapons/rad_m1014/shared.lua196
-rw-r--r--entities/weapons/rad_m249/shared.lua7
-rw-r--r--entities/weapons/rad_mac10/shared.lua6
-rw-r--r--entities/weapons/rad_mp5/shared.lua6
-rw-r--r--entities/weapons/rad_p228/shared.lua6
-rw-r--r--entities/weapons/rad_p90/shared.lua6
-rw-r--r--entities/weapons/rad_revolver/shared.lua36
-rw-r--r--entities/weapons/rad_scout/shared.lua6
-rw-r--r--entities/weapons/rad_sg552/shared.lua82
-rw-r--r--entities/weapons/rad_shotgun/shared.lua206
-rw-r--r--entities/weapons/rad_spas12/shared.lua220
-rw-r--r--entities/weapons/rad_tmp/shared.lua6
-rw-r--r--entities/weapons/rad_ump45/shared.lua6
-rw-r--r--entities/weapons/rad_usp/shared.lua6
-rw-r--r--entities/weapons/rad_z_banshee/shared.lua62
-rw-r--r--entities/weapons/rad_z_base/shared.lua182
-rw-r--r--entities/weapons/rad_z_contagion/shared.lua10
-rw-r--r--entities/weapons/rad_z_leaper/shared.lua36
-rw-r--r--entities/weapons/rad_z_runner/shared.lua8
35 files changed, 1376 insertions, 1382 deletions
diff --git a/entities/weapons/rad_ak47/shared.lua b/entities/weapons/rad_ak47/shared.lua
index 36d2799..a0001df 100644
--- a/entities/weapons/rad_ak47/shared.lua
+++ b/entities/weapons/rad_ak47/shared.lua
@@ -1,16 +1,16 @@
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"
diff --git a/entities/weapons/rad_awp/shared.lua b/entities/weapons/rad_awp/shared.lua
index f20fd07..64a656b 100644
--- a/entities/weapons/rad_awp/shared.lua
+++ b/entities/weapons/rad_awp/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_base/shared.lua b/entities/weapons/rad_base/shared.lua
index 63ef374..684572f 100644
--- a/entities/weapons/rad_base/shared.lua
+++ b/entities/weapons/rad_base/shared.lua
@@ -1,11 +1,11 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
SWEP.Weight = 1
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
-
+
end
if CLIENT then
@@ -16,18 +16,18 @@ if CLIENT then
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"
@@ -84,7 +84,7 @@ 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.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
@@ -169,19 +169,19 @@ 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
@@ -193,23 +193,23 @@ function SWEP:AngApproach( newang, ang, mul )
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 )
+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
@@ -218,7 +218,7 @@ 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
@@ -226,40 +226,40 @@ 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
+
+ end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+end
function SWEP:Holster()
-
+
return true
end
-function SWEP:Think()
+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
@@ -267,19 +267,19 @@ 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
@@ -287,7 +287,7 @@ end
function SWEP:GetZoomMode()
return self.Weapon:GetNWInt( "Mode", 1 )
-
+
end
function SWEP:UnZoom()
@@ -296,67 +296,67 @@ function SWEP:UnZoom()
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
-
+
+ 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
+
+ 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
+
end
function SWEP:DoReload()
local time = self.Weapon:StartWeaponAnim( ACT_VM_RELOAD )
-
+
self.Weapon:SetNextPrimaryFire( CurTime() + time + 0.080 )
-
+
self.ReloadTime = CurTime() + time
end
@@ -364,10 +364,10 @@ end
function SWEP:ReloadThink()
if self.ReloadTime and self.ReloadTime <= CurTime() then
-
+
self.ReloadTime = nil
self.Weapon:SetClip1( self.Primary.ClipSize )
-
+
end
end
@@ -377,120 +377,120 @@ 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
-
+
+ if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
-
- return false
-
+
+ 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
-
+
+ end
+
return false
-
+
end
-
+
return true
-
+
end
-function SWEP:ShootEffects()
+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
+
+ 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
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ 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
@@ -498,31 +498,31 @@ 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()
@@ -536,101 +536,101 @@ 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 )
+end
+
+function SWEP:GetDamageFalloffScale( distance )
+
+ local scale = 1
- local scale = 1
+ if distance > self.FalloffDistances[ self.AmmoType ].Range then
- if distance > self.FalloffDistances[ self.AmmoType ].Range then
+ scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) )
- scale = ( 1 - ( ( distance - self.FalloffDistances[ self.AmmoType ].Range ) / self.FalloffDistances[ self.AmmoType ].Falloff ) )
+ end
- 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.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 0
- bullet.Force = damage * 2
+ 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 )
@@ -642,168 +642,168 @@ function SWEP:GetPenetrationDamageLoss( mat_type, distance, damage )
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
-
+
+ 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 )
-
+
+ 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 =
- {
+
+ local bullet =
+ {
Num = 1,
Src = PeneTrace.HitPos,
- Dir = tr.Normal,
+ 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 )
-
+ 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 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 )
-
+
+ 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 =
- {
+
+ local bullet =
+ {
Num = 1,
Src = PeneTrace.HitPos,
- Dir = tr.Normal,
+ Dir = tr.Normal,
Spread = Vector( 0, 0, 0 ),
Tracer = 0,
Force = 5,
Damage = new_damage,
AmmoType = "Pistol",
}
-
- bullet.Callback = function( a, b, c )
-
+
+ bullet.Callback = function( a, b, c )
+
if IsValid( self ) and IsValid( self.Weapon ) then
-
+
self.Weapon:BulletPenetration( attacker, tr, dmginfo, bounce + 1 )
-
- end
-
+
+ end
+
end
-
+
local effectdata = EffectData()
effectdata:SetOrigin( PeneTrace.HitPos );
effectdata:SetNormal( PeneTrace.Normal );
- util.Effect( "Impact", effectdata )
-
+ 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
@@ -813,7 +813,7 @@ if CLIENT then
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" )
@@ -824,120 +824,120 @@ 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
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
@@ -945,14 +945,13 @@ function SWEP:DrawHUD()
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
+end
diff --git a/entities/weapons/rad_berettas/shared.lua b/entities/weapons/rad_berettas/shared.lua
index 4ffeebd..ff48da6 100644
--- a/entities/weapons/rad_berettas/shared.lua
+++ b/entities/weapons/rad_berettas/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -44,36 +44,36 @@ SWEP.Primary.Delay = 0.180
SWEP.Primary.ClipSize = 30
SWEP.Primary.Automatic = false
-function SWEP:ShootEffects()
+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.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
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -81,11 +81,11 @@ end
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_deagle/shared.lua b/entities/weapons/rad_deagle/shared.lua
index 1bc4118..5298747 100644
--- a/entities/weapons/rad_deagle/shared.lua
+++ b/entities/weapons/rad_deagle/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -36,4 +36,4 @@ SWEP.Primary.Cone = 0.030
SWEP.Primary.Delay = 0.380
SWEP.Primary.ClipSize = 7
-SWEP.Primary.Automatic = false \ No newline at end of file
+SWEP.Primary.Automatic = false
diff --git a/entities/weapons/rad_experimental/shared.lua b/entities/weapons/rad_experimental/shared.lua
index f8da7b8..4c2d1b8 100644
--- a/entities/weapons/rad_experimental/shared.lua
+++ b/entities/weapons/rad_experimental/shared.lua
@@ -1,20 +1,20 @@
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"
@@ -51,28 +51,28 @@ SWEP.Primary.Delay = 1.400
SWEP.Primary.ClipSize = 3
SWEP.Primary.Automatic = true
-function SWEP:ShootEffects()
+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 )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -81,11 +81,11 @@ function SWEP:PrimaryAttack()
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
@@ -93,62 +93,62 @@ 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.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 1
- bullet.Force = damage * 2
+ 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
index b7966f4..7b8682b 100644
--- a/entities/weapons/rad_famas/shared.lua
+++ b/entities/weapons/rad_famas/shared.lua
@@ -1,13 +1,13 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "FAMAS"
SWEP.IconLetter = "v"
SWEP.Slot = 4
diff --git a/entities/weapons/rad_firegun/shared.lua b/entities/weapons/rad_firegun/shared.lua
index a8e3ae8..5e83dc9 100644
--- a/entities/weapons/rad_firegun/shared.lua
+++ b/entities/weapons/rad_firegun/shared.lua
@@ -1,20 +1,20 @@
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"
@@ -52,28 +52,28 @@ SWEP.Primary.Delay = 1.700
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = true
-function SWEP:ShootEffects()
+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 )
-
+
+ self.Owner:MuzzleFlash()
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
+ self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK )
+
end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -82,14 +82,14 @@ function SWEP:PrimaryAttack()
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
@@ -97,16 +97,16 @@ 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" }
@@ -114,77 +114,77 @@ 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.Src = self.Owner:GetShootPos()
+ bullet.Dir = self.Owner:GetAimVector()
+ bullet.Spread = Vector( scale, scale, 0 )
bullet.Tracer = 1
- bullet.Force = damage * 2
+ 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
index 28ce60e..3634c0e 100644
--- a/entities/weapons/rad_fiveseven/shared.lua
+++ b/entities/weapons/rad_fiveseven/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_g3/shared.lua b/entities/weapons/rad_g3/shared.lua
index 8e9d8b7..d55b732 100644
--- a/entities/weapons/rad_g3/shared.lua
+++ b/entities/weapons/rad_g3/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -44,33 +44,33 @@ SWEP.Primary.Automatic = true
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ 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
+end
diff --git a/entities/weapons/rad_galil/shared.lua b/entities/weapons/rad_galil/shared.lua
index 246ab86..e92a431 100644
--- a/entities/weapons/rad_galil/shared.lua
+++ b/entities/weapons/rad_galil/shared.lua
@@ -1,13 +1,13 @@
if SERVER then
AddCSLuaFile("shared.lua")
-
+
end
if CLIENT then
SWEP.ViewModelFlip = false
-
+
SWEP.PrintName = "IMI Galil"
SWEP.IconLetter = "v"
SWEP.Slot = 4
diff --git a/entities/weapons/rad_glock/shared.lua b/entities/weapons/rad_glock/shared.lua
index fd00c73..67c8f87 100644
--- a/entities/weapons/rad_glock/shared.lua
+++ b/entities/weapons/rad_glock/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_grenade/shared.lua b/entities/weapons/rad_grenade/shared.lua
index 516f491..fe05c4a 100644
--- a/entities/weapons/rad_grenade/shared.lua
+++ b/entities/weapons/rad_grenade/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = false
-function SWEP:Think()
+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
-
+
+ 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
-
+
+ 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
@@ -113,7 +113,7 @@ function SWEP:SecondaryAttack()
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
@@ -126,26 +126,25 @@ function SWEP:PrimaryAttack()
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()
+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 ) )
-
+
+ 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 )
-
+
+ self.Owner:SetAnimation( PLAYER_ATTACK1 )
+
end
function SWEP:DrawHUD()
end
-
diff --git a/entities/weapons/rad_incendiarygrenade/shared.lua b/entities/weapons/rad_incendiarygrenade/shared.lua
index 3dda5dc..42e2723 100644
--- a/entities/weapons/rad_incendiarygrenade/shared.lua
+++ b/entities/weapons/rad_incendiarygrenade/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -39,70 +39,70 @@ SWEP.Primary.Delay = 2.300
SWEP.Primary.ClipSize = 1
SWEP.Primary.Automatic = false
-function SWEP:Think()
+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
-
+
+ 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
-
+
+ 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
@@ -113,7 +113,7 @@ function SWEP:SecondaryAttack()
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
@@ -126,26 +126,25 @@ function SWEP:PrimaryAttack()
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()
+function SWEP:ShootEffects()
if SERVER then
-
- self.Owner:ViewBounce( self.Primary.Recoil )
-
+
+ self.Owner:ViewBounce( self.Primary.Recoil )
+
end
-
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
+
+ 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
index 50e7691..15510d4 100644
--- a/entities/weapons/rad_inv/shared.lua
+++ b/entities/weapons/rad_inv/shared.lua
@@ -1,19 +1,19 @@
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"
@@ -39,13 +39,13 @@ 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
@@ -54,33 +54,33 @@ end
function SWEP:Deploy()
- if SERVER then
-
+ 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
-
+
+ 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
-
+
+ return true
+
end
function SWEP:GeneratePanels()
@@ -88,42 +88,42 @@ 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
@@ -132,35 +132,35 @@ 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 = {}
@@ -170,7 +170,7 @@ end
function SWEP:RemovePanel()
if not self.InvPanels[1] then return end
-
+
self.InvPanels[1].Removal = true
end
@@ -178,9 +178,9 @@ end
function SWEP:RemoveAllPanels()
for k,v in pairs( self.InvPanels ) do
-
+
v.Removal = true
-
+
end
end
@@ -188,50 +188,50 @@ 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
@@ -239,152 +239,152 @@ 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 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: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.Start( "InvSWEP", self.Owner )
umsg.End()
-
+
end
function RecvSynch()
@@ -394,68 +394,68 @@ function RecvSynch()
end
usermessage.Hook( "InvSWEP", RecvSynch )
-function SWEP:Think()
+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 ) )
@@ -466,97 +466,97 @@ 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
index 12dad13..6ae189d 100644
--- a/entities/weapons/rad_itemplacer/shared.lua
+++ b/entities/weapons/rad_itemplacer/shared.lua
@@ -1,11 +1,11 @@
if SERVER then
AddCSLuaFile( "shared.lua" )
-
+
SWEP.Weight = 1
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
-
+
end
if CLIENT then
@@ -19,15 +19,15 @@ if CLIENT then
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"
@@ -71,35 +71,35 @@ 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
@@ -120,51 +120,51 @@ 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()
+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
@@ -172,17 +172,17 @@ 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()
@@ -191,21 +191,21 @@ function SWEP:Holster()
end
-function SWEP:ShootEffects()
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+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()
@@ -218,13 +218,13 @@ 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
@@ -232,64 +232,62 @@ 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
+ end
+end
diff --git a/entities/weapons/rad_m1014/shared.lua b/entities/weapons/rad_m1014/shared.lua
index 9d4ca65..2b176a5 100644
--- a/entities/weapons/rad_m1014/shared.lua
+++ b/entities/weapons/rad_m1014/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -45,64 +45,64 @@ function SWEP:Deploy()
self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 )
if SERVER then
-
+
self.Weapon:SetZoomMode( 1 )
-
- end
-
+
+ end
+
self.InIron = false
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+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
-
+
+ if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ 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
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -110,17 +110,17 @@ function SWEP:PrimaryAttack()
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
@@ -128,73 +128,73 @@ 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
@@ -202,61 +202,61 @@ 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.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.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()
@@ -264,36 +264,36 @@ 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
index 7e72cd2..96a4830 100644
--- a/entities/weapons/rad_m249/shared.lua
+++ b/entities/weapons/rad_m249/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -37,4 +37,3 @@ 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
index 3e95b6e..b69d53b 100644
--- a/entities/weapons/rad_mac10/shared.lua
+++ b/entities/weapons/rad_mac10/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_mp5/shared.lua b/entities/weapons/rad_mp5/shared.lua
index e41ef49..b5e3025 100644
--- a/entities/weapons/rad_mp5/shared.lua
+++ b/entities/weapons/rad_mp5/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_p228/shared.lua b/entities/weapons/rad_p228/shared.lua
index 56c1415..9a21f5b 100644
--- a/entities/weapons/rad_p228/shared.lua
+++ b/entities/weapons/rad_p228/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_p90/shared.lua b/entities/weapons/rad_p90/shared.lua
index 2055466..7525436 100644
--- a/entities/weapons/rad_p90/shared.lua
+++ b/entities/weapons/rad_p90/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_revolver/shared.lua b/entities/weapons/rad_revolver/shared.lua
index 2b34184..d6bcce5 100644
--- a/entities/weapons/rad_revolver/shared.lua
+++ b/entities/weapons/rad_revolver/shared.lua
@@ -1,19 +1,19 @@
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"
@@ -41,31 +41,31 @@ SWEP.Primary.Delay = 0.850
SWEP.Primary.ClipSize = 6
SWEP.Primary.Automatic = false
-function SWEP:ShootEffects()
+function SWEP:ShootEffects()
if SERVER then
-
- self.Owner:ViewBounce( self.Primary.Recoil )
-
+
+ self.Owner:ViewBounce( self.Primary.Recoil )
+
end
-
- self.Owner:MuzzleFlash()
- self.Owner:SetAnimation( PLAYER_ATTACK1 )
-
- self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
-
+
+ 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 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
+
+end
diff --git a/entities/weapons/rad_scout/shared.lua b/entities/weapons/rad_scout/shared.lua
index d7fa4d0..6fafaca 100644
--- a/entities/weapons/rad_scout/shared.lua
+++ b/entities/weapons/rad_scout/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_sg552/shared.lua b/entities/weapons/rad_sg552/shared.lua
index 9d22ef2..393ab68 100644
--- a/entities/weapons/rad_sg552/shared.lua
+++ b/entities/weapons/rad_sg552/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -45,13 +45,13 @@ 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] )
@@ -59,39 +59,39 @@ end
function SWEP:PrimaryAttack()
- if not self.Weapon:CanPrimaryAttack() then
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.25 )
-
- return
-
+
+ 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
@@ -99,49 +99,49 @@ 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
@@ -149,11 +149,11 @@ function SWEP:DrawHUD()
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
+
+end
diff --git a/entities/weapons/rad_shotgun/shared.lua b/entities/weapons/rad_shotgun/shared.lua
index d754462..6b424dd 100644
--- a/entities/weapons/rad_shotgun/shared.lua
+++ b/entities/weapons/rad_shotgun/shared.lua
@@ -1,18 +1,18 @@
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"
@@ -47,85 +47,85 @@ 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
+
+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
-
+
+ if self.Owner:GetNWInt( "Ammo" .. self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ 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()
+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 )
-
+
+ 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
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
-
+
self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -133,11 +133,11 @@ function SWEP:PrimaryAttack()
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
@@ -145,17 +145,17 @@ 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()
@@ -164,70 +164,70 @@ function SWEP:PumpIt()
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
@@ -235,53 +235,53 @@ 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.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.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()
@@ -292,29 +292,29 @@ function SWEP:DrawHUD()
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
index c3bcfb7..432ed09 100644
--- a/entities/weapons/rad_spas12/shared.lua
+++ b/entities/weapons/rad_spas12/shared.lua
@@ -1,19 +1,19 @@
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"
@@ -53,89 +53,89 @@ function SWEP:Deploy()
self.Weapon:SetNextPrimaryFire( CurTime() + 0.3 )
if SERVER then
-
+
self.Weapon:SetZoomMode( 1 )
-
+
end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
-
+
return true
-
-end
+
+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
-
+
+ if self.Owner:GetNWInt( "Ammo"..self.AmmoType, 0 ) < 1 then
+
self.Weapon:EmitSound( self.Primary.Empty )
- return false
-
+ 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()
+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 )
-
+
+ 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
-
+ if not self.Weapon:CanPrimaryAttack() then
+
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )
- return
-
+ return
+
end
-
+
self.Weapon:SetVar( "PumpTime", CurTime() + 0.5 )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
@@ -143,11 +143,11 @@ function SWEP:PrimaryAttack()
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
@@ -155,18 +155,18 @@ 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()
@@ -175,73 +175,73 @@ function SWEP:PumpIt()
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
@@ -249,61 +249,61 @@ 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.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.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()
@@ -314,29 +314,29 @@ function SWEP:DrawHUD()
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
index f0a794a..0653b17 100644
--- a/entities/weapons/rad_tmp/shared.lua
+++ b/entities/weapons/rad_tmp/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_ump45/shared.lua b/entities/weapons/rad_ump45/shared.lua
index b8191ca..6f232d1 100644
--- a/entities/weapons/rad_ump45/shared.lua
+++ b/entities/weapons/rad_ump45/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_usp/shared.lua b/entities/weapons/rad_usp/shared.lua
index 91db700..ea321a3 100644
--- a/entities/weapons/rad_usp/shared.lua
+++ b/entities/weapons/rad_usp/shared.lua
@@ -1,18 +1,18 @@
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"
diff --git a/entities/weapons/rad_z_banshee/shared.lua b/entities/weapons/rad_z_banshee/shared.lua
index 00e881a..eae8fd9 100644
--- a/entities/weapons/rad_z_banshee/shared.lua
+++ b/entities/weapons/rad_z_banshee/shared.lua
@@ -1,21 +1,21 @@
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"
@@ -49,11 +49,11 @@ end
function SWEP:Holster()
if SERVER then
-
+
self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(40,60) )
-
+
end
-
+
return true
end
@@ -61,57 +61,57 @@ 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 )
@@ -119,13 +119,13 @@ 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
+end
diff --git a/entities/weapons/rad_z_base/shared.lua b/entities/weapons/rad_z_base/shared.lua
index 0748b8d..3ccbcf0 100644
--- a/entities/weapons/rad_z_base/shared.lua
+++ b/entities/weapons/rad_z_base/shared.lua
@@ -1,21 +1,21 @@
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"
@@ -44,7 +44,7 @@ SWEP.Primary.Automatic = true
function SWEP:GetViewModelPosition( pos, ang )
return pos, ang
-
+
end
function SWEP:NoobHelp()
@@ -56,13 +56,13 @@ end
function SWEP:Deploy()
self.Owner:DrawWorldModel( false )
-
+
if SERVER then
-
+
self.Weapon:NoobHelp()
-
+
end
-
+
return true
end
@@ -70,11 +70,11 @@ end
function SWEP:Holster()
if SERVER then
-
- self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) )
-
+
+ self.Owner:EmitSound( table.Random( self.Die ), 100, math.random(90,110) )
+
end
-
+
return true
end
@@ -82,32 +82,32 @@ 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()
+function SWEP:Think()
if self.ThinkTime != 0 and self.ThinkTime < CurTime() then
-
+
self.Weapon:MeleeTrace( self.Primary.Damage )
-
+
self.ThinkTime = 0
-
+
end
end
@@ -115,40 +115,40 @@ 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
@@ -160,54 +160,54 @@ function SWEP:MeleeTrace( dmg )
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
-
+ if not IsValid( ent ) then
+
self.Owner:EmitSound( self.Primary.Miss, 100, math.random(90,110) )
-
- return
-
+
+ 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
-
+
+ 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) )
@@ -215,75 +215,75 @@ function SWEP:MeleeTrace( dmg )
prop:SetSkin( ent:GetSkin() )
prop:SetCollisionGroup( COLLISION_GROUP_WEAPON )
prop:Spawn()
-
- local dir = ent:GetPos() - self.Owner:GetShootPos()
+
+ 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
index 0bfb142..ace303b 100644
--- a/entities/weapons/rad_z_contagion/shared.lua
+++ b/entities/weapons/rad_z_contagion/shared.lua
@@ -1,21 +1,21 @@
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"
@@ -59,7 +59,7 @@ end
function SWEP:OnHitHuman( ent, dmg )
ent:ViewBounce( 20 )
-
+
self.Owner:AddZedDamage( dmg )
self.Owner:DrawBlood( 5 )
diff --git a/entities/weapons/rad_z_leaper/shared.lua b/entities/weapons/rad_z_leaper/shared.lua
index e123b48..ee4db39 100644
--- a/entities/weapons/rad_z_leaper/shared.lua
+++ b/entities/weapons/rad_z_leaper/shared.lua
@@ -1,21 +1,21 @@
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"
@@ -53,28 +53,28 @@ function SWEP:NoobHelp()
end
-function SWEP:Think()
+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
@@ -84,13 +84,13 @@ 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
index feeae59..a9e766f 100644
--- a/entities/weapons/rad_z_runner/shared.lua
+++ b/entities/weapons/rad_z_runner/shared.lua
@@ -1,21 +1,21 @@
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"