summaryrefslogtreecommitdiff
path: root/entities/weapons/rad_firegun/shared.lua
diff options
context:
space:
mode:
Diffstat (limited to 'entities/weapons/rad_firegun/shared.lua')
-rw-r--r--entities/weapons/rad_firegun/shared.lua110
1 files changed, 55 insertions, 55 deletions
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