summaryrefslogtreecommitdiff
path: root/entities/effects/bomb_explosion/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'entities/effects/bomb_explosion/init.lua')
-rw-r--r--entities/effects/bomb_explosion/init.lua66
1 files changed, 33 insertions, 33 deletions
diff --git a/entities/effects/bomb_explosion/init.lua b/entities/effects/bomb_explosion/init.lua
index 459c3bd..9078921 100644
--- a/entities/effects/bomb_explosion/init.lua
+++ b/entities/effects/bomb_explosion/init.lua
@@ -4,19 +4,19 @@ local matRefraction = Material( "refract_ring" )
function EFFECT:Init( data )
self.Entity:SetRenderBounds( Vector() * -1024, Vector() * 1024 )
-
+
self.Pos = data:GetOrigin()
self.Norm = data:GetNormal()
self.Emitter = ParticleEmitter( self.Pos )
self.DieTime = CurTime() + 5
-
+
for i=1, math.random(3,6) do
-
+
local vec = self.Norm + VectorRand() * 0.7
vec.x = math.Clamp( vec.x, -1.0, 0 )
-
+
local particle = self.Emitter:Add( "effects/fire_cloud2", self.Pos )
-
+
particle:SetVelocity( vec * math.random( 400, 600 ) )
particle:SetDieTime( 1.0 )
particle:SetStartAlpha( 255 )
@@ -24,19 +24,19 @@ function EFFECT:Init( data )
particle:SetStartSize( 5 )
particle:SetEndSize( 0 )
particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 )
-
+
particle:SetGravity( Vector( 0, 0, math.random( -700, -500 ) ) )
particle:SetAirResistance( math.random( 20, 60 ) )
particle:SetCollide( true )
-
+
particle:SetLifeTime( 0 )
particle:SetThinkFunction( CloudThink )
particle:SetNextThink( CurTime() + 0.1 )
-
+
end
-
+
for i=1, 15 do
-
+
local particle = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
particle:SetVelocity( self.Norm * math.random(50,100) + VectorRand() * math.random(50,100) )
@@ -48,9 +48,9 @@ function EFFECT:Init( data )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.2, 0.2 ) )
particle:SetColor( math.random( 150, 255 ), math.random( 100, 150 ), 100 )
-
+
local particle = self.Emitter:Add( "particle/particle_smokegrenade", self.Pos )
-
+
particle:SetDieTime( math.Rand( 1.5, 2.0 ) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
@@ -58,32 +58,32 @@ function EFFECT:Init( data )
particle:SetEndSize( math.Rand( 100, 150 ) )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local vec = VectorRand()
vec.x = math.Rand( -0.1, 0.1 )
-
+
if i % 2 == 0 then
-
+
particle:SetVelocity( self.Norm * math.random(100,150) + vec * math.random(40,80) )
-
+
else
-
+
particle:SetVelocity( vec * math.random(100,150) )
-
+
end
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
particle:SetGravity( Vector(0,0,-50) )
particle:SetCollide( true )
-
+
end
-
+
local dlight = DynamicLight( self.Entity:EntIndex() )
-
+
if dlight then
-
+
dlight.Pos = self.Pos
dlight.r = 250
dlight.g = 200
@@ -92,17 +92,17 @@ function EFFECT:Init( data )
dlight.Decay = 2048
dlight.size = 2048
dlight.DieTime = CurTime() + 5
-
+
end
-
+
self.Emitter:Finish()
-
+
end
function EFFECT:Think( )
- return self.DieTime > CurTime()
-
+ return self.DieTime > CurTime()
+
end
function EFFECT:Render()
@@ -118,9 +118,9 @@ function CloudThink( part )
local emitter = ParticleEmitter( pos )
local vec = VectorRand()
vec.x = math.Rand( -0.1, 0 )
-
+
local particle = emitter:Add( "particle/particle_smokegrenade", pos )
-
+
particle:SetVelocity( vec * 3 + ( WindVector * ( 2 * ( 1 - scale ) ) ) )
particle:SetDieTime( math.Rand( 2.0, 3.0 ) + scale * 1.0 )
particle:SetStartAlpha( math.random( 100, 150 ) )
@@ -129,10 +129,10 @@ function CloudThink( part )
particle:SetEndSize( math.random( 1, 5 ) + scale * 30 )
particle:SetRoll( math.Rand( -360, 360 ) )
particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
-
+
local dark = math.random( 10, 50 )
particle:SetColor( dark, dark, dark )
-
+
emitter:Finish()
end