summaryrefslogtreecommitdiff
path: root/entities/effects/m9k_rg_muzzle_rifle
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
commit7e5db609550cca0d8b8a76c4bf78ba4658962167 (patch)
tree4df54e0c4eccff0b022e0732c258b7b193fd6cfe /entities/effects/m9k_rg_muzzle_rifle
downloadgmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.gz
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.bz2
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.zip
Initial commit
Diffstat (limited to 'entities/effects/m9k_rg_muzzle_rifle')
-rw-r--r--entities/effects/m9k_rg_muzzle_rifle/init.lua117
1 files changed, 117 insertions, 0 deletions
diff --git a/entities/effects/m9k_rg_muzzle_rifle/init.lua b/entities/effects/m9k_rg_muzzle_rifle/init.lua
new file mode 100644
index 0000000..2b9b210
--- /dev/null
+++ b/entities/effects/m9k_rg_muzzle_rifle/init.lua
@@ -0,0 +1,117 @@
+function EFFECT:Init(data)
+
+ if not IsValid(data:GetEntity()) then return end
+ if not IsValid(data:GetEntity():GetOwner()) then return end
+ self.WeaponEnt = data:GetEntity()
+ self.Attachment = data:GetAttachment()
+
+ if self.WeaponEnt == nil or self.WeaponEnt:GetOwner() == nil or self.WeaponEnt:GetOwner():GetVelocity() == nil then
+ return
+ else
+
+ self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment)
+ self.Forward = data:GetNormal()
+ self.Angle = self.Forward:Angle()
+ self.Right = self.Angle:Right()
+
+ local AddVel = self.WeaponEnt:GetOwner():GetVelocity()
+
+ local emitter = ParticleEmitter(self.Position)
+ if emitter != nil then
+ local particle = emitter:Add( "sprites/heatwave", self.Position - self.Forward * 4 )
+ if particle != nil then
+
+ particle:SetVelocity( 80 * self.Forward + 20 * VectorRand() + 1.05 * AddVel )
+ particle:SetGravity( Vector( 0, 0, 100 ) )
+ particle:SetAirResistance( 160 )
+
+ particle:SetDieTime( math.Rand( 0.2, 0.25 ) )
+
+ particle:SetStartSize( math.random( 25, 40 ) )
+ particle:SetEndSize( 10 )
+
+ particle:SetRoll( math.Rand( 180, 480 ) )
+ particle:SetRollDelta( math.Rand( -1, 1 ) )
+
+ for i = 1,4 do
+ local particle = emitter:Add( "particle/particle_smokegrenade", self.Position )
+
+ particle:SetVelocity( 120 * i * self.Forward + 8 * VectorRand() + AddVel )
+ particle:SetAirResistance( 400 )
+ particle:SetGravity( Vector(0, 0, math.Rand(100, 200) ) )
+
+ particle:SetDieTime( math.Rand( 0.5, 1.0 ) )
+
+ particle:SetStartAlpha( math.Rand( 25, 70 ) )
+ particle:SetEndAlpha( 0 )
+
+ particle:SetStartSize( math.Rand( 3, 7 ) )
+ particle:SetEndSize( math.Rand( 20, 50 ) )
+
+ particle:SetRoll( math.Rand( -25, 25 ) )
+ particle:SetRollDelta( math.Rand( -0.05, 0.05 ) )
+
+ particle:SetColor( 120, 120, 120 )
+ end
+
+ if math.random( 1, 2 ) == 1 then
+
+ for j = 1,2 do
+
+ for i = -1,1,2 do
+
+ local particle = emitter:Add( "effects/muzzleflash"..math.random( 1, 4 ), self.Position - 3 * self.Forward + 2 * j * i * self.Right)
+
+ particle:SetVelocity( 60 * j * i * self.Right + AddVel )
+ particle:SetGravity( AddVel )
+
+ particle:SetDieTime( 0.1 )
+
+ particle:SetStartAlpha( 150 )
+
+ particle:SetStartSize( j )
+ particle:SetEndSize( 4 * j )
+
+ particle:SetRoll( math.Rand( 180, 480 ) )
+ particle:SetRollDelta( math.Rand( -1, 1 ) )
+
+ particle:SetColor( 255, 255, 255 )
+ end
+ end
+
+ for i = 1,2 do
+
+ local particle = emitter:Add( "effects/muzzleflash"..math.random( 1, 4 ), self.Position + 8 * self.Forward )
+
+ particle:SetVelocity( 350 * self.Forward + 1.1 * AddVel )
+ particle:SetAirResistance( 160 )
+
+ particle:SetDieTime( 0.1 )
+
+ particle:SetStartAlpha( 160 )
+ particle:SetEndAlpha( 0 )
+
+ particle:SetStartSize( 6 * i )
+ particle:SetEndSize( 5 * i )
+
+ particle:SetRoll( math.Rand( 180, 480 ) )
+ particle:SetRollDelta( math.Rand( -1, 1) )
+
+ particle:SetColor( 255, 255, 255 )
+ end
+ end
+ end
+ emitter:Finish()
+ end
+ end
+end
+
+
+function EFFECT:Think()
+
+ return false
+end
+
+
+function EFFECT:Render()
+end \ No newline at end of file