diff options
| author | Scott <scotth0828@gmail.com> | 2016-04-30 20:31:37 -0400 |
|---|---|---|
| committer | Scott <scotth0828@gmail.com> | 2016-04-30 20:31:37 -0400 |
| commit | e8fc8b5bf824ed3283dede946e66f5fd843d54ff (patch) | |
| tree | cf935647c5c5ae0c44b30e8a1256df7799c41a5a /ftp_gmstranded/entities/effects | |
| parent | 6f6cce0561c19e7af14bcc6e6b1c7de2d5efc530 (diff) | |
| download | gmstranded-e8fc8b5bf824ed3283dede946e66f5fd843d54ff.tar.gz gmstranded-e8fc8b5bf824ed3283dede946e66f5fd843d54ff.tar.bz2 gmstranded-e8fc8b5bf824ed3283dede946e66f5fd843d54ff.zip | |
Some changes
Diffstat (limited to 'ftp_gmstranded/entities/effects')
4 files changed, 303 insertions, 0 deletions
diff --git a/ftp_gmstranded/entities/effects/gms_loot_effect.lua b/ftp_gmstranded/entities/effects/gms_loot_effect.lua new file mode 100644 index 0000000..0b8d1ef --- /dev/null +++ b/ftp_gmstranded/entities/effects/gms_loot_effect.lua @@ -0,0 +1,41 @@ + +AddCSLuaFile() + +function EFFECT:Init( data ) + local pos = data:GetOrigin() + local NumParticles = 8 + local emitter = ParticleEmitter( pos, true ) + local color = Color( 255, 255, 100, 255 ) + + for i = 0, NumParticles do + local offset = Vector( math.random( -16, 16 ), math.random( -16, 16 ), 0 ) + local particle = emitter:Add( "particle/fire", pos + offset ) + if ( particle ) then + particle:SetLifeTime( 0 ) + particle:SetDieTime( 3 ) + + particle:SetGravity( Vector( 0, 0, 32 ) ) + particle:SetVelocity( Vector( math.random( -16, 16 ), math.random( -16, 16 ), 0 ) ) + + particle:SetStartSize( math.Rand( 3, 6 ) ) + particle:SetEndSize( 0 ) + + particle:SetRoll( math.Rand( 0, 360 ) ) + particle:SetRollDelta( math.Rand( -4, 4 ) ) + + local RandDarkness = math.Rand( 0, 0.5 ) + particle:SetColor( color.r * RandDarkness, color.g * RandDarkness, color.b * RandDarkness ) + particle:SetAngleVelocity( Angle( math.Rand( -180, 180 ), math.Rand( -180, 180 ), math.Rand( -180, 180 ) ) ) + //particle:SetLighting( true ) + end + end + + emitter:Finish() +end + +function EFFECT:Think() + return false +end + +function EFFECT:Render() +end diff --git a/ftp_gmstranded/entities/effects/m9k_effect_mad_penetration_trace/init.lua b/ftp_gmstranded/entities/effects/m9k_effect_mad_penetration_trace/init.lua new file mode 100644 index 0000000..24a23e8 --- /dev/null +++ b/ftp_gmstranded/entities/effects/m9k_effect_mad_penetration_trace/init.lua @@ -0,0 +1,45 @@ +EFFECT.Mat = Material( "effects/spark" ) + +/*--------------------------------------------------------- + EFFECT:Init(data) +---------------------------------------------------------*/ +function EFFECT:Init(data) + + self.StartPos = data:GetStart() + self.EndPos = data:GetOrigin() + self.Dir = self.EndPos - self.StartPos + self.Entity:SetRenderBoundsWS(self.StartPos, self.EndPos) + + self.TracerTime = 0.4 + + // Die when it reaches its target + self.DieTime = CurTime() + self.TracerTime + +end + +/*--------------------------------------------------------- + THINK +---------------------------------------------------------*/ +function EFFECT:Think() + + if (CurTime() > self.DieTime) then return false end + + return true +end + +/*--------------------------------------------------------- + Draw the effect +---------------------------------------------------------*/ +function EFFECT:Render() + + local fDelta = (self.DieTime - CurTime()) / self.TracerTime + fDelta = math.Clamp(fDelta, 0, 1) + + render.SetMaterial(self.Mat) + + local sinWave = math.sin(fDelta * math.pi) + + local color = Color(255, 255, 255, 255 * fDelta) + + render.DrawBeam(self.StartPos, self.EndPos, 8 * fDelta, 1, 0, color) +end
\ No newline at end of file diff --git a/ftp_gmstranded/entities/effects/m9k_effect_mad_ricochet_trace/init.lua b/ftp_gmstranded/entities/effects/m9k_effect_mad_ricochet_trace/init.lua new file mode 100644 index 0000000..1a9ebaf --- /dev/null +++ b/ftp_gmstranded/entities/effects/m9k_effect_mad_ricochet_trace/init.lua @@ -0,0 +1,100 @@ +EFFECT.Mat = Material("effects/yellowflare") + +/*--------------------------------------------------------- + EFFECT:Init(data) +---------------------------------------------------------*/ +function EFFECT:Init(data) + + self.StartPos = data:GetStart() + self.EndPos = data:GetOrigin() + self.Dir = self.EndPos - self.StartPos + self.Entity:SetRenderBoundsWS(self.StartPos, self.EndPos) + + self.TracerTime = 0.4 + + // Die when it reaches its target + self.DieTime = CurTime() + self.TracerTime + + // Play ricochet sound with random pitch + + local vGrav = Vector(0, 0, -450) + local Dir = self.Dir:GetNormalized() + + local emitter = ParticleEmitter(self.StartPos) + + for i = 1, 10 do + + local particle = emitter:Add("effects/yellowflare", self.StartPos) + + particle:SetVelocity((Dir + VectorRand() * 0.5) * math.Rand(50, 150)) + particle:SetDieTime(math.Rand(0.5, 2)) + particle:SetStartAlpha(255) + particle:SetStartSize(math.Rand(2, 4)) + particle:SetEndSize(0) + particle:SetRoll(0) + particle:SetGravity(vGrav * 0.4) + particle:SetCollide(true) + particle:SetBounce(0.8) + particle:SetAirResistance(50) + particle:SetStartLength(0.2) + particle:SetEndLength(0) + particle:SetVelocityScale(true) + particle:SetCollide(true) + end + + local particle = emitter:Add("effects/yellowflare", self.StartPos) + + particle:SetDieTime(0.1) + particle:SetStartAlpha(255) + particle:SetStartSize(128) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + + local particle = emitter:Add("effects/yellowflare", self.StartPos) + + particle:SetDieTime(0.4) + particle:SetStartAlpha(255) + particle:SetStartSize(32) + particle:SetEndSize(0) + particle:SetRoll(math.Rand(0, 360)) + + emitter:Finish() + + local dlight = DynamicLight(0) + if (dlight) then + dlight.Pos = self.StartPos + dlight.r = 255 + dlight.g = 255 + dlight.b = 255 + dlight.Brightness = 4 + dlight.size = 64 + dlight.DieTime = CurTime() + 0.1 + end +end + +/*--------------------------------------------------------- + THINK +---------------------------------------------------------*/ +function EFFECT:Think() + + if (CurTime() > self.DieTime) then return false end + + return true +end + +/*--------------------------------------------------------- + Draw the effect +---------------------------------------------------------*/ +function EFFECT:Render() + + local fDelta = (self.DieTime - CurTime()) / self.TracerTime + fDelta = math.Clamp(fDelta, 0, 1) + + render.SetMaterial(self.Mat) + + local sinWave = math.sin(fDelta * math.pi) + + local color = Color(255, 255, 255, 255 * fDelta) + + render.DrawBeam(self.StartPos, self.EndPos, 8 * fDelta, 0.5, 0.5, color) +end
\ No newline at end of file diff --git a/ftp_gmstranded/entities/effects/m9k_rg_muzzle_rifle/init.lua b/ftp_gmstranded/entities/effects/m9k_rg_muzzle_rifle/init.lua new file mode 100644 index 0000000..2b9b210 --- /dev/null +++ b/ftp_gmstranded/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 |
