1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
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 )
particle:SetEndAlpha( 0 )
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) )
particle:SetDieTime( 0.7 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand( 20, 40 ) )
particle:SetEndSize( math.Rand( 100, 200 ) )
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 )
particle:SetStartSize( math.Rand( 20, 40 ) )
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
dlight.b = 50
dlight.Brightness = math.Rand( 4, 8 )
dlight.Decay = 2048
dlight.size = 2048
dlight.DieTime = CurTime() + 5
end
self.Emitter:Finish()
end
function EFFECT:Think( )
return self.DieTime > CurTime()
end
function EFFECT:Render()
end
function CloudThink( part )
part:SetNextThink( CurTime() + 0.05 )
local scale = 1 - part:GetLifeTime()
local pos = part:GetPos()
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 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.random( 1, 3 ) + scale * 20 )
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
|