summaryrefslogtreecommitdiff
path: root/entities/effects
diff options
context:
space:
mode:
authorAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
committerAlexander Pickering <Alexander.Pickering@anondomain.site90.net>2016-04-16 02:02:00 -0400
commit7e5db609550cca0d8b8a76c4bf78ba4658962167 (patch)
tree4df54e0c4eccff0b022e0732c258b7b193fd6cfe /entities/effects
downloadgmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.gz
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.tar.bz2
gmstranded-7e5db609550cca0d8b8a76c4bf78ba4658962167.zip
Initial commit
Diffstat (limited to 'entities/effects')
-rw-r--r--entities/effects/gms_loot_effect.lua41
-rw-r--r--entities/effects/m9k_effect_mad_penetration_trace/init.lua45
-rw-r--r--entities/effects/m9k_effect_mad_ricochet_trace/init.lua100
-rw-r--r--entities/effects/m9k_rg_muzzle_rifle/init.lua117
4 files changed, 303 insertions, 0 deletions
diff --git a/entities/effects/gms_loot_effect.lua b/entities/effects/gms_loot_effect.lua
new file mode 100644
index 0000000..0b8d1ef
--- /dev/null
+++ b/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/entities/effects/m9k_effect_mad_penetration_trace/init.lua b/entities/effects/m9k_effect_mad_penetration_trace/init.lua
new file mode 100644
index 0000000..24a23e8
--- /dev/null
+++ b/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/entities/effects/m9k_effect_mad_ricochet_trace/init.lua b/entities/effects/m9k_effect_mad_ricochet_trace/init.lua
new file mode 100644
index 0000000..1a9ebaf
--- /dev/null
+++ b/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/entities/effects/m9k_rg_muzzle_rifle/init.lua b/entities/effects/m9k_rg_muzzle_rifle/init.lua
new file mode 100644
index 0000000..2b9b210
--- /dev/null
+++ b/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