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
|
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
|