diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2016-05-30 14:42:09 -0400 |
| commit | 2736f498f30220b858fc6fac23e7ddc4a597df6d (patch) | |
| tree | 374ceadedb654b00e09dac321620a8320830f734 /entities/effects/smoke_crater/init.lua | |
| download | redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.gz redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.tar.bz2 redead-2736f498f30220b858fc6fac23e7ddc4a597df6d.zip | |
Inital commit
Diffstat (limited to 'entities/effects/smoke_crater/init.lua')
| -rw-r--r-- | entities/effects/smoke_crater/init.lua | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/entities/effects/smoke_crater/init.lua b/entities/effects/smoke_crater/init.lua new file mode 100644 index 0000000..68c713b --- /dev/null +++ b/entities/effects/smoke_crater/init.lua @@ -0,0 +1,52 @@ + + +function EFFECT:Init( data ) + + self.Pos = data:GetOrigin() + self.Magnitude = data:GetMagnitude() or 1 + + self.Emitter = ParticleEmitter( self.Pos ) + self.DieTime = CurTime() + 15 + self.Interval = 0 + +end + + +function EFFECT:Think( ) + + if self.Interval < CurTime() then + + self.Interval = CurTime() + 0.2 + + local particle = self.Emitter:Add( "particles/smokey", self.Pos + VectorRand() * 10 ) + + particle:SetVelocity( Vector( math.Rand(-3,3), math.Rand(-3,3), math.Rand(20,40) ) + WindVector ) + particle:SetDieTime( math.Rand( 10, 15 ) + self.Magnitude ) + particle:SetStartAlpha( math.random( 25, 50 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 5, 25 ) * self.Magnitude ) + particle:SetEndSize( math.Rand( 50, 200 ) * self.Magnitude ) + particle:SetRoll( math.Rand( -360, 360 ) ) + particle:SetRollDelta( math.Rand( -0.1, 0.1 ) ) + + local rand = math.random(10,50) + particle:SetColor( rand, rand, rand ) + + end + + if self.DieTime > CurTime() then + + return true + + else + + self.Emitter:Finish() + return false + + end + +end + +function EFFECT:Render() + +end |
