add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
EFFECT.FireMat = Material( "effects/fire_cloud1" )
EFFECT.HeatMat = Material( "sprites/heatwave" )
EFFECT.Smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
self.LifeTime = 0.4
self.DieTime = CurTime() + self.LifeTime
if not IsValid( Ent ) then return end
self.Ent = Ent
self.Pos = Ent:WorldToLocal( Pos + VectorRand() * 3 )
self.Seed = math.Rand( 0, 10000 )
self.Magnitude = data:GetMagnitude()
local emitter = Ent:GetParticleEmitter( self.Pos )
if not IsValid( emitter ) then return end
local VecCol = (render.GetLightColor( Pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
for i = 0, 20 do
local particle = emitter:Add( "sprites/rico1", Pos )
local vel = VectorRand() * 800
if particle then
particle:SetVelocity( Vector(0,0,500) + VectorRand() * 500 )
particle:SetDieTime( 0.25 * self.Magnitude )
particle:SetStartAlpha( 200 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 3 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 255, 255, 255 )
particle:SetAirResistance( 0 )
end
end
for i = 1, 8 do
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
Dir.z = -0.5
Dir:Normalize()
if particle then
particle:SetVelocity( Dir * 250 )
particle:SetDieTime( 0.5 + i * 0.01 )
particle:SetAirResistance( 125 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 20 )
particle:SetEndSize( 40 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
for i = 0,22 do
local particle = emitter:Add( "particles/flamelet"..math.random(1,5), Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
if particle then
particle:SetVelocity( Dir * math.Rand(600,900) * self.Magnitude )
particle:SetDieTime( math.Rand(0.2,0.3) * self.Magnitude )
particle:SetAirResistance( 400 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(20,25) )
particle:SetEndSize( math.Rand(5,10) )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 255, 200, 50 )
particle:SetGravity( Vector( 0, 0, 1000 ) )
particle:SetCollide( false )
end
end
for i = 1, 4 do
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
if particle then
particle:SetVelocity( Dir * 500 * self.Magnitude )
particle:SetDieTime( 0.5 + i * 0.01 )
particle:SetAirResistance( 125 )
particle:SetStartAlpha( 150 * self.Magnitude )
particle:SetStartSize( 40 * self.Magnitude )
particle:SetEndSize( 250 * self.Magnitude )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderFire()
end
function EFFECT:RenderFire()
local Scale = ((self.DieTime - CurTime()) / self.LifeTime) * (self.Magnitude or 0)
if Scale < 0 then return end
local Pos = self.Ent:LocalToWorld( self.Pos )
local scroll = -CurTime() * 10
local Up = Vector(0,0,0.92) + VectorRand() * 0.08
render.SetMaterial( self.FireMat )
render.StartBeam( 3 )
render.AddBeam( Pos, 64 * Scale, scroll, Color( 100, 100, 100, 100 ) )
render.AddBeam( Pos + Up * 120 * Scale, 64 * Scale, scroll + 1, Color( 255, 200, 50, 150 ) )
render.AddBeam( Pos + Up * 300 * Scale, 64 * Scale, scroll + 3, Color( 255, 191, 0, 0 ) )
render.EndBeam()
scroll = scroll * 0.5
render.UpdateRefractTexture()
render.SetMaterial( self.HeatMat )
render.StartBeam( 3 )
render.AddBeam( Pos, 64 * Scale, scroll, Color( 0, 0, 255, 200 ) )
render.AddBeam( Pos + Up * 64 * Scale, 64 * Scale, scroll + 2, color_white )
render.AddBeam( Pos + Up * 250 * Scale, 120 * Scale, scroll + 5, Color( 0, 0, 0, 0 ) )
render.EndBeam()
scroll = scroll * 1.3
render.SetMaterial( self.FireMat )
render.StartBeam( 3 )
render.AddBeam( Pos, 32 * Scale, scroll, Color( 100, 100, 100, 100 ) )
render.AddBeam( Pos + Up * 60 * Scale, 32 * Scale, scroll + 1, Color( 255, 200, 50, 150 ) )
render.AddBeam( Pos + Up * 300 * Scale, 32 * Scale, scroll + 3, Color( 255, 191, 0, 0 ) )
render.EndBeam()
end

View File

@@ -0,0 +1,110 @@
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
local scale = data:GetMagnitude()
sound.Play( "physics/flesh/flesh_strider_impact_bullet"..math.random(1,3)..".wav", pos, 85, math.random(180,200) + 55 * math.max(1 - scale,0), 0.75 )
sound.Play( "ambient/materials/rock"..math.random(1,5)..".wav", pos, 75, 180, 1 )
local emitter = ParticleEmitter( pos, false )
local VecCol = (render.GetLightColor( pos + dir ) * 0.5 + Vector(0.2,0.18,0.15)) * 255
local DieTime = math.Rand(0.8,1.6)
if dir.z > 0.85 then
for i = 1, 10 do
for n = 0,6 do
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ] , pos )
if not particle then continue end
particle:SetVelocity( (dir * 50 * i + VectorRand() * 25) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
end
end
for i = 1, 10 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if not particle then continue end
particle:SetVelocity( (dir * 50 * i + VectorRand() * 40) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
end
end
for i = 1,12 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if particle then
local ang = i * 30
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local Vel = Vector(X,Y,0) * math.Rand(200,1600) + Vector(0,0,50)
Vel:Rotate( dir:Angle() + Angle(90,0,0) )
particle:SetVelocity( Vel * scale )
particle:SetDieTime( DieTime )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 40 * scale )
particle:SetEndSize( 200 * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,60) * scale )
particle:SetCollide( true )
end
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,229 @@
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.SparkSurface = {
["chainlink"] = true,
["canister"] = true,
["metal_barrel"] = true,
["metalvehicle"] = true,
["metal"] = true,
["metalgrate"] = true,
["rubbertire"] = true,
}
EFFECT.DustSurface = {
["sand"] = true,
["dirt"] = true,
["grass"] = true,
["antlionsand"] = true,
}
EFFECT.SmokeSurface = {
["concrete"] = true,
["tile"] = true,
["plaster"] = true,
["boulder"] = true,
["plastic"] = true,
["default"] = true,
["glass"] = true,
["brick"] = true,
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local bullet_dir = data:GetStart()
local dir = data:GetNormal()
local magnitude = data:GetMagnitude()
local ent = data:GetEntity()
local surface = data:GetSurfaceProp()
local surfaceName = util.GetSurfacePropName( surface )
local emitter = ParticleEmitter( pos, false )
local VecCol = (render.GetLightColor( pos ) * 0.8 + Vector(0.17,0.15,0.1)) * 255
local DieTime = math.Rand(0.8,1.4)
for i = 1, 60 * magnitude do
local spark = emitter:Add("effects/spark", pos + dir * 8)
if not spark then continue end
spark:SetStartAlpha( 255 )
spark:SetEndAlpha( 0 )
spark:SetCollide( true )
spark:SetBounce( math.Rand(0,1) )
spark:SetColor( 255, 255, 255 )
spark:SetGravity( Vector(0,0,-600) )
spark:SetEndLength(0)
local size = math.Rand(4, 6) * magnitude
spark:SetEndSize( size )
spark:SetStartSize( size )
spark:SetStartLength( math.Rand(20,40) * magnitude )
spark:SetDieTime( math.Rand(0.4, 1.2) )
spark:SetVelocity( (dir * math.Rand(300, 600) + VectorRand() * 300) * magnitude )
end
local flash = emitter:Add( "effects/yellowflare",pos )
if flash then
flash:SetPos( pos + dir * 15 )
flash:SetStartAlpha( 200 )
flash:SetEndAlpha( 0 )
flash:SetColor( 255,255,255 )
flash:SetEndSize( 0 )
flash:SetDieTime( 0.075 )
flash:SetStartSize( 300 * magnitude ^ 2 )
end
if self.SparkSurface[ surfaceName ] then
if IsValid( ent ) and ent.LVS then
if (90 - math.deg( math.acos( math.Clamp( -dir:Dot( bullet_dir ) ,-1,1) ) )) > 10 then
local effectdata = EffectData()
effectdata:SetOrigin( pos )
util.Effect( "cball_explode", effectdata, true, true )
local Ax = math.acos( math.Clamp( dir:Dot( bullet_dir ) ,-1,1) )
local Fx = math.cos( Ax )
local effectdata = EffectData()
effectdata:SetOrigin( pos )
effectdata:SetNormal( (bullet_dir - dir * Fx * 2):GetNormalized() * 0.75 )
util.Effect( "manhacksparks", effectdata, true, true )
local effectdata = EffectData()
effectdata:SetOrigin( pos )
effectdata:SetNormal( -bullet_dir * 0.75 )
util.Effect( "manhacksparks", effectdata, true, true )
end
else
local effectdata = EffectData()
effectdata:SetOrigin( pos )
util.Effect( "cball_explode", effectdata, true, true )
local effectdata = EffectData()
effectdata:SetOrigin( pos )
effectdata:SetNormal( dir )
util.Effect( "manhacksparks", effectdata, true, true )
local effectdata = EffectData()
effectdata:SetOrigin( pos )
effectdata:SetNormal( -bullet_dir )
util.Effect( "manhacksparks", effectdata, true, true )
end
end
if self.SmokeSurface[ surfaceName ] then
for i = 1, 24 do
local particle = emitter:Add( self.SmokeMat[ math.random(1, #self.SmokeMat ) ], pos )
if not particle then continue end
particle:SetStartAlpha( math.Rand(33, 66) )
particle:SetEndAlpha( 0 )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-math.Rand(33, 66)) )
particle:SetRollDelta( math.random(0, 0.5 * math.pi) )
particle:SetAirResistance( 175 )
particle:SetStartSize( 15 )
particle:SetDieTime( math.Rand(0.5, 1) )
particle:SetEndSize( math.Rand(45, 90) )
particle:SetVelocity( dir * math.Rand(40, 200) + VectorRand() * 150)
end
for i = 1,15 do
local particle = emitter:Add("effects/fleck_cement" .. math.random(1, 2), pos + dir * 8)
if not particle then continue end
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetCollide( true )
particle:SetBounce( math.Rand(0,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity(Vector(0,0,-600))
particle:SetRollDelta( math.random(0, 0.5*math.pi) )
particle:SetEndSize( 2 )
particle:SetStartSize( 2 )
particle:SetDieTime( math.Rand(1, 2) )
particle:SetVelocity( dir * math.Rand(40, 200) + VectorRand() * 500 )
end
end
if not self.DustSurface[ surfaceName ] then return end
for i = 1, 10 do
for i = 1, 15 do
local particle = emitter:Add( self.SmokeMat[ math.random(1, #self.SmokeMat ) ], pos )
if not particle then continue end
particle:SetStartAlpha( math.Rand(40, 80) )
particle:SetEndAlpha(0)
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-math.Rand(75, 150)) )
particle:SetRollDelta( math.random(0, 0.5*math.pi) )
particle:SetAirResistance( 175 )
particle:SetStartSize( 5 )
particle:SetDieTime( math.Rand(0.5, 1) )
particle:SetEndSize( math.Rand(15, 30) )
particle:SetVelocity( (dir * math.Rand(80, 400) + VectorRand() * 100) * 1.5 )
end
for n = 0,6 do
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ] , pos )
if not particle then continue end
particle:SetVelocity( (dir * 50 * i + VectorRand() * 50) )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 5 )
particle:SetEndSize( 10 * i )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) )
particle:SetCollide( false )
end
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,277 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
EFFECT.DecalMat = Material( util.DecalMaterial( "Scorch" ) )
function EFFECT:Init( data )
self.Dir = data:GetNormal()
self.Pos = data:GetOrigin()
self.LifeTime = 0.35
self.DieTime = CurTime() + self.LifeTime
local scale = data:GetMagnitude() * 0.5
self.Scale = 3 * scale
local emitter = ParticleEmitter( self.Pos, false )
local VecCol = (render.GetLightColor( self.Pos + self.Dir ) * 0.5 + Vector(0.1,0.09,0.075)) * 255
local DieTime = math.Rand(0.8,1.6)
local traceSky = util.TraceLine( {
start = self.Pos,
endpos = self.Pos + Vector(0,0,50000),
filter = self,
} )
local traceWater = util.TraceLine( {
start = traceSky.HitPos,
endpos = self.Pos - Vector(0,0,100),
filter = self,
mask = MASK_WATER,
} )
if traceWater.Hit then
local effectdata = EffectData()
effectdata:SetOrigin( traceWater.HitPos )
effectdata:SetScale( 100 )
effectdata:SetFlags( 2 )
util.Effect( "WaterSplash", effectdata, true, true )
end
local Pos = self.Pos
local Dist = (traceWater.HitPos - Pos):Length()
local ply = LocalPlayer():GetViewEntity()
if not IsValid( ply ) then return end
local delay = (Pos - ply:GetPos()):Length() / 13503.9
if traceWater.Hit and Dist > 150 then
timer.Simple( delay, function()
local effectdata = EffectData()
effectdata:SetOrigin( Pos )
util.Effect( "WaterSurfaceExplosion", effectdata, true, true )
end )
if Dist > 300 then return end
else
timer.Simple( delay, function()
sound.Play( "LVS.BULLET_EXPLOSION", Pos )
sound.Play( "LVS.BULLET_EXPLOSION_DYNAMIC", Pos )
end )
local trace = util.TraceLine( {
start = self.Pos + Vector(0,0,100),
endpos = self.Pos - Vector(0,0,100),
mask = MASK_SOLID_BRUSHONLY,
} )
if trace.Hit and not trace.HitNonWorld then
util.DecalEx( self.DecalMat, trace.Entity, trace.HitPos + trace.HitNormal, trace.HitNormal, Color(255,255,255,255), self.Scale * 2.5, self.Scale * 2.5 )
end
end
if self.Dir.z > 0.8 then
for i = 1, 10 do
for n = 0,6 do
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ], self.Pos )
if not particle then continue end
particle:SetVelocity( (self.Dir * 50 * i + VectorRand() * 25) * self.Scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * self.Scale )
particle:SetEndSize( 20 * i * self.Scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) * self.Scale )
particle:SetCollide( false )
end
end
for i = 1, 10 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ], self.Pos )
if not particle then continue end
particle:SetVelocity( (self.Dir * 50 * i + VectorRand() * 40) * self.Scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * self.Scale )
particle:SetEndSize( 20 * i * self.Scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) * self.Scale )
particle:SetCollide( false )
end
end
for i = 1,24 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , self.Pos )
if not particle then continue end
local ang = i * 15
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local Vel = Vector(X,Y,0) * math.Rand(800,1200)
Vel:Rotate( self.Dir:Angle() + Angle(90,0,0) )
particle:SetVelocity( Vel * self.Scale )
particle:SetDieTime( math.Rand(1,3) )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 40 * self.Scale )
particle:SetEndSize( 140 * self.Scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,60) * self.Scale )
particle:SetCollide( true )
end
for i = 0, 15 do
local particle = emitter:Add( self.SmokeMat[ math.random(1, #self.SmokeMat ) ], self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 1000 * scale )
particle:SetDieTime( math.Rand(2,3) )
particle:SetAirResistance( 200 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 200 * scale )
particle:SetEndSize( 600 * scale )
particle:SetRoll( math.Rand(-1,1) )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector( 0, 0, -600 ) * scale )
particle:SetCollide( false )
end
end
for i = 0, 20 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 800 * scale )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 120 * scale )
particle:SetEndSize( 20 * scale )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( self.Dir * 2500 )
particle:SetRollDelta( math.Rand(-5,5) )
particle:SetAirResistance( 300 )
end
for i = 0, 5 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if not particle then continue end
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,0) )
local size = math.Rand(8, 24) * scale
particle:SetEndSize( size )
particle:SetStartSize( size )
particle:SetStartLength( 400 * scale )
particle:SetEndLength( size )
particle:SetDieTime( math.Rand(0.1,0.2) )
particle:SetVelocity( (self.Dir * 4000 + VectorRand() * 2000) * scale )
particle:SetAirResistance( 0 )
end
for i = 0, 40 do
local particle = emitter:Add( "effects/fire_embers"..math.random(1,2), self.Pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 800 * scale )
particle:SetDieTime( math.Rand(0.4,0.6) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 40 * scale )
particle:SetEndSize( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,600) )
particle:SetRollDelta( math.Rand(-8,8) )
particle:SetAirResistance( 300 )
end
emitter:Finish()
end
function EFFECT:Explosion( pos , scale )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
for i = 0, 40 do
local particle = emitter:Add( "particles/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( VectorRand() * 1500 * scale )
particle:SetDieTime( 0.2 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 20 * scale )
particle:SetEndSize( math.Rand(180,240) * scale )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
if not self.Scale then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local R1 = 800 * self.Scale
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos, R1 * Scale, R1 * Scale, Color( 255, 200, 150, 255) )
end

View File

@@ -0,0 +1,57 @@
EFFECT.Smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
local emitter = Ent:GetParticleEmitter( Ent:WorldToLocal( Pos ) )
if not IsValid( emitter ) then return end
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local rCol = math.random(30,60)
local Scale = math.Rand(1,8)
if not particle then return end
particle:SetVelocity( Vector(0,0,80) + VectorRand() * 80 )
particle:SetDieTime( Scale )
particle:SetAirResistance( 200 )
particle:SetStartAlpha( 100 / Scale )
particle:SetStartSize( 20 )
particle:SetEndSize( math.random(15,30) * Scale )
particle:SetRoll( math.pi / Scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( rCol, rCol, rCol )
particle:SetGravity( Vector( 0, 0, math.random(-40,80) ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,130 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.FireMat = {
[1] = Material( "effects/lvs_base/flamelet1" ),
[2] = Material( "effects/lvs_base/flamelet2" ),
[3] = Material( "effects/lvs_base/flamelet3" ),
[4] = Material( "effects/lvs_base/flamelet4" ),
[5] = Material( "effects/lvs_base/flamelet5" ),
[6] = Material( "effects/lvs_base/fire" ),
}
EFFECT.SmokeMat = {
[1] = Material( "particle/smokesprites_0001" ),
[2] = Material( "particle/smokesprites_0002" ),
[3] = Material( "particle/smokesprites_0003" ),
[4] = Material( "particle/smokesprites_0004" ),
[5] = Material( "particle/smokesprites_0005" ),
[6] = Material( "particle/smokesprites_0006" ),
[7] = Material( "particle/smokesprites_0007" ),
[8] = Material( "particle/smokesprites_0008" ),
[9] = Material( "particle/smokesprites_0009" ),
[10] = Material( "particle/smokesprites_0010" ),
[11] = Material( "particle/smokesprites_0011" ),
[12] = Material( "particle/smokesprites_0012" ),
[13] = Material( "particle/smokesprites_0013" ),
[14] = Material( "particle/smokesprites_0014" ),
[15] = Material( "particle/smokesprites_0015" ),
[16] = Material( "particle/smokesprites_0016" ),
}
EFFECT.Smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
self.LifeTime = 1
self.DieTime = CurTime() + self.LifeTime
if not IsValid( Ent ) then return end
local randomPos = VectorRand() * 15
randomPos.z = 0
self.Ent = Ent
self.Pos = Ent:WorldToLocal( Pos + randomPos )
self.RandomSize = math.Rand( 0.8, 1.6 )
self.Vel = self.Ent:GetVelocity()
local emitter = Ent:GetParticleEmitter( self.Pos )
if not IsValid( emitter ) then return end
for i = 1, 8 do
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
Dir.z = -0.5
Dir:Normalize()
if particle then
particle:SetVelocity( Dir * 250 )
particle:SetDieTime( 0.5 + i * 0.01 )
particle:SetAirResistance( 125 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 20 )
particle:SetEndSize( 40 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderFire()
end
function EFFECT:RenderFire()
local Scale = (self.DieTime - 0.4 - CurTime()) / 0.6
if Scale < 0 then return end
local Pos = self.Ent:LocalToWorld( self.Pos )
local InvScale = 1 - Scale
render.SetMaterial( self.GlowMat )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 10), 100 * InvScale, 100 * InvScale, Color( 255, 150, 75, 255) )
local Num = #self.FireMat - math.Clamp(math.ceil( Scale * #self.FireMat ) - 1,0, #self.FireMat - 1)
local Size = (5 + 20 * Scale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.025
render.SetMaterial( self.FireMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 30) - Offset, Size, Size, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,71 @@
EFFECT.SmokeMat = {
[1] = Material( "particle/smokesprites_0001" ),
[2] = Material( "particle/smokesprites_0002" ),
[3] = Material( "particle/smokesprites_0003" ),
[4] = Material( "particle/smokesprites_0004" ),
[5] = Material( "particle/smokesprites_0005" ),
[6] = Material( "particle/smokesprites_0006" ),
[7] = Material( "particle/smokesprites_0007" ),
[8] = Material( "particle/smokesprites_0008" ),
[9] = Material( "particle/smokesprites_0009" ),
[10] = Material( "particle/smokesprites_0010" ),
[11] = Material( "particle/smokesprites_0011" ),
[12] = Material( "particle/smokesprites_0012" ),
[13] = Material( "particle/smokesprites_0013" ),
[14] = Material( "particle/smokesprites_0014" ),
[15] = Material( "particle/smokesprites_0015" ),
[16] = Material( "particle/smokesprites_0016" ),
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
local Mag = data:GetMagnitude()
self.LifeTime = 0.5 + Mag * 0.5
self.DieTime = CurTime() + self.LifeTime
if not IsValid( Ent ) then return end
self.Mag = Mag
self.Ent = Ent
self.Pos = Ent:WorldToLocal( Pos + VectorRand() * 15 )
self.RandomSize = math.Rand( 0.8, 1.6 )
self.Vel = self.Ent:GetVelocity()
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderSmoke()
end
function EFFECT:RenderSmoke()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local Pos = self.Ent:LocalToWorld( self.Pos )
local InvScale = 1 - Scale
local Num = #self.SmokeMat - math.Clamp(math.ceil( Scale * #self.SmokeMat ) - 1,0, #self.SmokeMat - 1)
local A = (50 + 100 * (1 - self.Mag)) * Scale
local C = (20 + 30 * self.RandomSize * self.Mag)
local Size = (25 + 30 * InvScale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.15
render.SetMaterial( self.SmokeMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * (20 + self.Vel:Length() / 25) * self.RandomSize) - Offset, Size, Size, Color( C, C, C, A ) )
end

View File

@@ -0,0 +1,127 @@
EFFECT.SmokeMat = {
[1] = Material( "particle/smokesprites_0001" ),
[2] = Material( "particle/smokesprites_0002" ),
[3] = Material( "particle/smokesprites_0003" ),
[4] = Material( "particle/smokesprites_0004" ),
[5] = Material( "particle/smokesprites_0005" ),
[6] = Material( "particle/smokesprites_0006" ),
[7] = Material( "particle/smokesprites_0007" ),
[8] = Material( "particle/smokesprites_0008" ),
[9] = Material( "particle/smokesprites_0009" ),
[10] = Material( "particle/smokesprites_0010" ),
[11] = Material( "particle/smokesprites_0011" ),
[12] = Material( "particle/smokesprites_0012" ),
[13] = Material( "particle/smokesprites_0013" ),
[14] = Material( "particle/smokesprites_0014" ),
[15] = Material( "particle/smokesprites_0015" ),
[16] = Material( "particle/smokesprites_0016" ),
}
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.FireMat = Material( "effects/muzzleflash2" )
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Ang = data:GetAngles()
self.Ent = data:GetEntity()
self.LifeTime = 0.5
self.DieTime = CurTime() + self.LifeTime
if not IsValid( self.Ent ) then return end
self.Mat = self.SmokeMat[ math.random(1,#self.SmokeMat) ]
local Pos = self.Ent:LocalToWorld( self.Pos )
self:SetPos( Pos )
local dlight = DynamicLight( self.Ent:EntIndex() * math.random(1,4), true )
if dlight then
dlight.pos = Pos
dlight.r = 255
dlight.g = 180
dlight.b = 100
dlight.brightness = 1
dlight.Decay = 2000
dlight.Size = 300
dlight.DieTime = CurTime() + 0.2
end
sound.Play( "lvs/vehicles/generic/exhaust_backfire"..math.random(1,3)..".ogg", Pos, 75, 100, 1 )
local vel = self.Ent:GetVelocity()
local dir = self.Ent:LocalToWorldAngles( self.Ang ):Forward()
local emitter = ParticleEmitter( Pos, false )
if emitter then
for i = 0, 12 do
local particle = emitter:Add( "sprites/rico1", Pos )
if not particle then continue end
particle:SetVelocity( vel + dir * 100 + VectorRand() * 100 )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 0 )
particle:SetEndAlpha( 25 )
particle:SetStartSize( 1 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
particle:SetAirResistance( 0 )
particle:SetColor( 255, 225, 150 )
particle:SetGravity( Vector(0,0,-600) )
end
emitter:Finish()
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderSmoke()
end
function EFFECT:RenderSmoke()
if not self.Pos or not self.Ang then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local InvScale = 1 - Scale
local Pos = self.Ent:LocalToWorld( self.Pos )
local Ang = self.Ent:LocalToWorldAngles( self.Ang )
local FlameSize = 40 * Scale ^ 2
render.SetMaterial( self.FireMat )
for i = 1, 4 do
render.DrawSprite( Pos + Ang:Forward() * InvScale * 5 + VectorRand() * 2, FlameSize, FlameSize, Color( 255, 255, 255, 255 * InvScale) )
end
local GlowSize = 80 * Scale ^ 2
render.SetMaterial( self.GlowMat )
render.DrawSprite( Pos + Ang:Forward() * InvScale * 10, GlowSize, GlowSize, Color(255* InvScale, 150* InvScale,75* InvScale,255* InvScale) )
if not self.Mat then return end
local C = 40
local Size = (20 + 50 * InvScale)
render.SetMaterial( self.Mat )
render.DrawSprite( Pos + Ang:Forward() * InvScale * 40, Size, Size, Color( C, C, C, 255 * Scale) )
end

View File

@@ -0,0 +1,105 @@
EFFECT.GlowMat = Material( "effects/yellowflare" )
EFFECT.FireMat = Material( "effects/muzzleflash2" )
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Ang = data:GetAngles()
self.Ent = data:GetEntity()
local volume = math.Clamp( data:GetMagnitude(), 0, 1 )
local T = CurTime()
self.LifeTime = 0.25
self.LifeTimePop = 0.1
self.DieTime = T + self.LifeTime
self.DieTimePop = T + self.LifeTimePop
self.Scale = math.Rand( 0.25, 1 )
if not IsValid( self.Ent ) then return end
local Pos = self.Ent:LocalToWorld( self.Pos )
self:SetPos( Pos )
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local veh = ply:lvsGetVehicle()
if IsValid( veh ) and veh == self.Ent then
local pod = ply:GetVehicle()
if IsValid( pod ) and not pod:GetThirdPersonMode() then
sound.Play( "lvs/vehicles/generic/exhaust_pop_interior"..math.random(1,12)..".ogg", Pos, 75, math.random(98,105), volume )
return
end
end
local dlight = DynamicLight( self.Ent:EntIndex() * math.random(1,4), true )
if dlight then
dlight.pos = Pos
dlight.r = 255
dlight.g = 180
dlight.b = 100
dlight.brightness = 1
dlight.Decay = 2000
dlight.Size = 400
dlight.DieTime = CurTime() + 0.2
end
sound.Play( "lvs/vehicles/generic/exhaust_pop"..math.random(1,16)..".ogg", Pos, 75, math.random(98,105), volume )
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderSmoke()
end
function EFFECT:RenderSmoke()
if not self.Pos or not self.Ang or not self.Scale then return end
local T = CurTime()
local ScalePop = math.Clamp( (self.DieTimePop - T) / self.LifeTimePop, 0, 1 )
local InvScalePop = 1 - ScalePop
local Scale = (self.DieTime - T) / self.LifeTime
local InvScale = 1 - Scale
local Pos = self.Ent:LocalToWorld( self.Pos )
local Ang = self.Ent:LocalToWorldAngles( self.Ang )
local FlameSize = 5 * Scale ^ 2
render.SetMaterial( self.FireMat )
for i = 1, 12 do
render.DrawSprite( Pos + Ang:Forward() * InvScale * 20 + VectorRand() * 2, FlameSize, FlameSize, color_white )
end
if InvScalePop <= 0 then return end
local GlowSize = 60 * InvScalePop * self.Scale
local A255 = 255 * ScalePop
render.SetMaterial( self.GlowMat )
render.DrawSprite( Pos, GlowSize, GlowSize, Color(A255,A255,A255,A255) )
end

View File

@@ -0,0 +1,145 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.FireMat = {
[1] = Material( "effects/lvs_base/flamelet1" ),
[2] = Material( "effects/lvs_base/flamelet2" ),
[3] = Material( "effects/lvs_base/flamelet3" ),
[4] = Material( "effects/lvs_base/flamelet4" ),
[5] = Material( "effects/lvs_base/flamelet5" ),
[6] = Material( "effects/lvs_base/fire" ),
}
EFFECT.SmokeMat = {
[1] = Material( "particle/smokesprites_0001" ),
[2] = Material( "particle/smokesprites_0002" ),
[3] = Material( "particle/smokesprites_0003" ),
[4] = Material( "particle/smokesprites_0004" ),
[5] = Material( "particle/smokesprites_0005" ),
[6] = Material( "particle/smokesprites_0006" ),
[7] = Material( "particle/smokesprites_0007" ),
[8] = Material( "particle/smokesprites_0008" ),
[9] = Material( "particle/smokesprites_0009" ),
[10] = Material( "particle/smokesprites_0010" ),
[11] = Material( "particle/smokesprites_0011" ),
[12] = Material( "particle/smokesprites_0012" ),
[13] = Material( "particle/smokesprites_0013" ),
[14] = Material( "particle/smokesprites_0014" ),
[15] = Material( "particle/smokesprites_0015" ),
[16] = Material( "particle/smokesprites_0016" ),
}
EFFECT.Smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
self.LifeTime = 1
self.DieTime = CurTime() + self.LifeTime
if not IsValid( Ent ) then return end
self.Ent = Ent
self.Pos = Ent:WorldToLocal( Pos + VectorRand() * 20 )
self.RandomSize = math.Rand( 1, 2 )
self.Vel = self.Ent:GetVelocity()
local emitter = Ent:GetParticleEmitter( self.Pos )
if not IsValid( emitter ) then return end
for i = 1, 8 do
local particle = emitter:Add( self.Smoke[ math.random(1, #self.Smoke ) ], Pos )
local Dir = Angle(0,math.Rand(-180,180),0):Forward()
Dir.z = -0.5
Dir:Normalize()
if particle then
particle:SetVelocity( Dir * 250 )
particle:SetDieTime( 0.5 + i * 0.01 )
particle:SetAirResistance( 125 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 20 )
particle:SetEndSize( 40 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) * 3 )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then return false end
if self.DieTime < CurTime() then return false end
self:SetPos( self.Ent:LocalToWorld( self.Pos ) )
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.Pos then return end
self:RenderSmoke()
self:RenderFire()
end
function EFFECT:RenderSmoke()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local Pos = self.Ent:LocalToWorld( self.Pos ) + Vector(0,0,25)
local InvScale = 1 - Scale
local Num = #self.SmokeMat - math.Clamp(math.ceil( Scale * #self.SmokeMat ) - 1,0, #self.SmokeMat - 1)
local C = 10 + 10 * self.RandomSize
local Size = (25 + 30 * InvScale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.5
render.SetMaterial( self.SmokeMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 80 * self.RandomSize) - Offset, Size, Size, Color( C, C, C, 200 * Scale) )
end
function EFFECT:RenderFire()
local Scale = (self.DieTime - 0.4 - CurTime()) / 0.6
if Scale < 0 then return end
local Pos = self.Ent:LocalToWorld( self.Pos )
local InvScale = 1 - Scale
render.SetMaterial( self.GlowMat )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 10), 100 * InvScale, 100 * InvScale, Color( 255, 150, 75, 255) )
local Num = #self.FireMat - math.Clamp(math.ceil( Scale * #self.FireMat ) - 1,0, #self.FireMat - 1)
local Size = (10 + 20 * Scale) * self.RandomSize
local Offset = (self.Vel * InvScale ^ 2) * 0.025
render.SetMaterial( self.FireMat[ Num ] )
render.DrawSprite( Pos + Vector(0,0,InvScale ^ 2 * 25) - Offset, Size, Size, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,119 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.LifeTime = 0.4
self.DieTime = CurTime() + self.LifeTime
local emitter = ParticleEmitter( self.Pos, false )
if not IsValid( emitter ) then return end
for i = 0,30 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 800 )
particle:SetDieTime( math.Rand(4,6) )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 100 )
particle:SetStartSize( math.Rand(30,60) )
particle:SetEndSize( math.Rand(100,150) )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 50,50,50 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
for i = 0, 20 do
local particle = emitter:Add( "sprites/light_glow02_add", self.Pos )
local vel = VectorRand() * 400
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.4,0.8) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(24,48) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 255, 40, 100 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
end
end
for i = 0, 40 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( 0.14 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 )
particle:SetEndSize( math.Rand(30,60) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
emitter:Finish()
local Pos = self.Pos
local ply = LocalPlayer():GetViewEntity()
if IsValid( ply ) then
local delay = (Pos - ply:GetPos()):Length() / 13503.9
if delay <= 0.11 then
sound.Play( "ambient/explosions/explode_9.wav", Pos, 85, 100, 1 - delay * 8 )
end
timer.Simple( delay, function()
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end )
else
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( GlowMat )
render.DrawSprite( self.Pos, 400 * Scale, 400 * Scale, Color( 255, 40, 100, 255) )
render.DrawSprite( self.Pos, 100 * Scale, 100 * Scale, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,124 @@
EFFECT.Offset = Vector(-8,0,0)
local GlowMat = Material( "effects/select_ring" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.OldPos = self.Entity:LocalToWorld( self.Offset )
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.OldPos ), false )
end
end
function EFFECT:doFX( pos )
if not IsValid( self.Entity ) then return end
if IsValid( self.Emitter ) then
local emitter = self.Emitter
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if particle then
particle:SetGravity( Vector(0,0,100) + VectorRand() * 50 )
particle:SetVelocity( -self.Entity:GetForward() * 200 )
particle:SetAirResistance( 600 )
particle:SetDieTime( math.Rand(2,3) )
particle:SetStartAlpha( 100 )
particle:SetStartSize( math.Rand(5,6) )
particle:SetEndSize( math.Rand(12,30) )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 50,50,50 )
particle:SetCollide( false )
end
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * math.Rand(250,800) + self.Entity:GetVelocity())
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(10,15) )
particle:SetEndSize( 5 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 150,50,100 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Entity:GetPos() )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * 200 + VectorRand() * 50 )
particle:SetDieTime( 0.25 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(6,10) )
particle:SetEndSize( math.Rand(2,3) )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,100,200 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if IsValid( self.Entity ) then
self.nextDFX = self.nextDFX or 0
if self.nextDFX < CurTime() then
self.nextDFX = CurTime() + 0.02
local oldpos = self.OldPos
local newpos = self.Entity:LocalToWorld( self.Offset )
self:SetPos( newpos )
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.OldPos = newpos
for i = 0, Len, 45 do
local pos = oldpos + Dir * i
self:doFX( pos )
end
end
return true
end
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
local pos = ent:LocalToWorld( self.Offset )
render.SetMaterial( GlowMat )
render.DrawSprite( pos, 100, 100, Color( 255, 40, 100, 50 ) )
end

View File

@@ -0,0 +1,182 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
local scale = data:GetMagnitude()
self.LifeTime = 0.35
self.DieTime = CurTime() + self.LifeTime
self.Pos = pos
self.Scale = scale
sound.Play( "weapons/shotgun/shotgun_fire6.wav", pos, 75, 150, 1 )
local VecCol = (render.GetLightColor( pos + dir ) * 0.5 + Vector(0.2,0.18,0.15)) * 255
local emitter = ParticleEmitter( pos, false )
for i = 0,20 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 500 * scale )
particle:SetDieTime( math.Rand(0.4,0.6) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 40 * scale )
particle:SetEndSize( 200 * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,1200) )
particle:SetCollide( true )
end
for i = 1,12 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if not particle then continue end
local ang = i * 30
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local Vel = Vector(X,Y,0) * 1000
Vel:Rotate( dir:Angle() + Angle(90,0,0) )
particle:SetVelocity( Vel * scale )
particle:SetDieTime( math.Rand(0.6,0.8) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 30 * scale )
particle:SetEndSize( 60 * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,600) )
particle:SetCollide( true )
end
for i = 0, 15 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 400 * scale )
particle:SetDieTime( math.Rand(0.2,0.3) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 60 * scale )
particle:SetEndSize( 10 * scale )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( dir * 2500 )
particle:SetRollDelta( math.Rand(-5,5) )
particle:SetAirResistance( 300 )
end
for i = 0, 5 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos)
if not particle then continue end
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,0) )
local size = math.Rand(2, 12) * scale
particle:SetEndSize( size )
particle:SetStartSize( size )
particle:SetStartLength( 100 * scale )
particle:SetEndLength( size )
particle:SetDieTime( math.Rand(0.1,0.2) )
particle:SetVelocity( (dir * 2000 + VectorRand() * 1000) * scale )
particle:SetAirResistance( 0 )
end
for i = 0, 40 do
local particle = emitter:Add( "effects/fire_embers"..math.random(1,2), pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 400 * scale )
particle:SetDieTime( math.Rand(0.4,0.6) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 20 * scale )
particle:SetEndSize( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,600) )
particle:SetRollDelta( math.Rand(-8,8) )
particle:SetAirResistance( 300 )
end
if dir.z > 0.8 then
for i = 0,60 do
local particle = emitter:Add( "effects/fleck_cement"..math.random(1,2), pos )
local vel = dir * math.Rand(600,1000) + VectorRand() * 200
if not particle then continue end
particle:SetVelocity( vel * scale )
particle:SetDieTime( math.Rand(10,15) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
local size = math.Rand(2, 4) * scale
particle:SetEndSize( size )
particle:SetStartSize( size )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
particle:SetBounce( 0.3 )
end
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
if not self.Scale then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local R1 = 800 * self.Scale
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos, R1 * Scale, R1 * Scale, Color( 255, 200, 150, 255) )
end

View File

@@ -0,0 +1,56 @@
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local emitter = ParticleEmitter( pos, false )
if not emitter then return end
local VecCol = (render.GetLightColor( pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
for i = 0,2 do
local particle = emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 200 )
particle:SetDieTime( math.Rand(4,6) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 0 )
particle:SetEndSize( 650 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( VectorRand() * 600 )
particle:SetCollide( true )
particle:SetBounce( 1 )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,43 @@
function EFFECT:Init( data )
self.Ent = data:GetEntity()
self.Pos = data:GetOrigin()
local T = CurTime()
self.LifeTime = 1
self.DieTime = T + self.LifeTime
if IsValid( self.Ent ) then
self.Model = ClientsideModel( self.Ent:GetModel(), RENDERMODE_TRANSCOLOR )
self.Model:SetMaterial("models/alyx/emptool_glow")
self.Model:SetColor( Color(255,0,0,255) )
self.Model:SetParent( self.Ent, 0 )
self.Model:SetMoveType( MOVETYPE_NONE )
self.Model:SetLocalPos( Vector( 0, 0, 0 ) )
self.Model:SetLocalAngles( Angle( 0, 0, 0 ) )
self.Model:AddEffects( EF_BONEMERGE )
self.Model:SetModelScale( self.Ent:GetModelScale() )
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then
if IsValid( self.Model ) then
self.Model:Remove()
end
end
if self.DieTime < CurTime() then
if IsValid( self.Model ) then
self.Model:Remove()
end
return false
end
return true
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,53 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin() + VectorRand() * 25
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
local emitter = Ent:GetParticleEmitter( Pos )
if not IsValid( emitter ) then return end
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if particle then
particle:SetVelocity( VectorRand() * 100 )
particle:SetDieTime( 2 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 60 )
particle:SetEndSize( 200 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( 60, 60, 60 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,59 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Scale = data:GetMagnitude()
if not IsValid( Ent ) then return end
local Vel = Ent:GetVelocity()
local emitter = Ent:GetParticleEmitter( Pos )
if not IsValid( emitter ) then return end
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if not particle then return end
local Col = 100 - 60 * Scale
particle:SetVelocity( Vel + Dir * (100 + 50 * Scale) )
particle:SetDieTime( 0.4 - 0.3 * Scale )
particle:SetAirResistance( 400 )
particle:SetStartAlpha( 80 )
particle:SetStartSize( 2 )
particle:SetEndSize( 10 + 20 * Scale )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) * 2 )
particle:SetColor( Col, Col, Col )
particle:SetGravity( Vector( 0, 0, 10 ) )
particle:SetCollide( false )
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,52 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Scale = data:GetMagnitude()
if not IsValid( Ent ) then return end
local emitter = Ent:GetParticleEmitter( Pos )
if not IsValid( emitter ) then return end
local particle = emitter:Add( "effects/lvs_base/fire", Pos )
if particle then
particle:SetVelocity( Dir * 70 )
particle:SetDieTime( 0.2 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 + 18 * Scale )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
for i = 1, 3 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), Pos )
if particle then
particle:SetVelocity( Dir * 40 * i )
particle:SetDieTime( 0.2 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( (5 + 5 * Scale) - i )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,178 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DecalMat = Material( util.DecalMaterial( "Scorch" ) )
function EFFECT:Init( data )
local Pos = data:GetOrigin()
self.DieTime = CurTime() + 1
self:Explosion( Pos, 2 )
local ply = LocalPlayer():GetViewEntity()
if IsValid( ply ) then
local delay = (Pos - ply:GetPos()):Length() / 13503.9
timer.Simple( delay, function()
sound.Play( "LVS.DYNAMIC_EXPLOSION", Pos )
end )
else
sound.Play( "LVS.DYNAMIC_EXPLOSION", Pos )
end
for i = 1, 20 do
timer.Simple(math.Rand(0,0.01) * i, function()
if IsValid( self ) then
local p = Pos + VectorRand() * 10 * i
self:Explosion( p, math.Rand(0.5,0.8) )
end
end)
end
self:Debris( Pos )
local traceSky = util.TraceLine( {
start = Pos,
endpos = Pos + Vector(0,0,50000),
mask = MASK_SOLID_BRUSHONLY,
} )
local traceWater = util.TraceLine( {
start = traceSky.HitPos,
endpos = Pos - Vector(0,0,100),
mask = MASK_WATER,
} )
if traceWater.Hit then
local effectdata = EffectData()
effectdata:SetOrigin( traceWater.HitPos )
effectdata:SetScale( 100 )
effectdata:SetFlags( 2 )
util.Effect( "WaterSplash", effectdata, true, true )
else
local trace = util.TraceLine( {
start = Pos + Vector(0,0,100),
endpos = Pos - Vector(0,0,100),
mask = MASK_SOLID_BRUSHONLY,
} )
if trace.Hit and not trace.HitNonWorld then
for i = 1, 10 do
local StartPos = trace.HitPos + Vector(math.random(-25,25) * i,math.random(-25,25) * i,0)
local decalTrace = util.TraceLine( {
start = StartPos + Vector(0,0,100),
endpos = StartPos - Vector(0,0,100),
mask = MASK_SOLID_BRUSHONLY,
} )
util.DecalEx( self.DecalMat, trace.Entity, decalTrace.HitPos + decalTrace.HitNormal, decalTrace.HitNormal, Color(255,255,255,255), math.Rand(2,3), math.Rand(2,3) )
end
end
end
end
function EFFECT:Debris( pos )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
for i = 0,60 do
local particle = emitter:Add( "effects/fleck_tile"..math.random(1,2), pos )
local vel = VectorRand() * math.Rand(200,600)
vel.z = math.Rand(200,600)
if particle then
particle:SetVelocity( vel )
particle:SetDieTime( math.Rand(10,15) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 5 )
particle:SetEndSize( 5 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,0 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
particle:SetBounce( 0.3 )
end
end
emitter:Finish()
end
function EFFECT:Explosion( pos , scale )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
for i = 0,10 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if particle then
particle:SetVelocity( VectorRand() * 1500 * scale )
particle:SetDieTime( math.Rand(0.75,1.5) * scale )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(60,120) * scale )
particle:SetEndSize( math.Rand(220,320) * scale )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 40,40,40 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
for i = 0, 40 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( VectorRand() * 1500 * scale )
particle:SetDieTime( 0.2 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 20 * scale )
particle:SetEndSize( math.Rand(180,240) * scale )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
emitter:Finish()
local dlight = DynamicLight( math.random(0,9999) )
if dlight then
dlight.pos = pos
dlight.r = 255
dlight.g = 180
dlight.b = 100
dlight.brightness = 8
dlight.Decay = 2000
dlight.Size = 300
dlight.DieTime = CurTime() + 1
end
end
function EFFECT:Think()
if CurTime() < self.DieTime then return true end
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,297 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
EFFECT.DecalMat = Material( util.DecalMaterial( "Scorch" ) )
function EFFECT:Init( data )
self.Dir = Vector(0,0,1)
self.Pos = data:GetOrigin()
self.LifeTime = 0.35
self.DieTime = CurTime() + self.LifeTime
local scale = 3
local emitter = ParticleEmitter( self.Pos, false )
local VecCol = (render.GetLightColor( self.Pos + self.Dir ) * 0.5 + Vector(0.1,0.09,0.075)) * 255
local DieTime = math.Rand(0.8,1.6)
local traceSky = util.TraceLine( {
start = self.Pos,
endpos = self.Pos + Vector(0,0,50000),
filter = self,
} )
local traceWater = util.TraceLine( {
start = traceSky.HitPos,
endpos = self.Pos - Vector(0,0,100),
filter = self,
mask = MASK_WATER,
} )
if traceWater.Hit then
local effectdata = EffectData()
effectdata:SetOrigin( traceWater.HitPos )
effectdata:SetScale( 100 )
effectdata:SetFlags( 2 )
util.Effect( "WaterSplash", effectdata, true, true )
else
local trace = util.TraceLine( {
start = self.Pos + Vector(0,0,100),
endpos = self.Pos - Vector(0,0,100),
} )
if trace.Hit and not trace.HitNonWorld then
for i = 1, 3 do
local StartPos = trace.HitPos + Vector(math.random(-200,200),math.random(-200,200),0)
local decalTrace = util.TraceLine( {
start = StartPos + Vector(0,0,100),
endpos = StartPos - Vector(0,0,100),
} )
util.DecalEx( self.DecalMat, trace.Entity, decalTrace.HitPos + decalTrace.HitNormal, decalTrace.HitNormal, Color(255,255,255,255), math.Rand(3,6), math.Rand(3,6) )
end
end
end
local Pos = self.Pos
local Dist = (traceWater.HitPos - Pos):Length()
local ply = LocalPlayer():GetViewEntity()
if not IsValid( ply ) then return end
local delay = (Pos - ply:GetPos()):Length() / 13503.9
if traceWater.Hit and Dist > 150 then
timer.Simple( delay, function()
local effectdata = EffectData()
effectdata:SetOrigin( Pos )
util.Effect( "WaterSurfaceExplosion", effectdata, true, true )
end )
if Dist > 300 then return end
else
timer.Simple( delay, function()
sound.Play( "LVS.BOMB_EXPLOSION", Pos )
sound.Play( "LVS.BOMB_EXPLOSION_DYNAMIC", Pos )
end )
end
for i = 1, 10 do
for n = 0,6 do
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ], self.Pos )
if not particle then continue end
particle:SetVelocity( (self.Dir * 50 * i + VectorRand() * 25) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
end
end
for i = 1, 10 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ], self.Pos )
if not particle then continue end
particle:SetVelocity( (self.Dir * 50 * i + VectorRand() * 40) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
end
for i = 1,24 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , self.Pos )
if particle then
local ang = i * 15
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local Vel = Vector(X,Y,0) * math.Rand(1500,2000)
particle:SetVelocity( Vel * scale )
particle:SetDieTime( math.Rand(1,3) )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 40 * scale )
particle:SetEndSize( 200 * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector(0,0,60) * scale )
particle:SetCollide( true )
end
end
for i = 0, 15 do
local particle = emitter:Add( self.SmokeMat[ math.random(1, #self.SmokeMat ) ], self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 1000 )
particle:SetDieTime( math.Rand(2,3) )
particle:SetAirResistance( 200 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 200 )
particle:SetEndSize( 600 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
for i = 0, 15 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( math.Rand(0.15,0.3) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 25 )
particle:SetEndSize( math.Rand(70,100) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
for i = 0, 20 do
local particle = emitter:Add( "sprites/rico1", self.Pos )
local vel = VectorRand() * 800
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(20,40) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetAirResistance( 0 )
end
end
for i = 0,60 do
local particle = emitter:Add( "effects/fleck_tile"..math.random(1,2), self.Pos )
local vel = VectorRand() * math.Rand(800,1600)
vel.z = math.Rand(1000,4000)
if particle then
particle:SetVelocity( vel )
particle:SetDieTime( math.random(5,15) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 5 )
particle:SetEndSize( 5 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,0 )
particle:SetGravity( Vector( 0, 0, -2000 ) )
particle:SetCollide( true )
particle:SetBounce( 0.3 )
end
end
emitter:Finish()
end
function EFFECT:Explosion( pos , scale )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
for i = 0, 40 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( VectorRand() * 1500 * scale )
particle:SetDieTime( 0.2 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 20 * scale )
particle:SetEndSize( math.Rand(180,240) * scale )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
emitter:Finish()
local dlight = DynamicLight( math.random(0,9999) )
if dlight then
dlight.pos = pos
dlight.r = 255
dlight.g = 180
dlight.b = 100
dlight.brightness = 8
dlight.Decay = 2000
dlight.Size = 300
dlight.DieTime = CurTime() + 1
end
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos, 2000 * Scale, 2000 * Scale, Color( 255, 200, 150, 255) )
local Scale = (self.DieTime - self.LifeTime + 0.25 - CurTime()) / 0.25
local InvScale = 1 - Scale
if Scale > 0 then
render.SetColorMaterial()
render.DrawSphere( self.Pos, -450 * InvScale, 30,30, Color( 255, 200, 150, 150 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, -500 * InvScale, 30,30, Color( 255, 200, 150, 100 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, -550 * InvScale, 30,30, Color( 255, 200, 150, 25 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, 600 * InvScale, 30,30, Color( 255, 200, 150, 25 * (Scale ^ 2) ) )
end
end

View File

@@ -0,0 +1,92 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
self:Explosion( Pos, 2 )
local ply = LocalPlayer():GetViewEntity()
if IsValid( ply ) then
local delay = (Pos - ply:GetPos()):Length() / 13503.9
timer.Simple( delay, function()
sound.Play( "LVS.EXPLOSION", Pos )
end )
else
sound.Play( "LVS.EXPLOSION", Pos )
end
for i = 1, 20 do
timer.Simple(math.Rand(0,0.01) * i, function()
if not IsValid( self ) then return end
local p = Pos + VectorRand() * 10 * i
self:Explosion( p, math.Rand(0.5,0.8) )
end)
end
end
function EFFECT:Explosion( pos , scale )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
for i = 0,10 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 1000 * scale )
particle:SetDieTime( math.Rand(0.75,1.5) * scale )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(60,120) * scale )
particle:SetEndSize( math.Rand(160,280) * scale )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 40,40,40 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
for i = 0, 40 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 1000 * scale )
particle:SetDieTime( 0.14 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( math.Rand(60,120) * scale )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,112 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.LifeTime = 0.35
self.DieTime = CurTime() + self.LifeTime
local emitter = ParticleEmitter( self.Pos, false )
for i = 0, 15 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 1000 )
particle:SetDieTime( math.Rand(2,3) )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 200 )
particle:SetStartSize( 120 )
particle:SetEndSize( 300 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( 50,50,50 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
end
for i = 0, 15 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( math.Rand(0.15,0.3) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 25 )
particle:SetEndSize( math.Rand(70,100) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
for i = 0, 20 do
local particle = emitter:Add( "sprites/rico1", self.Pos )
local vel = VectorRand() * 800
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(20,40) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( 0 )
particle:SetColor( 255, 255, 255 )
particle:SetAirResistance( 0 )
end
end
emitter:Finish()
local Pos = self.Pos
local ply = LocalPlayer():GetViewEntity()
if IsValid( ply ) then
local delay = (Pos - ply:GetPos()):Length() / 13503.9
if delay <= 0.11 then
sound.Play( "ambient/explosions/explode_9.wav", Pos, 85, 100, 1 - delay * 8 )
end
timer.Simple( delay, function()
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end )
else
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( GlowMat )
render.DrawSprite( self.Pos, 2000 * Scale, 2000 * Scale, Color( 255, 200, 150, 255) )
end

View File

@@ -0,0 +1,111 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
self.Scale = data:GetScale()
self.DieTime = CurTime() + data:GetMagnitude()
self.Pos = data:GetStart()
if not IsValid( self.Entity ) then return end
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.Pos ), false )
end
function EFFECT:Think()
if IsValid( self.Entity ) then
local Pos = self.Entity:LocalToWorld( self.Pos )
local T = CurTime()
if (self.nextDFX or 0) < T then
self.nextDFX = T + 0.05
if self.Emitter then
local particle = self.Emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if particle then
particle:SetVelocity( VectorRand() * 100 * self.Scale )
particle:SetDieTime( 3 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 150 )
particle:SetStartSize( 150 * self.Scale )
particle:SetEndSize( math.Rand(200,300) * self.Scale )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor( 40,40,40 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
local particle = self.Emitter:Add( "effects/lvs_base/fire", Pos )
if particle then
particle:SetVelocity( VectorRand() * 100 * self.Scale )
particle:SetDieTime( math.random(40,80) / 100 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 130 * self.Scale )
particle:SetEndSize( math.Rand(50,100) * self.Scale )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 70 ) )
particle:SetCollide( false )
end
for i = 0,3 do
local particle = self.Emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), Pos + VectorRand() * 100 * self.Scale )
if particle then
particle:SetVelocity( VectorRand() * 100 * self.Scale )
particle:SetDieTime( math.random(30,60) / 100 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 70 * self.Scale )
particle:SetEndSize( math.Rand(25,80) * self.Scale )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 40 ) )
particle:SetCollide( false )
end
end
end
end
if self.DieTime < CurTime() then
if self.Emitter then
self.Emitter:Finish()
end
return false
end
return true
end
if self.Emitter then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,415 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local FireMat = Material( "effects/fire_cloud1" )
local HeatMat = Material( "sprites/heatwave" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if not IsValid( self.Entity ) then return end
local Pos = self:GetPos()
self._Particles = {}
self.Emitter = ParticleEmitter( Pos, false )
self.Emitter3D = ParticleEmitter( Pos, true )
self._LastParticlePos = vector_origin
end
function EFFECT:AddParticle( particle )
table.insert( self._Particles, particle )
for id, particle in pairs( self._Particles ) do
if not particle or particle:GetLifeTime() > particle:GetDieTime() then
self._Particles[ id ] = nil
end
end
end
function EFFECT:GetPosition()
local ent = self.Entity
if not IsValid( ent ) then return vector_origin, vector_origin end
local Pos = ent:GetPos()
local Dir = ent:GetForward()
local Target = ent:GetTarget()
local Attachment = ent:GetTargetAttachment()
if IsValid( Target ) and Attachment ~= "" then
local ID = Target:LookupAttachment( Attachment )
local Muzzle = Target:GetAttachment( ID )
if not Muzzle then return vector_origin, vector_origin end
Pos = Muzzle.Pos
Dir = Muzzle.Ang:Forward()
end
return Pos, Dir
end
function EFFECT:Think()
local ent = self.Entity
local emitter = self.Emitter
local emitter3D = self.Emitter3D
if not IsValid( emitter ) or not IsValid( emitter3D ) then return true end
local T = CurTime()
if IsValid( ent ) and not self._KillSwitch then
if not ent:GetActive() then
self._KillSwitch = true
self._KillSwitchTime = CurTime() + 2
end
if (self.nextDFX or 0) < T then
self.nextDFX = T + 0.01
local Pos, Dir = self:GetPosition()
self:MakeFlameStream( emitter, emitter3D, Pos, Dir )
self:MakeFlameMuzzle( emitter, emitter3D, Pos, Dir )
self:SetRenderBoundsWS( Pos, Pos + Dir * 50000 )
end
return true
end
if self._KillSwitch and IsValid( emitter ) and IsValid( emitter3D ) then
if self._KillSwitchTime > T then
return true
end
end
if emitter then
emitter:Finish()
end
if emitter3D then
emitter3D:Finish()
end
return false
end
function EFFECT:MakeFlameImpact( Pos, Dir, Size )
local emitter3D = self.Emitter3D
if not IsValid( emitter3D ) then return end
local hitparticle = emitter3D:Add( "effects/lvs_base/flamelet"..math.random(1,5), Pos + Dir )
if hitparticle then
hitparticle:SetStartSize( Size * 0.25 )
hitparticle:SetEndSize( Size )
hitparticle:SetDieTime( math.Rand(0.5,1) )
hitparticle:SetStartAlpha( 255 )
hitparticle:SetEndAlpha( 0 )
hitparticle:SetRollDelta( math.Rand(-2,2) )
hitparticle:SetAngles( Dir:Angle() )
end
end
function EFFECT:MakeFlameImpactWater( Pos, Dir, Size )
local emitter3D = self.Emitter3D
local emitter = self.Emitter
if not IsValid( emitter ) or not IsValid( emitter3D ) then return end
local sparticle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if sparticle then
sparticle:SetVelocity( Vector(0,0,400) + VectorRand() * 100 )
sparticle:SetDieTime( Size * 0.01 )
sparticle:SetAirResistance( 500 )
sparticle:SetStartAlpha( 40 )
sparticle:SetStartSize( 0 )
sparticle:SetEndSize( Size * 4 )
sparticle:SetRoll( math.Rand(-3,3) )
sparticle:SetRollDelta( math.Rand(-1,1) )
sparticle:SetColor( 255, 255, 255 )
sparticle:SetGravity( Vector( 0, 0, 800 ) )
sparticle:SetCollide( false )
end
local hitparticle = emitter3D:Add( "effects/lvs_base/flamelet"..math.random(1,5), Pos + Dir )
if hitparticle then
hitparticle:SetStartSize( Size * 0.25 )
hitparticle:SetEndSize( Size )
hitparticle:SetDieTime( math.Rand(0.5,1) )
hitparticle:SetStartAlpha( 255 )
hitparticle:SetEndAlpha( 0 )
hitparticle:SetRollDelta( math.Rand(-2,2) )
hitparticle:SetAngles( Dir:Angle() )
end
end
function EFFECT:MakeFlameBurst( Pos, Vel, Size )
local emitter = self.Emitter
if not IsValid( emitter ) then return end
local fparticle = emitter:Add( "effects/lvs_base/fire", Pos )
if fparticle then
fparticle:SetVelocity( VectorRand() * 15 + Vector( 0, 0, 200 ) + Vel )
fparticle:SetDieTime( math.Rand(0.6,0.8) )
fparticle:SetAirResistance( 0 )
fparticle:SetStartAlpha( 255 )
fparticle:SetEndAlpha( 255 )
fparticle:SetStartSize( 40 )
fparticle:SetEndSize( 0 )
fparticle:SetRollDelta( math.Rand(-2,2) )
fparticle:SetColor( 255,255,255 )
fparticle:SetGravity( Vector( 0, 0, 0 ) )
fparticle:SetCollide( false )
self:AddParticle( fparticle )
end
local fparticle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), Pos )
if fparticle then
fparticle:SetVelocity( VectorRand() * 25 + Vel )
fparticle:SetDieTime( math.Rand(0.4,0.8) )
fparticle:SetStartAlpha( 150 )
fparticle:SetEndAlpha( 0 )
fparticle:SetStartSize( 0 )
fparticle:SetEndSize( math.Rand(60,120) )
fparticle:SetColor( 255, 255, 255 )
fparticle:SetGravity( Vector(0,0,100) )
fparticle:SetRollDelta( math.Rand(-2,2) )
fparticle:SetAirResistance( 0 )
end
for i = 0, 6 do
local eparticle = emitter:Add( "effects/fire_embers"..math.random(1,2), Pos )
if not eparticle then continue end
eparticle:SetVelocity( VectorRand() * 400 + Vel )
eparticle:SetDieTime( math.Rand(0.4,0.6) )
eparticle:SetStartAlpha( 255 )
eparticle:SetEndAlpha( 0 )
eparticle:SetStartSize( 20 )
eparticle:SetEndSize( 0 )
eparticle:SetColor( 255, 255, 255 )
eparticle:SetGravity( Vector(0,0,600) )
eparticle:SetRollDelta( math.Rand(-8,8) )
eparticle:SetAirResistance( 300 )
end
local Dist = (self._LastParticlePos - Pos):Length()
self._LastParticlePos = Pos
if Dist < 250 then
if math.random(1,8) ~= 1 then return end
end
local sparticle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if sparticle then
sparticle:SetVelocity( Vector(0,0,400) + Vel )
sparticle:SetDieTime( math.Rand(2,4) * Size )
sparticle:SetAirResistance( 500 )
sparticle:SetStartAlpha( 125 )
sparticle:SetStartSize( 0 )
sparticle:SetEndSize( 200 * Size )
sparticle:SetRoll( math.Rand(-3,3) )
sparticle:SetRollDelta( math.Rand(-1,1) )
sparticle:SetColor( 0, 0, 0 )
sparticle:SetGravity( Vector( 0, 0, 800 ) )
sparticle:SetCollide( false )
end
end
function EFFECT:MakeFlameMuzzle( emitter, emitter3D, pos, dir )
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if not particle then return end
local ent = self.Entity
if not IsValid( ent ) then return end
local velDesired = ent:GetFlameVelocity()
local vel = dir * velDesired
local DieTime = 0.075
particle:SetVelocity( VectorRand() * 30 + vel )
particle:SetDieTime( DieTime )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetEndLength( velDesired * 0.1 )
particle:SetStartLength( velDesired * 0.04 )
particle:SetStartSize( 10 )
particle:SetEndSize( 0 )
particle:SetRollDelta( math.Rand(-5,5) )
particle:SetColor( 50, 50, 255 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
end
function EFFECT:MakeFlameStream( emitter, emitter3D, pos, dir )
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if not particle then return end
local ent = self.Entity
if not IsValid( ent ) then return end
local velDesired = ent:GetFlameVelocity()
local vel = dir * velDesired
local DieTime = math.Rand( ent:GetFlameLifeTime() * 0.5, ent:GetFlameLifeTime() )
particle:SetVelocity( VectorRand() * 30 + vel )
particle:SetDieTime( DieTime )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetEndLength( velDesired * 0.1 )
particle:SetStartLength( velDesired * 0.04 )
particle:SetStartSize( 2 )
particle:SetEndSize( ent:GetFlameSize() )
particle:SetRollDelta( math.Rand(-5,5) )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
local Delay = math.Rand( DieTime * 0.5, DieTime )
local Size = (Delay / DieTime) ^ 2
timer.Simple( Delay, function()
if not IsValid( self ) or not particle or particle.NoSmokeSpawn then return end
local ParticlePos = particle:GetPos()
self:MakeFlameBurst( ParticlePos, vel * 0.2, Size )
end)
particle:SetNextThink( CurTime() )
particle:SetThinkFunction( function( p )
if not IsValid( self ) then return end
p:SetNextThink( CurTime() + 0.05 )
local pos = p:GetPos()
local vel = p:GetVelocity()
local dir = vel:GetNormalized()
local speed = vel:Length() * 0.06
local traceData = {
start = pos,
endpos = pos + dir * speed,
filter = self.Entity,
}
local trace = util.TraceLine( traceData )
traceData.mask = MASK_WATER
local traceWater = util.TraceLine( traceData )
if traceWater.Hit and not trace.Hit then
p:SetDieTime( 0 )
p.NoSmokeSpawn = true
local RandomSize = math.Rand(60,80)
self:MakeFlameImpactWater( traceWater.HitPos, traceWater.HitNormal, RandomSize )
end
if trace.HitWorld or not trace.Hit then return end
p:SetDieTime( 0 )
p.NoSmokeSpawn = true
local RandomSize = math.Rand(40,60)
self:MakeFlameImpact( trace.HitPos, trace.HitNormal, RandomSize )
self:MakeFlameBurst( trace.HitPos, vector_origin, RandomSize / 60 )
end )
particle:SetCollideCallback( function( p, hitpos, hitnormal )
if p.NoSmokeSpawn then return end
p:SetDieTime( 0 )
p.NoSmokeSpawn = true
if not IsValid( emitter3D ) then return end
local RandomSize = math.Rand(40,60)
self:MakeFlameImpact( hitpos, hitnormal, RandomSize )
self:MakeFlameBurst( hitpos + hitnormal, vector_origin, RandomSize / 60 )
end )
particle.NoFade = true
self:AddParticle( particle )
local particle = emitter:Add( "effects/lvs_base/fire", pos )
if particle then
particle:SetVelocity( VectorRand() * 4 + dir * math.Rand(velDesired * 0.8,velDesired * 1.6) )
particle:SetDieTime( math.Rand(0.75,1.5) )
particle:SetAirResistance( 40 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 4 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-3,3) )
particle:SetRollDelta( math.Rand(-6,6) )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( VectorRand() * 400 - Vector(0,0,600) )
particle:SetCollide( true )
end
end
function EFFECT:Render()
local ent = self.Entity
if not IsValid( ent ) then return end
if ent:GetActive() and not self._KillSwitch then
local Scale = 1
local Pos, Dir = self:GetPosition()
local scroll = -CurTime() * 5
local Up = Dir + VectorRand() * 0.08
render.UpdateRefractTexture()
render.SetMaterial( HeatMat )
render.StartBeam( 3 )
render.AddBeam( Pos, 8 * Scale, scroll, Color( 0, 0, 255, 200 ) )
render.AddBeam( Pos + Up * 32 * Scale, 32 * Scale, scroll + 2, color_white )
render.AddBeam( Pos + Up * 128 * Scale, 32 * Scale, scroll + 5, Color( 0, 0, 0, 0 ) )
render.EndBeam()
end
if not istable( self._Particles ) then return end
for id, particle in pairs( self._Particles ) do
if not particle then continue end
local S = particle:GetLifeTime() / particle:GetDieTime()
local A = ((1 - S) ^ 2) * 0.5
local Size = particle:GetStartSize() * A * 8
if particle.NoFade then
Size = particle:GetEndSize() * S * 8
end
render.SetMaterial( GlowMat )
render.DrawSprite( particle:GetPos(), Size, Size, Color( 255 * A, 150 * A, 75 * A, 255 * A) )
end
end

View File

@@ -0,0 +1,112 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local FireMat = Material( "effects/fire_cloud1" )
local HeatMat = Material( "sprites/heatwave" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
self.LifeTime = data:GetMagnitude() * 4
self.DieTime = CurTime() + self.LifeTime
if not IsValid( self.Entity ) then return end
local Pos, Dir = self:GetPosition()
self.Emitter = ParticleEmitter( Pos, false )
self:SetRenderBoundsWS( Pos, Pos + Dir * 50000 )
end
function EFFECT:GetPosition()
local ent = self.Entity
if not IsValid( ent ) then return vector_origin, vector_origin end
local Pos = ent:GetPos()
local Dir = ent:GetForward()
local Target = ent:GetTarget()
local Attachment = ent:GetTargetAttachment()
if IsValid( Target ) and Attachment ~= "" then
local ID = Target:LookupAttachment( Attachment )
local Muzzle = Target:GetAttachment( ID )
if not Muzzle then return vector_origin, vector_origin end
Pos = Muzzle.Pos
Dir = Muzzle.Ang:Forward()
end
return Pos, Dir
end
function EFFECT:DoSmoke( emitter, pos, dir )
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if not particle then return end
particle:SetVelocity( dir * 20 )
particle:SetDieTime( math.Rand(0.8,1.2) )
particle:SetAirResistance( 400 )
particle:SetStartAlpha( 50 * Scale )
particle:SetStartSize( 2 )
particle:SetEndSize( 20 )
particle:SetRoll( math.Rand( -2, 2 ) )
particle:SetRollDelta( math.Rand( -2, 2 ) )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
function EFFECT:Think()
local ent = self.Entity
local emitter = self.Emitter
local T = CurTime()
if IsValid( ent ) and (self.DieTime or 0) > T then
if (self.nextDFX or 0) < T then
self.nextDFX = T + 0.01
local Pos, Dir = self:GetPosition()
if not ent:GetActive() and math.random(1,6) == 1 then
self:DoSmoke( emitter, Pos, Dir )
end
self:SetRenderBoundsWS( Pos, Pos + Dir * 50000 )
end
return true
end
if emitter then
emitter:Finish()
end
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,186 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local FireMat = Material( "effects/fire_cloud1" )
local HeatMat = Material( "sprites/heatwave" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
self.LifeTime = data:GetMagnitude()
self.DieTime = CurTime() + self.LifeTime
if not IsValid( self.Entity ) then return end
local Pos, Dir = self:GetPosition()
self.Emitter = ParticleEmitter( Pos, false )
self:SetRenderBoundsWS( Pos, Pos + Dir * 50000 )
local Pos, Dir = self:GetPosition()
for i = 1,10 do
self:MakeFlameStream( self.Emitter, self.Entity, Pos, Dir )
end
end
function EFFECT:GetPosition()
local ent = self.Entity
if not IsValid( ent ) then return vector_origin, vector_origin end
local Pos = ent:GetPos()
local Dir = ent:GetForward()
local Target = ent:GetTarget()
local Attachment = ent:GetTargetAttachment()
if IsValid( Target ) and Attachment ~= "" then
local ID = Target:LookupAttachment( Attachment )
local Muzzle = Target:GetAttachment( ID )
if not Muzzle then return vector_origin, vector_origin end
Pos = Muzzle.Pos
Dir = Muzzle.Ang:Forward()
end
return Pos, Dir
end
function EFFECT:MakeFlameStream( emitter, ent, pos, dir )
local vel = ent:GetTargetVelocity()
local Alpha = 100 - vel:Length() / 2
if Alpha > 1 then
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if particle then
particle:SetVelocity( VectorRand() * 60 + dir * 200 )
particle:SetDieTime( math.Rand(0.8,1.2) )
particle:SetAirResistance( 400 )
particle:SetStartAlpha( Alpha )
particle:SetStartSize( 2 )
particle:SetEndSize( 20 )
particle:SetRoll( math.Rand( -2, 2 ) )
particle:SetRollDelta( math.Rand( -2, 2 ) )
particle:SetColor( 0, 0, 0 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
local particle = emitter:Add( "effects/lvs_base/fire", pos )
if particle then
particle:SetVelocity( VectorRand() * 60 + dir * math.Rand(100,200) + vel )
particle:SetDieTime( math.Rand(0.75,1.5) )
particle:SetAirResistance( 40 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 1 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-3,3) )
particle:SetRollDelta( math.Rand(-6,6) )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetCollide( true )
end
local particle = emitter:Add( "effects/lvs_base/fire", pos )
if particle then
particle:SetVelocity( dir * 70 + vel )
particle:SetDieTime( 0.2 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 5 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( dir * 40 + vel )
particle:SetDieTime( 0.2 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 2 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-1,1) * 180 )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
local ent = self.Entity
local emitter = self.Emitter
local T = CurTime()
if IsValid( ent ) and (self.DieTime or 0) > T then
if (self.nextDFX or 0) < T then
self.nextDFX = T + 0.01
local Pos, Dir = self:GetPosition()
self:SetRenderBoundsWS( Pos, Pos + Dir * 50000 )
end
return true
end
if emitter then
emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
if not IsValid( ent ) then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local invScaleExp = (1 - Scale) ^ 2
local Pos, Dir = self:GetPosition()
local scroll = -CurTime() * 5
local Up = Dir + VectorRand() * 0.08
render.UpdateRefractTexture()
render.SetMaterial( HeatMat )
render.StartBeam( 3 )
render.AddBeam( Pos, 8 * invScaleExp, scroll, Color( 0, 0, 255, 200 ) )
render.AddBeam( Pos + Up * 32 * invScaleExp, 32 * invScaleExp, scroll + 2, color_white )
render.AddBeam( Pos + Up * 128 * invScaleExp, 32 * invScaleExp, scroll + 5, Color( 0, 0, 0, 0 ) )
render.EndBeam()
local A = Scale ^ 2
local Size = Scale * 64
render.SetMaterial( GlowMat )
render.DrawSprite( Pos, Size, Size, Color( 255 * A, 150 * A, 75 * A, 255 * A) )
end

View File

@@ -0,0 +1,123 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Vel = Dir * 10
if IsValid( Ent ) then
Vel = Ent:GetVelocity()
end
local emitter = ParticleEmitter( Pos, false )
if not IsValid( emitter ) then return end
for i = 0, 12 do
local particle = emitter:Add( "effects/muzzleflash2", Pos + Dir * i * 0.7 * math.random(1,2) * 0.5 )
local Size = 1
if not particle then continue end
particle:SetVelocity( Dir * 800 + Vel )
particle:SetDieTime( 0.05 )
particle:SetStartAlpha( 255 * Size )
particle:SetStartSize( math.max( math.random(10,24) - i * 0.5,0.1 ) * Size )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 255, 255, 255 )
particle:SetCollide( false )
end
local VecCol = (render.GetLightColor( Pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
for i = 0,10 do
local particle = emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], Pos )
if not particle then continue end
particle:SetVelocity( Dir * 700 + VectorRand() * 200 )
particle:SetDieTime( math.Rand(2,3) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 5 )
particle:SetEndSize( 120 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,100) )
particle:SetCollide( false )
end
local trace = util.TraceLine( {
start = Pos,
endpos = Pos - Vector(0,0,500),
mask = MASK_SOLID_BRUSHONLY,
} )
if not trace.Hit then return end
local VecCol = (render.GetLightColor( trace.HitPos + trace.HitNormal ) * 0.8 + Vector(0.17,0.15,0.1)) * 255
for i = 1,24 do
local particle = emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], trace.HitPos )
if not particle then continue end
local ang = i * 15
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
particle:SetVelocity( Vector(X,Y,0) * 3000 )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 50 )
particle:SetEndSize( 240 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,150) + Dir * 2000 )
particle:SetCollide( false )
end
emitter:Finish()
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local ViewEnt = ply:GetViewEntity()
if not IsValid( ViewEnt ) then return end
local Intensity = 16
local Ratio = math.min( 250 / (ViewEnt:GetPos() - trace.HitPos):Length(), 1 )
if Ratio < 0 then return end
util.ScreenShake( trace.HitPos, Intensity * Ratio, 0.1, 0.5, 250 )
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,108 @@
local MatBeam = Material( "effects/lvs_base/spark" )
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.OldPos = self.Entity:GetPos()
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.OldPos ), false )
end
end
function EFFECT:doFX( pos )
if not IsValid( self.Entity ) then return end
if IsValid( self.Emitter ) then
local emitter = self.Emitter
local VecCol = (render.GetLightColor( pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * 1500 + VectorRand() * 10 )
particle:SetDieTime( math.Rand(0.05,1) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 100 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 0 )
particle:SetEndSize( 30 )
particle:SetRollDelta( 1 )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if IsValid( self.Entity ) then
self.nextDFX = self.nextDFX or 0
if self.nextDFX < CurTime() then
self.nextDFX = CurTime() + 0.02
local oldpos = self.OldPos
local newpos = self.Entity:GetPos()
self:SetPos( newpos )
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.OldPos = newpos
for i = 0, Len, 45 do
local pos = oldpos + Dir * i
self:doFX( pos )
end
end
return true
end
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
if not IsValid( ent ) then return end
local pos = ent:GetPos()
local dir = ent:GetForward()
local len = 250
render.SetMaterial( MatBeam )
render.DrawBeam( pos - dir * len, pos + dir * len * 0.1, 32, 1, 0, Color( 100, 100, 100, 100 ) )
render.DrawBeam( pos - dir * len * 0.5, pos + dir * len * 0.1, 16, 1, 0, Color( 255, 255, 255, 255 ) )
render.SetMaterial( GlowMat )
render.DrawSprite( pos, 250, 250, Color( 100, 100, 100, 255 ) )
end

View File

@@ -0,0 +1,67 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
self.Size = data:GetMagnitude()
if not IsValid( Ent ) then return end
self.LifeTime = math.Rand(1.5,3)
self.DieTime = CurTime() + self.LifeTime
local LightColor = render.GetLightColor( Pos )
local VecCol = Vector(1,1.2,1.4) * (0.06 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
VecCol.x = math.min( VecCol.x, 255 )
VecCol.y = math.min( VecCol.y, 255 )
VecCol.z = math.min( VecCol.z, 255 )
self.Splash = {
Pos = Pos,
Mat = Material("effects/splashwake1"),
RandomAng = math.random(0,360),
Color = VecCol,
}
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
if emitter and emitter.Add then
local particle = emitter:Add( "effects/splash4", Pos )
if not particle then return end
local Vel = Ent:GetVelocity():Length()
particle:SetVelocity( Vector(0,0,math.Clamp(Vel / 2,100,250)) )
particle:SetDieTime( 0.25 + math.min(Vel / 200,0.35) )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( self.Size * 0.2 )
particle:SetEndSize( self.Size * 2 )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
if CurTime() > self.DieTime then
return false
end
return true
end
function EFFECT:Render()
if self.Splash and self.LifeTime then
local Scale = ((self.DieTime - self.LifeTime - CurTime()) / self.LifeTime)
local S = self.Size * 5 + (self.Size * 5) * Scale
local Alpha = 100 + 100 * Scale
cam.Start3D2D( self.Splash.Pos + Vector(0,0,1), Angle(0,0,0), 1 )
surface.SetMaterial( self.Splash.Mat )
surface.SetDrawColor( self.Splash.Color.r, self.Splash.Color.g, self.Splash.Color.b, Alpha )
surface.DrawTexturedRectRotated( 0, 0, S , S, self.Splash.RandomAng )
cam.End3D2D()
end
end

View File

@@ -0,0 +1,121 @@
EFFECT.Mat = Material( "effects/lvs/ballturret_projectorbeam" )
EFFECT.HitMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.ID = self.Entity:LookupAttachment( "muzzle_primary" )
if self.ID then
local Muzzle = self.Entity:GetAttachment( self.ID )
self:SetRenderBoundsWS( self.Entity:GetPos(), -Muzzle.Ang:Right() * 50000 )
end
end
self.SpawnTime = CurTime()
end
function EFFECT:Think()
if not IsValid( self.Entity ) or not self.ID or not self.Entity:GetProjectorBeam() then
return false
end
return true
end
function EFFECT:Render()
if not self.ID or not IsValid( self.Entity ) then return end
local T = CurTime()
local Mul = math.min( math.max( 1.5 - (T - self.SpawnTime), 0 ) ^ 2, 1 )
local Muzzle = self.Entity:GetAttachment( self.ID )
local Dir = -Muzzle.Ang:Right()
local StartPos = Muzzle.Pos
local Trace = util.TraceLine( { start = StartPos, endpos = StartPos + Dir * 50000, filter = self } )
local EndPos = Trace.HitPos
self:SetRenderBoundsWS( StartPos, EndPos )
render.SetMaterial( self.Mat )
render.DrawBeam( StartPos, EndPos, (16 + math.random(0,3)) * Mul, 1, 0, Color(255,0,0,255) )
render.DrawBeam( StartPos, EndPos, (4 + math.random(0,2)) * Mul, 1, 0, Color(255,255,255,255) )
render.SetMaterial( self.HitMat )
local A = 150 + math.random(0,20)
local B = 70 + math.random(0,20)
render.DrawSprite( StartPos, A * Mul, A * Mul, Color(255,0,0,255) )
render.DrawSprite( StartPos, B * Mul, B * Mul, Color(255,255,255,255) )
render.DrawSprite( EndPos, A, A, Color(255,0,0,255) )
render.DrawSprite( EndPos + VectorRand() * 10, B, B, Color(255,255,255,255) )
if (self._Next or 0) > T then return end
self._Next = T + 0.02
local emitter = ParticleEmitter( EndPos, false )
if not emitter or not IsValid( emitter ) then return end
local dir = (self.Entity:GetPos() - EndPos):GetNormalized()
for i = 0, 3 do
local particle = emitter:Add( "sprites/light_glow02_add", EndPos )
local vel = VectorRand() * 250 + Trace.HitNormal
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(12,24) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 255, 0, 0 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 1 )
end
local Dist = (StartPos - EndPos):Length()
local invMul = (1 - Mul)
for i = 0, Dist, 25 do
local Pos = StartPos + Dir * i
local particle = emitter:Add( "sprites/rico1", Pos )
local vel = VectorRand() * 150
if not particle then continue end
particle:SetVelocity( vel + vel * invMul )
particle:SetDieTime( 0.1 + 0.15 * invMul )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand( 1, 5 ) + invMul * 2 )
particle:SetEndSize( 0 )
particle:SetColor( 50 + 205 * Mul, 0, 0 )
particle:SetAirResistance( 0 )
particle:SetRoll( math.Rand(-10,10) )
particle:SetRollDelta( math.Rand(-10,10) )
particle:SetGravity( Vector(0,0,-600 * invMul) )
particle:SetAirResistance( 0 )
end
emitter:Finish()
end

View File

@@ -0,0 +1,78 @@
EFFECT.Mat = Material( "effects/lvs/ballturret_projectorbeam" )
EFFECT.HitMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.ID = self.Entity:LookupAttachment( "muzzle_ballturret_left" )
if self.ID then
local Muzzle = self.Entity:GetAttachment( self.ID )
self:SetRenderBoundsWS( self.Entity:GetPos(), Muzzle.Ang:Up() * 50000 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Entity ) or not self.ID or not self.Entity:GetBTLFire() then
return false
end
return true
end
function EFFECT:Render()
if not self.ID or not IsValid( self.Entity ) then return end
local Muzzle = self.Entity:GetAttachment( self.ID )
local Dir = Muzzle.Ang:Up()
local StartPos = Muzzle.Pos + Dir * 14
local Trace = util.TraceLine( { start = StartPos, endpos = StartPos + Dir * 50000, filter = self } )
local EndPos = Trace.HitPos
self:SetRenderBoundsWS( StartPos, EndPos )
render.SetMaterial( self.Mat )
render.DrawBeam( StartPos, EndPos, 14 + math.random(0,4), 1, 0, Color(0,255,0,255) )
render.DrawBeam( StartPos, EndPos, 3 + math.random(0,4), 1, 0, Color(255,255,255,255) )
render.SetMaterial( self.HitMat )
local A = 150 + math.random(0,20)
local B = 70 + math.random(0,20)
render.DrawSprite( StartPos, A, A, Color(0,255,0,255) )
render.DrawSprite( StartPos, B, B, Color(255,255,255,255) )
render.DrawSprite( EndPos, A, A, Color(0,255,0,255) )
render.DrawSprite( EndPos + VectorRand() * 10, B, B, Color(255,255,255,255) )
if math.random(0,5) == 1 then
local emitter = ParticleEmitter( EndPos, false )
local dir = (self.Entity:GetPos() - EndPos):GetNormalized()
for i = 0, 10 do
local particle = emitter:Add( "sprites/rico1", EndPos )
local vel = VectorRand() * 100 + dir * 40
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.1,0.3) * 0.5 )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(1,30) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetAirResistance( 0 )
end
emitter:Finish()
end
end

View File

@@ -0,0 +1,78 @@
EFFECT.Mat = Material( "effects/lvs/ballturret_projectorbeam" )
EFFECT.HitMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.ID = self.Entity:LookupAttachment( "muzzle_ballturret_right" )
if self.ID then
local Muzzle = self.Entity:GetAttachment( self.ID )
self:SetRenderBoundsWS( self.Entity:GetPos(), Muzzle.Ang:Up() * 50000 )
end
end
end
function EFFECT:Think()
if not IsValid( self.Entity ) or not self.ID or not self.Entity:GetBTRFire() then
return false
end
return true
end
function EFFECT:Render()
if not self.ID or not IsValid( self.Entity ) then return end
local Muzzle = self.Entity:GetAttachment( self.ID )
local Dir = Muzzle.Ang:Up()
local StartPos = Muzzle.Pos + Dir * 14
local Trace = util.TraceLine( { start = StartPos, endpos = StartPos + Dir * 50000, filter = self } )
local EndPos = Trace.HitPos
self:SetRenderBoundsWS( StartPos, EndPos )
render.SetMaterial( self.Mat )
render.DrawBeam( StartPos, EndPos, 14 + math.random(0,4), 1, 0, Color(0,255,0,255) )
render.DrawBeam( StartPos, EndPos, 3 + math.random(0,4), 1, 0, Color(255,255,255,255) )
render.SetMaterial( self.HitMat )
local A = 150 + math.random(0,20)
local B = 70 + math.random(0,20)
render.DrawSprite( StartPos, A, A, Color(0,255,0,255) )
render.DrawSprite( StartPos, B, B, Color(255,255,255,255) )
render.DrawSprite( EndPos, A, A, Color(0,255,0,255) )
render.DrawSprite( EndPos + VectorRand() * 10, B, B, Color(255,255,255,255) )
if math.random(0,5) == 1 then
local emitter = ParticleEmitter( EndPos, false )
local dir = (self.Entity:GetPos() - EndPos):GetNormalized()
for i = 0, 10 do
local particle = emitter:Add( "sprites/rico1", EndPos )
local vel = VectorRand() * 100 + dir * 40
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.1,0.3) * 0.5 )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(1,30) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetAirResistance( 0 )
end
emitter:Finish()
end
end

View File

@@ -0,0 +1,82 @@
EFFECT.Mat = Material( "effects/lvs/ballturret_projectorbeam" )
EFFECT.HitMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Entity = data:GetEntity()
self.StartPos = Vector(-172.97,334.04,93.25)
self.EndPos = self.Entity:GetWingTurretTarget()
end
function EFFECT:Think()
if not IsValid( self.Entity ) or not self.Entity:GetWingTurretFire() then
return false
end
self.EndPosDesired = self.Entity:GetWingTurretTarget()
self:SetRenderBoundsWS( self.Entity:GetPos(), self.EndPosDesired )
return true
end
function EFFECT:Render()
if not self.EndPosDesired then return end
self.EndPos = self.EndPos + (self.EndPosDesired - self.EndPos) * FrameTime() * 10
for i = -1,1,2 do
local StartPos = self.Entity:LocalToWorld( self.StartPos * Vector(1,i,1) )
local Trace = util.TraceLine( { start = StartPos, endpos = self.EndPos} )
local EndPos = Trace.HitPos
if self.Entity:WorldToLocal( EndPos ).z < 0 then
self.StartPos = Vector(-172.97,334.04,93.25)
else
self.StartPos = Vector(-174.79,350.05,125.98)
end
if Trace.Entity == self.Entity then continue end
render.SetMaterial( self.Mat )
render.DrawBeam( StartPos, EndPos, 14 + math.random(0,4), 1, 0, Color(0,255,0,255) )
render.DrawBeam( StartPos, EndPos, 3 + math.random(0,4), 1, 0, Color(255,255,255,255) )
render.SetMaterial( self.HitMat )
local A = 150 + math.random(0,20)
local B = 70 + math.random(0,20)
render.DrawSprite( StartPos, A, A, Color(0,255,0,255) )
render.DrawSprite( StartPos, B, B, Color(255,255,255,255) )
render.DrawSprite( EndPos, A, A, Color(0,255,0,255) )
render.DrawSprite( EndPos + VectorRand() * 10, B, B, Color(255,255,255,255) )
if math.random(0,5) == 1 then
local emitter = ParticleEmitter( EndPos, false )
local dir = (self.Entity:GetPos() - EndPos):GetNormalized()
for i = 0, 10 do
local particle = emitter:Add( "sprites/rico1", EndPos )
local vel = VectorRand() * 100 + dir * 40
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.1,0.3) * 0.5 )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(1,30) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetAirResistance( 0 )
end
emitter:Finish()
end
end
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1000 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 4, endpos + dir * len * 4, 200, 1, 0, Color( 0, 0, 255, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 0, 0, 255, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,75 @@
EFFECT.MatBeam = Material( "effects/lvs/ballturret_projectorbeam" )
-- variables
local LifeTime = 1.4
local StartSizeOuter = 16
local StartSizeInner = 6
local EndSizeOuter = 3
local EndSizeInner = 1
local DissipateExponentScale = 16
local DissipateExponentAlpha = 16
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.StartPos = pos
self.Dir = dir
self.ID = data:GetMaterialIndex()
self.LifeTime = LifeTime
self.DieTime = CurTime() + self.LifeTime
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
if bullet then
self.StartPos = bullet.Entity:LocalToWorld( bullet.SrcEntity )
self.EndPos = bullet:GetPos()
self.BulletAlive = true
self.BulletFilter = bullet.Filter
else
-- fix problem in lvs bullet code not updating the target destination
if self.BulletAlive and self.BulletFilter then
self.BulletAlive = nil
local trace = util.TraceLine( {
start = self.StartPos,
endpos = self.StartPos + self.Dir * 50000,
mask = MASK_SHOT_HULL,
filter = self.BulletFilter,
} )
self.EndPos = trace.HitPos
end
end
if not self.StartPos or not self.EndPos then return end
if bullet and bullet:GetLength() <= 0 then return end
-- math, dont change
local S = (self.DieTime - CurTime()) / self.LifeTime
local invS = 1 - S
local Alpha = 255 * (S ^ DissipateExponentAlpha)
local Scale = S ^ DissipateExponentScale
local invScale = invS ^ DissipateExponentScale
render.SetMaterial( self.MatBeam )
render.DrawBeam( self.StartPos, self.EndPos, StartSizeOuter * Scale + EndSizeOuter * invScale, 1, 0, Color( 0, 0, 255, Alpha ) )
render.DrawBeam( self.StartPos, self.EndPos, StartSizeInner * Scale + EndSizeInner * invScale, 1, 0, Color( 255, 255, 255, Alpha ) )
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 2500 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 2, endpos + dir * len * 2, 200, 1, 0, Color( 0, 0, 255, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 0, 0, 255, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 300 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 2, endpos + dir * len * 2, 200, 1, 0, Color( 0, 0, 255, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 0, 0, 255, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,103 @@
EFFECT.HeatWaveMat = Material( "particle/warp1_warp" )
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Ent = data:GetEntity()
self.ID = data:GetAttachment()
if not IsValid( self.Ent ) then return end
local att = self.Ent:GetAttachment( self.ID )
if not att then return end
local Pos = att.Pos
self.LifeTime = 0.35
self.DieTime = CurTime() + self.LifeTime
self.Emitter = ParticleEmitter( Pos, false )
self.Particles = {}
end
function EFFECT:Think()
if (self.DieTime or 0) < CurTime() or not IsValid( self.Ent ) then
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
self:DoSpark()
return true
end
function EFFECT:DoSpark()
local T = CurTime()
if (self._Next or 0) > T then return end
self._Next = T + 0.01
if not IsValid( self.Emitter ) then return end
if not IsValid( self.Ent ) or not self.ID then return end
local att = self.Ent:GetAttachment( self.ID )
if not att then return end
local Pos = att.Pos
local Dir = VectorRand() * 25
for id, particle in pairs( self.Particles ) do
if not particle then
self.Particles[ id ] = nil
continue
end
particle:SetGravity( (Pos - particle:GetPos()) * 50 )
end
local particle = self.Emitter:Add( "sprites/rico1", Pos + Dir )
if not particle then return end
particle:SetDieTime( 0.25 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand( 1, 5 ) )
particle:SetEndSize( 0 )
particle:SetColor( 255, 0, 0 )
particle:SetAirResistance( 0 )
particle:SetRoll( math.Rand(-10,10) )
particle:SetRollDelta( math.Rand(-10,10) )
table.insert( self.Particles, particle )
end
function EFFECT:Render()
if not IsValid( self.Ent ) or not self.ID then return end
local att = self.Ent:GetAttachment( self.ID )
if not att then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
if Scale <= 0 then return end
local rnd = VectorRand() * math.Rand(0,0.5)
render.SetMaterial( self.HeatWaveMat )
render.DrawSprite( att.Pos, 30 *(1 - Scale), 30 * (1 - Scale), Color( 255, 255, 255, 255) )
render.SetMaterial( self.GlowMat )
render.DrawSprite( att.Pos + rnd, 120 * (1 - Scale), 120 * (1 - Scale), Color(255,0,0,255) )
end

View File

@@ -0,0 +1,73 @@
local GlowMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Col = data:GetStart() or Vector(255,100,0)
self.LifeTime = 0.4
self.DieTime = CurTime() + self.LifeTime
local emitter = ParticleEmitter( self.Pos, false )
if not IsValid( emitter ) then return end
for i = 0, 20 do
local particle = emitter:Add( "sprites/light_glow02_add", self.Pos )
local vel = VectorRand() * 400
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.4,0.8) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(24,48) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( self.Col.x,self.Col.y,self.Col.z )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
end
end
for i = 0, 20 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( 0.15 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 )
particle:SetEndSize( 32 )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) * 100 )
particle:SetColor( self.Col.x,self.Col.y,self.Col.z )
particle:SetCollide( false )
end
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
if not self.Col then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( GlowMat )
render.DrawSprite( self.Pos, 400 * Scale, 400 * Scale, Color( self.Col.x,self.Col.y,self.Col.z, 255) )
render.DrawSprite( self.Pos, 100 * Scale, 100 * Scale, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,121 @@
EFFECT.HeatWaveMat = Material( "particle/warp1_warp" )
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local Pos = data:GetOrigin()
self.Pos = Pos
self.LifeTime = 0.4
self.DieTime = CurTime() + self.LifeTime
self.DieTimeGlow = CurTime() + 0.2
sound.Play( "LVS.AAT.LASER_EXPLOSION", Pos )
self:Explosion( Pos )
end
function EFFECT:Explosion( pos )
local emitter = ParticleEmitter( pos, false )
if not emitter then return end
for i = 0, 15 do
local particle = emitter:Add( "sprites/light_glow02_add", pos )
local vel = VectorRand() * 450
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(1,1.6) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(12,15) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 255,0,0 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
end
for i = 0, 5 do
local particle = emitter:Add( "sprites/rico1", pos )
local vel = VectorRand() * 1000
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.5,0.8) )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(10,20) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 255, 0, 0 )
particle:SetGravity( -vel:GetNormalized() * math.random(1250,1750) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
particle:SetAirResistance( 200 )
end
for i = 0, 20 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if not particle then continue end
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( 0.14 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 )
particle:SetEndSize( math.Rand(30,60) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = math.max((self.DieTime - self.LifeTime + 0.3 - CurTime()) / 0.3,0)
render.SetMaterial( self.HeatWaveMat )
render.DrawSprite( self.Pos, 300 * Scale, 300 * Scale, Color( 255, 255, 255, 255) )
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos, 1000 * Scale, 1000 * Scale, Color( 255, 100, 50, 255) )
local Scale = (self.DieTimeGlow - CurTime()) / 0.2
if Scale > 0 then
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos, 100 * Scale, 100 * Scale, Color( 250, 0, 0, 255) )
render.DrawSprite( self.Pos, 25 * Scale, 25 * Scale, Color( 255, 255, 255, 255) )
end
local Scale = (self.DieTime - self.LifeTime + 0.25 - CurTime()) / 0.25
local InvScale = 1 - Scale
if Scale > 0 then
render.SetColorMaterial()
render.DrawSphere( self.Pos, -180 * InvScale, 30,30, Color( 255, 0, 0, 255 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, -190 * InvScale, 30,30, Color( 255, 0, 0, 150 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, -200 * InvScale, 30,30, Color( 255, 0, 0, 50 * (Scale ^ 2) ) )
render.DrawSphere( self.Pos, 210 * InvScale, 30,30, Color( 255, 0, 0, 50 * (Scale ^ 2) ) )
end
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1000 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 4, endpos + dir * len * 4, 200, 1, 0, Color( 0, 255, 0, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 0, 255, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 300 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 2, endpos + dir * len * 2, 100, 1, 0, Color( 0, 255, 0, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 60, 1, 0, Color( 0, 255, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,78 @@
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Dir = data:GetNormal()
self.Col = data:GetStart() or Vector(255,100,0)
self.LifeTime = 0.2
self.DieTime = CurTime() + self.LifeTime
local trace = util.TraceLine( {
start = self.Pos - self.Dir,
endpos = self.Pos + self.Dir,
mask = MASK_SOLID_BRUSHONLY,
} )
self.Flat = trace.Hit and not trace.HitSky
local Col = self.Col
local Pos = self.Pos
local emitter = ParticleEmitter( Pos, false )
for i = 0, 10 do
local particle = emitter:Add( "sprites/light_glow02_add", Pos )
local vel = VectorRand() * 200 + self.Dir * 80
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(12,24) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( Col.x,Col.y,Col.z )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
local S1 = 200 * Scale
local S2 = 50 * Scale
if self.Flat then
cam.Start3D2D( self.Pos + self.Dir, self.Dir:Angle() + Angle(90,0,0), 1 )
surface.SetMaterial( self.GlowMat )
surface.SetDrawColor( self.Col.x, self.Col.y, self.Col.z, 255 )
surface.DrawTexturedRectRotated( 0, 0, S1 , S1 , 0 )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRectRotated( 0, 0, S2 , S2 , 0 )
cam.End3D2D()
end
render.SetMaterial( self.GlowMat )
render.DrawSprite( self.Pos + self.Dir, S1, S1, Color( self.Col.x, self.Col.y, self.Col.z, 255 ) )
render.DrawSprite( self.Pos + self.Dir, S2, S2, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1000 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 4, endpos + dir * len * 4, 200, 1, 0, Color( 255, 0, 0, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 255, 0, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,103 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
local emitter = ParticleEmitter( pos, false )
if not IsValid( emitter ) then return end
local trace = util.TraceLine( {
start = pos,
endpos = pos - Vector(0,0,500),
mask = MASK_SOLID_BRUSHONLY,
} )
if not trace.Hit then return end
local VecCol = (render.GetLightColor( trace.HitPos + trace.HitNormal ) * 0.8 + Vector(0.17,0.15,0.1)) * 255
for i = 1,24 do
local particle = emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], trace.HitPos )
if not particle then continue end
local ang = i * 15
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
particle:SetVelocity( Vector(X,Y,0) * 3000 )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 50 )
particle:SetEndSize( 240 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,150) + dir * 2000 )
particle:SetCollide( false )
end
emitter:Finish()
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local ViewEnt = ply:GetViewEntity()
if not IsValid( ViewEnt ) then return end
local Intensity = 8
local Ratio = math.min( 250 / (ViewEnt:GetPos() - trace.HitPos):Length(), 1 )
if Ratio < 0 then return end
util.ScreenShake( trace.HitPos, Intensity * Ratio, 0.1, 0.5, 250 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 100 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 8, endpos + dir * len * 8, 200, 1, 0, Color( 255, 0, 0, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 60, 1, 0, Color( 255, 0, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 30, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,34 @@
EFFECT.MatBeam = Material( "effects/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 300 * bullet:GetLength()
render.SetMaterial( self.MatSprite )
render.DrawBeam( endpos - dir * len * 2, endpos + dir * len * 2, 200, 1, 0, Color( 255, 0, 0, 255 ) )
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 45, 1, 0, Color( 255, 0, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 15, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,127 @@
EFFECT.Offset = Vector(-8,0,0)
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.OldPos = self.Entity:LocalToWorld( self.Offset )
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.OldPos ), false )
end
end
function EFFECT:doFX( pos )
if not IsValid( self.Entity ) then return end
if IsValid( self.Emitter ) then
local emitter = self.Emitter
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if particle then
particle:SetGravity( Vector(0,0,100) + VectorRand() * 50 )
particle:SetVelocity( -self.Entity:GetForward() * 200 )
particle:SetAirResistance( 600 )
particle:SetDieTime( math.Rand(1.5,2) )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 20 )
particle:SetEndSize( 60 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor(40,40,40)
particle:SetCollide( false )
end
local particle = emitter:Add( "particles/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * math.Rand(250,800) + self.Entity:GetVelocity())
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 8 )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
local particle = emitter:Add( "particles/flamelet"..math.random(1,5), self.Entity:GetPos() )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * 200 + VectorRand() * 50 )
particle:SetDieTime( 0.25 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 6 )
particle:SetEndSize( 2 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if IsValid( self.Entity ) then
self.nextDFX = self.nextDFX or 0
if self.nextDFX < CurTime() then
self.nextDFX = CurTime() + 0.02
local oldpos = self.OldPos
local newpos = self.Entity:LocalToWorld( self.Offset )
self:SetPos( newpos )
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.OldPos = newpos
for i = 0, Len, 45 do
local pos = oldpos + Dir * i
self:doFX( pos )
end
end
return true
end
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
if not IsValid( ent ) then return end
local pos = ent:LocalToWorld( self.Offset )
render.SetMaterial( GlowMat )
render.DrawSprite( pos, 100, 100, Color( 255, 200, 150, 255 ) )
end

View File

@@ -0,0 +1,40 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Vel = Dir * 10
if IsValid( Ent ) then
Vel = Ent:GetVelocity()
end
local emitter = ParticleEmitter( Pos, false )
if not IsValid( emitter ) then return end
for i = 0, 12 do
local particle = emitter:Add( "effects/muzzleflash2", Pos + Dir * i * 0.7 * math.random(1,2) * 0.5 )
local Size = 1
if not particle then continue end
particle:SetVelocity( Dir * 800 + Vel )
particle:SetDieTime( 0.05 )
particle:SetStartAlpha( 255 * Size )
particle:SetStartSize( math.max( math.random(10,24) - i * 0.5,0.1 ) * Size )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 255, 255, 255 )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,41 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Col = data:GetStart() or Vector(255,255,255)
local Vel = Dir * 10
if IsValid( Ent ) then
Vel = Ent:GetVelocity()
end
local emitter = ParticleEmitter( Pos, false )
if not IsValid( emitter ) then return end
for i = 0, 12 do
local particle = emitter:Add( "effects/muzzleflash2", Pos + Dir * i * 0.7 * math.random(1,2) * 0.5 )
local Size = 1
if not particle then continue end
particle:SetVelocity( Dir * 800 + Vel )
particle:SetDieTime( 0.05 )
particle:SetStartAlpha( 255 * Size )
particle:SetStartSize( math.max( math.random(10,24) - i * 0.5,0.1 ) * Size )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( Col.x, Col.y, Col.z )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,82 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
local MatDebris = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
local Dir = Ent:GetForward()
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
local VecCol = render.GetLightColor( Pos + Vector(0,0,10) ) * 0.5 + Vector(0.3,0.25,0.15)
if emitter and emitter.Add then
for i = 1, 3 do
local particle = emitter:Add( MatDebris[math.random(1,#MatDebris)], Pos + VectorRand(-10,10) )
if particle then
particle:SetVelocity( Vector(0,0,150) - Dir * 150 )
particle:SetDieTime( 0.2 )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 255 )
particle:SetStartSize( 15 )
particle:SetEndSize( 50 )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor( VecCol.x * 130,VecCol.y * 100,VecCol.z * 60 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
local Right = Ent:GetRight()
Right.z = 0
Right:Normalize()
for i = -1,1,2 do
local particle = emitter:Add( Materials[math.random(1,#Materials)], Pos + Vector(0,0,10) )
if particle then
particle:SetVelocity( -Dir * 400 + Right * 150 * i )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 150 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( -80 )
particle:SetEndSize( 400 )
particle:SetColor( VecCol.x * 255,VecCol.y * 255,VecCol.z * 255 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,89 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
if not LVS.ShowPhysicsEffects then return end
local dir = data:GetNormal()
local pos = data:GetOrigin() + dir
local emitter = ParticleEmitter( pos, false )
for i = 0, 10 do
local particle = emitter:Add( "effects/spark", pos )
local vel = VectorRand() * 75 + dir * 75 + Vector(0,0,100)
if not particle then continue end
particle:SetVelocity( vel )
particle:SetDieTime( math.Rand(2.5,5) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartLength( 6 )
particle:SetEndLength(0)
particle:SetStartSize( 3 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-5,5) )
particle:SetColor( 255, 200, 50 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetCollide( true )
end
local smoke = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
if smoke then
smoke:SetVelocity( dir * 30 + VectorRand() * 15 )
smoke:SetDieTime( math.Rand(1.5,3) )
smoke:SetAirResistance( 100 )
smoke:SetStartAlpha( 100 )
smoke:SetEndAlpha( 0 )
smoke:SetStartSize( 15 )
smoke:SetEndSize( 30 )
smoke:SetColor(30,30,30)
smoke:SetGravity(Vector(0,0,40))
smoke:SetCollide( false )
smoke:SetRollDelta( math.Rand(-1,1) )
end
local flash = emitter:Add( "effects/yellowflare",pos )
if flash then
flash:SetPos( pos )
flash:SetStartAlpha( 200 )
flash:SetEndAlpha( 0 )
flash:SetColor( 255, 200, 0 )
flash:SetEndSize( 100 )
flash:SetDieTime( 0.1 )
flash:SetStartSize( 0 )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,109 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
if not LVS.ShowPhysicsEffects then
self.LifeTime = 0
self.DieTime = 0
return
end
self.Pos = data:GetOrigin()
self.mat = Material( "sprites/light_glow02_add" )
self.LifeTime = 0.2
self.DieTime = CurTime() + self.LifeTime
local Col = self.Col
local Pos = self.Pos
local Dir = data:GetNormal()
local Strength = data:GetMagnitude()
local emitter = ParticleEmitter( Pos, false )
for i = 0,1 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
local vel = VectorRand() * 100 + Dir * 40
if particle then
particle:SetVelocity( vel )
particle:SetDieTime( 1 )
particle:SetAirResistance( 1000 )
particle:SetStartAlpha( 10 )
particle:SetStartSize( 2 )
particle:SetEndSize( 12 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 40, 30, 20 )
particle:SetGravity( Dir * 50 )
particle:SetCollide( false )
end
end
for i = 0, 3 do
local particle = emitter:Add( "effects/spark", Pos )
local vel = VectorRand() * 25 * (1 - Strength) + (VectorRand() * 100 + Dir * 150) * Strength
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( 2 )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartLength( 4 )
particle:SetEndLength(0)
particle:SetStartSize( 2 )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
particle:SetAirResistance( 0 )
particle:SetColor( 255, 200, 50 )
particle:SetGravity( Vector(0,0,-600) )
end
end
emitter:Finish()
end
function EFFECT:Think()
if self.DieTime < CurTime() then
return false
end
return true
end
local mat = Material( "sprites/light_glow02_add" )
function EFFECT:Render()
if not LVS.ShowPhysicsEffects then return end
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( mat )
render.DrawSprite( self.Pos, 32, 32, Color( 255 * Scale, 175 * Scale, 80 * Scale, 255) )
end

View File

@@ -0,0 +1,43 @@
EFFECT.DustMat = {
"effects/lvs/track_debris_01",
"effects/lvs/track_debris_02",
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local ent = data:GetEntity()
local size = data:GetMagnitude()
if not IsValid( ent ) then return end
local dir = data:GetNormal()
local emitter = ent:GetParticleEmitter( ent:GetPos() )
local VecCol = (render.GetLightColor( pos + dir ) * 0.5 + Vector(0.5,0.4,0.3)) * 255
local scale = math.Clamp( size / 23, 0.5, 1.25 )
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ] , pos + dir * 5 * scale + VectorRand() * 5 * scale )
if not particle then return end
particle:SetVelocity( (dir * 100 * scale + VectorRand() * 20 * scale) )
particle:SetDieTime( math.Rand(0.4,0.6) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( math.random(100,255) )
particle:SetStartSize( 6 * scale )
particle:SetEndSize( math.random(20,25) * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,-600) )
particle:SetCollide( false )
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,48 @@
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
local emitter = ParticleEmitter( pos, false )
for i = 1, 360 do
if math.random(1,30) ~= 10 then continue end
local ang = i
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local forward = Vector(X,Y,0)
forward:Rotate( dir:Angle() + Angle(90,0,0) )
local spark = emitter:Add("effects/spark", pos + VectorRand() * 10 )
if not spark then continue end
spark:SetStartAlpha( 255 )
spark:SetEndAlpha( 0 )
spark:SetCollide( true )
spark:SetBounce( math.Rand(0,1) )
spark:SetColor( 255, 255, 255 )
spark:SetGravity( Vector(0,0,-600) )
spark:SetEndLength(0)
local size = math.Rand(2, 4)
spark:SetEndSize( size )
spark:SetStartSize( size )
spark:SetStartLength( math.Rand(5,7) )
spark:SetDieTime( math.Rand(0.1, 0.3) )
spark:SetVelocity( forward * math.random(75,100) + VectorRand() * 50 )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,48 @@
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
local emitter = ParticleEmitter( pos, false )
for i = 1, 360 do
if math.random(1,30) ~= 15 then continue end
local ang = i
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
local forward = Vector(X,Y,0)
forward:Rotate( dir:Angle() + Angle(90,0,0) )
local spark = emitter:Add("effects/spark", pos + forward * 25 )
if not spark then continue end
spark:SetStartAlpha( 255 )
spark:SetEndAlpha( 0 )
spark:SetCollide( true )
spark:SetBounce( math.Rand(0,1) )
spark:SetColor( 255, 255, 255 )
spark:SetGravity( Vector(0,0,-600) )
spark:SetEndLength(0)
local size = math.Rand(4, 6)
spark:SetEndSize( size )
spark:SetStartSize( size )
spark:SetStartLength( math.Rand(10,20) )
spark:SetDieTime( math.Rand(0.01, 0.2) )
spark:SetVelocity( forward * math.random(250,400) + dir * 150 + VectorRand() * 50 )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,63 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
self.LifeTime = math.Rand(1.5,3)
self.DieTime = CurTime() + self.LifeTime
local LightColor = render.GetLightColor( Pos )
self.VecCol = Vector(1,1.2,1.4) * (0.06 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
self.VecCol.x = math.min( self.VecCol.x, 255 )
self.VecCol.y = math.min( self.VecCol.y, 255 )
self.VecCol.z = math.min( self.VecCol.z, 255 )
self.Splash = {
Pos = Pos,
Mat = Material("effects/splashwake1"),
RandomAng = math.random(0,360),
}
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
if emitter and emitter.Add then
local particle = emitter:Add( "effects/splash4", Pos + VectorRand(-10,10) - Vector(0,0,20) )
if particle then
particle:SetVelocity( Vector(0,0,250) )
particle:SetDieTime( 0.8 )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 50 )
particle:SetEndSize( 100 )
particle:SetRoll( math.Rand(-1,1) * 100 )
particle:SetColor(self.VecCol.r,self.VecCol.g,self.VecCol.b)
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if CurTime() > self.DieTime then
return false
end
return true
end
function EFFECT:Render()
if self.Splash and self.LifeTime then
local Scale = (self.DieTime - self.LifeTime - CurTime()) / self.LifeTime
local S = 200 - Scale * 600
local Alpha = 100 + 100 * Scale
cam.Start3D2D( self.Splash.Pos + Vector(0,0,1), Angle(0,0,0), 1 )
surface.SetMaterial( self.Splash.Mat )
surface.SetDrawColor( self.VecCol.r, self.VecCol.g, self.VecCol.b, Alpha )
surface.DrawTexturedRectRotated( 0, 0, S , S, self.Splash.RandomAng )
cam.End3D2D()
end
end

View File

@@ -0,0 +1,175 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
if not IsValid( emitter ) then return end
local Vel = Ent:GetVelocity()
Vel.z = 0
local Speed = Vel:Length()
if Speed < 50 then return end
local Steer = math.abs( Ent:GetSteer() )
local ShouldPlaySound = false
local T = CurTime()
local LightColor = render.GetLightColor( Pos )
local VecCol = Vector(1,1.2,1.4) * (0.06 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
VecCol.x = math.min( VecCol.x, 255 )
VecCol.y = math.min( VecCol.y, 255 )
VecCol.z = math.min( VecCol.z, 255 )
local mul = math.min(Speed * 0.005,1)
local invmul = 1 - mul
local EntPos = Ent:GetPos()
local Len = Ent:BoundingRadius() * 1.5
local MoveDir = Vel:GetNormalized()
local MoveAng = MoveDir:Angle()
local Target = LocalPlayer()
if IsValid( Target ) then
ShouldPlaySound = Target:lvsGetVehicle() == Ent
local ViewEnt = Target:GetViewEntity()
if IsValid( ViewEnt ) then
Target = ViewEnt
end
end
local SwapSides = math.abs( Ent:GetSteer() ) > 0.9
local Res = math.max( math.Round( (Target:GetPos() - Pos):LengthSqr() / 2500000, 0 ), 5 )
for i = -135, 135, Res do
local Dir = Angle(0,MoveAng.y+i,0):Forward()
local StartPos = Pos + Dir * Len
local EndPos = Pos
local trace = util.TraceLine( {
start = StartPos,
endpos = EndPos,
filter = Ent,
ignoreworld = true,
whitelist = true,
} )
if not trace.Hit then continue end
local fxPos = Ent:WorldToLocal( trace.HitPos + trace.HitNormal * 2 )
if SwapSides then fxPos.y = -fxPos.y end
fxPos = Ent:LocalToWorld( fxPos )
local particle = emitter:Add( "effects/splash4", fxPos + Vector(0,0,math.Rand(-5,5) * mul) )
if not particle then continue end
local pfxVel = Ent:WorldToLocal( EntPos + Dir * Speed * 0.5 + trace.HitNormal * Speed * 0.25 )
if SwapSides then pfxVel.y = -pfxVel.y end
pfxVel = Ent:LocalToWorld( pfxVel ) - EntPos
local pfxMul = math.Clamp( pfxVel.z / 250, 1, 2 )
particle:SetVelocity( pfxVel )
particle:SetDieTime( (math.Rand(0.8,0.8) + math.Rand(0.2,0.4) * invmul) * pfxMul )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( ((pfxMul / 2) ^ 2) * 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 5 + math.Rand(5,10) * mul )
particle:SetEndSize( 15 + math.Rand(10,20) * mul * pfxMul )
particle:SetRoll( math.Rand(-1,1) * math.Rand(50,150) )
particle:SetRollDelta( math.Rand(-1,1) * pfxMul * mul * 0.5 )
particle:SetColor(VecCol.r,VecCol.g,VecCol.b)
particle:SetGravity( Vector( 0, 0, -600 * math.Rand(1,1 + Steer * 3) ) - Vel * math.abs( i * 0.15 ) / 65 )
particle:SetCollide( false )
particle:SetNextThink( T )
particle:SetThinkFunction( function( p )
local fxpos = p:GetPos()
p:SetNextThink( CurTime() )
if fxpos.z > Pos.z then return end
p:SetDieTime( 0 )
if not IsValid( Ent ) or math.random(1,6) ~= 2 then return end
local startpos = Vector(fxpos.x,fxpos.y,Pos.z + 1)
local volume = math.min( math.abs( p:GetVelocity().z ) / 100, 1 )
if ShouldPlaySound and volume > 0.2 and p:GetStartSize() > 13 and math.random(1,10) == 1 then
local pitch = math.Rand(95,105) * math.Clamp( 1.5 - volume * 0.9,0.5,1)
if pitch < 58 then
sound.Play( "vehicles/airboat/pontoon_splash"..math.random(1,2)..".wav", startpos, 75, math.Rand(95,105), volume * 0.1, 0 )
else
if Speed < 600 then
sound.Play( "ambient/water/water_splash"..math.random(1,3)..".wav", startpos, 75, pitch, volume * 0.1, 0 )
end
end
end
if not ShouldPlaySound then return end
local emitter3D = Ent:GetParticleEmitter3D( Ent:GetPos() )
if not IsValid( emitter3D ) then return end
local particle = emitter3D:Add("effects/splashwake1", startpos )
if not particle then return end
local scale = math.Rand(0.5,2)
local size = p:GetEndSize()
local vsize = Vector(size,size,size)
particle:SetStartSize( size * scale * 0.5 )
particle:SetEndSize( size * scale )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetPos( startpos )
particle:SetAngles( Angle(-90,math.Rand(-180,180),0) )
particle:SetColor(VecCol.r,VecCol.g,VecCol.b)
particle:SetNextThink( CurTime() )
particle:SetThinkFunction( function( pfx )
local startpos = pfx:GetPos()
local endpos = startpos - Vector(0,0,100)
local trace = util.TraceHull( {
start = startpos,
endpos = endpos,
filter = Ent,
whitelist = true,
mins = -vsize,
maxs = vsize,
} )
if trace.Hit then pfx:SetDieTime( 0 ) return end
pfx:SetNextThink( CurTime() )
end )
end )
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,183 @@
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
EFFECT.DustMat = {
"effects/lvs_base/particle_debris_01",
"effects/lvs_base/particle_debris_02",
}
local SmokeMat = EFFECT.SmokeMat
local function MakeDustParticle( emitter, emitter3D, pos, vel, r, g, b )
local particle = emitter:Add( SmokeMat[ math.random(1,#SmokeMat) ], pos )
if not particle then return end
particle:SetVelocity( vel )
particle:SetDieTime( 0.4 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 20 )
particle:SetEndSize( 30 )
particle:SetRollDelta( math.Rand(-6,6) )
particle:SetColor( r, g, b )
particle:SetGravity( Vector(0,0,-600) )
particle:SetCollide( false )
particle:SetNextThink( CurTime() )
particle:SetThinkFunction( function( p )
if not IsValid( emitter3D ) then return end
p:SetNextThink( CurTime() + 0.05 )
local pos = p:GetPos()
local vel = p:GetVelocity()
local traceData = {
start = pos,
endpos = pos + Vector(0,0,vel.z) * 0.06,
mask = MASK_SOLID_BRUSHONLY,
}
local trace = util.TraceLine( traceData )
if not trace.Hit then return end
p:SetEndSize( 0 )
p:SetDieTime( 0 )
local pHit = emitter3D:Add( SmokeMat[ math.random(1,#SmokeMat) ], trace.HitPos + trace.HitNormal )
pHit:SetStartSize( 15 )
pHit:SetEndSize( 15 )
pHit:SetDieTime( math.Rand(5,6) )
pHit:SetStartAlpha( 50 )
pHit:SetEndAlpha( 0 )
pHit:SetColor( p:GetColor() )
local Ang = trace.HitNormal:Angle()
Ang:RotateAroundAxis( trace.HitNormal, math.Rand(-180,180) )
pHit:SetAngles( Ang )
end )
end
function EFFECT:Init( data )
local pos = data:GetOrigin()
local ent = data:GetEntity()
if not IsValid( ent ) then return end
local dir = data:GetNormal()
local scale = data:GetMagnitude()
local speed = ent:GetVelocity():LengthSqr()
local tooSlow = speed < 30000
local tooFast = speed > 400000
local underwater = data:GetFlags() == 1
local start = ent:GetPos()
local emitter = ent:GetParticleEmitter( start )
local emitter3D = ent:GetParticleEmitter3D( start )
local VecCol
local LightColor = render.GetLightColor( pos + dir )
if underwater then
VecCol = Vector(1,1.2,1.4) * (0.06 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
else
VecCol = Vector(0.3,0.25,0.15) * (0.1 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
end
VecCol.x = math.min( VecCol.x, 255 )
VecCol.y = math.min( VecCol.y, 255 )
VecCol.z = math.min( VecCol.z, 255 )
local DieTime = math.Rand(0.8,1.6)
if not tooSlow then
for i = 1, 5 do
local particle = emitter:Add( self.DustMat[ math.random(1,#self.DustMat) ] , pos )
if not particle then continue end
particle:SetVelocity( (dir * 50 * i + VectorRand() * 25) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
end
end
for i = 1, 5 do
local particle = emitter:Add( underwater and "effects/splash4" or self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if not particle then continue end
particle:SetVelocity( (dir * 50 * i + VectorRand() * 40) * scale )
particle:SetDieTime( (i / 8) * DieTime )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( underwarter and 150 or 255 )
particle:SetStartSize( 10 * scale )
particle:SetEndSize( 20 * i * scale )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( VecCol.r, VecCol.g, VecCol.b )
particle:SetGravity( Vector(0,0,-600) * scale )
particle:SetCollide( false )
if underwater or tooFast then continue end
particle:SetNextThink( CurTime() )
particle:SetThinkFunction( function( p )
if not IsValid( ent ) or not IsValid( emitter ) or not IsValid( emitter3D ) then return end
p:SetNextThink( CurTime() + 0.05 )
local pos = p:GetPos()
local vel = p:GetVelocity()
local dir = vel:GetNormalized()
local speed = vel:Length()
local traceData = {
start = pos,
endpos = pos + dir * speed * 0.06,
whitelist = true,
filter = ent,
}
local trace = util.TraceLine( traceData )
if not trace.Hit then return end
if tooSlow then
p:SetEndSize( 0 )
p:SetDieTime( 0 )
end
MakeDustParticle( emitter, emitter3D, trace.HitPos - trace.HitNormal * 10, trace.HitNormal * 20 + VectorRand() * 40, p:GetColor() )
end )
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,56 @@
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local ent = data:GetEntity()
if not IsValid( ent ) then return end
local dir = data:GetNormal()
local emitter = ent:GetParticleEmitter( ent:GetPos() )
local VecCol = (render.GetLightColor( pos + dir ) * 0.5 + Vector(0.3,0.3,0.3)) * 255
for i = 1, 2 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 50 )
particle:SetDieTime( math.Rand(0.5,1.5) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 20 )
particle:SetEndSize( 60 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,5) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,80 @@
EFFECT.WaterWake = Material("effects/splashwake1")
function EFFECT:Init( data )
local Pos = data:GetOrigin() + Vector(0,0,1)
local Ent = data:GetEntity()
self.Size = data:GetMagnitude()
if not IsValid( Ent ) then return end
self.LifeTime = 1
self.DieTime = CurTime() + self.LifeTime
local RainFX = data:GetFlags() == 1
if RainFX then
self.Size = self.Size * 2
else
self.Splash = {
Pos = Pos,
Mat = self.WaterWake,
RandomAng = math.random(0,360),
}
end
local LightColor = render.GetLightColor( Pos )
self.VecCol = Vector(1,1.2,1.4) * (0.06 + (0.2126 * LightColor.r) + (0.7152 * LightColor.g) + (0.0722 * LightColor.b)) * 1000
self.VecCol.x = math.min( self.VecCol.x, 255 )
self.VecCol.y = math.min( self.VecCol.y, 255 )
self.VecCol.z = math.min( self.VecCol.z, 255 )
local emitter = Ent:GetParticleEmitter( Ent:GetPos() )
local Vel = Ent:GetVelocity():Length()
for i = 1, 3 do
if emitter and emitter.Add then
local particle = emitter:Add( "effects/splash4", Pos + VectorRand() * self.Size * 0.1 )
if not particle then continue end
particle:SetVelocity( Vector(0,0,math.Clamp(Vel / 100,100,250)) )
particle:SetDieTime( 0.25 + math.min(Vel / 500,0.2) )
particle:SetAirResistance( 60 )
particle:SetStartAlpha( RainFX and 5 or 150 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( self.Size * 0.2 )
particle:SetEndSize( self.Size )
particle:SetRollDelta( math.Rand(-1,1) * 5 )
particle:SetColor( math.min( self.VecCol.r, 255 ), math.min( self.VecCol.g, 255 ), math.min( self.VecCol.b, 255 ) )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if CurTime() > self.DieTime then
return false
end
return true
end
function EFFECT:Render()
if not self.Splash or not self.LifeTime or not self.VecCol then return end
local Scale = 1 - (self.DieTime - CurTime()) / self.LifeTime
local Alpha = math.max( 100 - 150 * Scale ^ 2, 0 )
if Alpha <= 0 then return end
local Size = (self.Size + self.Size * Scale) * 1.5
cam.Start3D2D( self.Splash.Pos, Angle(0,0,0), 1 )
surface.SetMaterial( self.Splash.Mat )
surface.SetDrawColor( math.min( self.VecCol.r, 255 ), math.min( self.VecCol.g, 255 ), math.min( self.VecCol.b, 255 ), Alpha )
surface.DrawTexturedRectRotated( 0, 0, Size, Size, self.Splash.RandomAng )
cam.End3D2D()
end

View File

@@ -0,0 +1,119 @@
local GlowMat = Material( "sprites/light_glow02_add" )
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.LifeTime = 0.4
self.DieTime = CurTime() + self.LifeTime
local emitter = ParticleEmitter( self.Pos, false )
if not IsValid( emitter ) then return end
for i = 0,30 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 800 )
particle:SetDieTime( math.Rand(4,6) )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 100 )
particle:SetStartSize( math.Rand(30,60) )
particle:SetEndSize( math.Rand(100,150) )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 50,50,50 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
end
for i = 0, 20 do
local particle = emitter:Add( "sprites/light_glow02_add", self.Pos )
local vel = VectorRand() * 400
if particle then
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.4,0.8) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(24,48) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 0,127,255 )
particle:SetGravity( Vector(0,0,-600) )
particle:SetAirResistance( 0 )
particle:SetCollide( true )
particle:SetBounce( 0.5 )
end
end
for i = 0, 40 do
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Pos )
if particle then
particle:SetVelocity( VectorRand(-1,1) * 500 )
particle:SetDieTime( 0.14 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 10 )
particle:SetEndSize( math.Rand(30,60) )
particle:SetEndAlpha( 100 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 200,150,150 )
particle:SetCollide( false )
end
end
emitter:Finish()
local Pos = self.Pos
local ply = LocalPlayer():GetViewEntity()
if IsValid( ply ) then
local delay = (Pos - ply:GetPos()):Length() / 13503.9
if delay <= 0.11 then
sound.Play( "ambient/explosions/explode_9.wav", Pos, 85, 100, 1 - delay * 8 )
end
timer.Simple( delay, function()
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end )
else
sound.Play( "LVS.MISSILE_EXPLOSION", Pos )
end
end
function EFFECT:Think()
if self.DieTime < CurTime() then return false end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( GlowMat )
render.DrawSprite( self.Pos, 400 * Scale, 400 * Scale, Color( 0, 127, 255, 255) )
render.DrawSprite( self.Pos, 100 * Scale, 100 * Scale, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,92 @@
EFFECT.Offset = Vector(-8,0,0)
local GlowMat = Material( "effects/select_ring" )
function EFFECT:Init( data )
self.Entity = data:GetEntity()
if IsValid( self.Entity ) then
self.OldPos = self.Entity:LocalToWorld( self.Offset )
self.Emitter = ParticleEmitter( self.Entity:LocalToWorld( self.OldPos ), false )
end
end
function EFFECT:doFX( pos )
if not IsValid( self.Entity ) then return end
if IsValid( self.Emitter ) then
local emitter = self.Emitter
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * math.Rand(250,800) + self.Entity:GetVelocity())
particle:SetDieTime( 1 )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 8 )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,255 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
local particle = emitter:Add( "effects/lvs_base/flamelet"..math.random(1,5), self.Entity:GetPos() )
if particle then
particle:SetVelocity( -self.Entity:GetForward() * 200 + VectorRand() * 50 )
particle:SetDieTime( 1 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 6 )
particle:SetEndSize( 2 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,255 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
end
end
function EFFECT:Think()
if IsValid( self.Entity ) then
self.nextDFX = self.nextDFX or 0
if self.nextDFX < CurTime() then
self.nextDFX = CurTime() + 0.02
local oldpos = self.OldPos
local newpos = self.Entity:LocalToWorld( self.Offset )
self:SetPos( newpos )
local Sub = (newpos - oldpos)
local Dir = Sub:GetNormalized()
local Len = Sub:Length()
self.OldPos = newpos
for i = 0, Len, 45 do
local pos = oldpos + Dir * i
self:doFX( pos )
end
end
return true
end
if IsValid( self.Emitter ) then
self.Emitter:Finish()
end
return false
end
function EFFECT:Render()
local ent = self.Entity
local pos = ent:LocalToWorld( self.Offset )
render.SetMaterial( GlowMat )
render.DrawSprite( pos, 100, 100, Color( 0, 127, 255, 50 ) )
end

View File

@@ -0,0 +1,40 @@
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
local Vel = Dir * 10
if IsValid( Ent ) then
Vel = Ent:GetVelocity()
end
local emitter = ParticleEmitter( Pos, false )
if not IsValid( emitter ) then return end
for i = 0, 12 do
local particle = emitter:Add( "effects/gunshipmuzzle", Pos + Dir * i * 0.7 * math.random(1,2) * 0.5 )
local Size = 1
if not particle then continue end
particle:SetVelocity( Dir * 800 + Vel )
particle:SetDieTime( 0.05 )
particle:SetStartAlpha( 255 * Size )
particle:SetStartSize( math.max( math.random(10,24) - i * 0.5,0.1 ) * Size )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetColor( 255, 255, 255 )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,29 @@
EFFECT.MatBeam = Material( "effects/gunshiptracer" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 500 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos + dir * len, endpos - dir * len, 12, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,29 @@
EFFECT.MatBeam = Material( "effects/gunshiptracer" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 700 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos + dir * len, endpos - dir * len, 24, 1, 0, Color( 255, 255, 255, 255 ) )
end

View File

@@ -0,0 +1,141 @@
EFFECT.BeamMaterial = Material( "particle/smokesprites_0003" )
EFFECT.SmokeMaterials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.Pos = data:GetOrigin()
self.Radius = data:GetMagnitude()
self.SpawnTime = CurTime()
self:SetAngles( data:GetNormal():Angle() )
self:Debris()
self:Explosion()
end
function EFFECT:Debris()
local emitter = ParticleEmitter( self.Pos, false )
if not IsValid( emitter ) then return end
for i = 0,30 do
local particle = emitter:Add( "effects/fleck_tile"..math.random(1,2), self.Pos )
local vel = (self:GetRight() * math.Rand(-1,1) + self:GetForward() * math.Rand(-1,1) + self:GetUp() * math.Rand(-0.25,0.25)):GetNormalized() * self.Radius * 5
if particle then
particle:SetVelocity( vel )
particle:SetDieTime( 0.6 )
particle:SetAirResistance( 25 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 5 )
particle:SetEndSize( 5 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetRollDelta( math.Rand(-1,1) * 10 )
particle:SetColor( 0,0,0 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
particle:SetBounce( 0.3 )
end
end
emitter:Finish()
end
function EFFECT:Explosion()
local emitter = ParticleEmitter( self.Pos, false )
if not IsValid( emitter ) then return end
local scale = 0.1 + self.Radius / 1000
for i = 0,10 do
local particle = emitter:Add( self.SmokeMaterials[ math.random(1, #self.SmokeMaterials ) ], self.Pos )
if not particle then continue end
particle:SetVelocity( VectorRand() * 1500 * scale )
particle:SetDieTime( math.Rand(0.75,1.5) * scale )
particle:SetAirResistance( math.Rand(200,600) )
particle:SetStartAlpha( 255 )
particle:SetStartSize( math.Rand(60,120) * scale )
particle:SetEndSize( math.Rand(220,320) * scale )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 40,40,40 )
particle:SetGravity( Vector( 0, 0, 100 ) )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
if (self.SpawnTime + 0.15) < CurTime() then return false end
return true
end
function EFFECT:Render()
if not self.SpawnTime then return end
local pos = self:GetPos()
render.SetMaterial( self.BeamMaterial )
local segmentdist = 360 / 30
local overlap = 10
local Mul = math.Clamp(self.SpawnTime + 0.15 - CurTime(),0,0.15) / 0.15
do
local Width = self.Radius / 2
local Alpha = Mul * 255
local radius = self.Radius * 0.5 * ((1 - Mul) ^ 5)
local AngOffset = Mul * 360
if Alpha > 0 then
for a = segmentdist, 360, segmentdist do
local Ang = a + AngOffset
local StartPos = self:LocalToWorld( Vector( math.cos( math.rad( -Ang - overlap ) ) * radius, -math.sin( math.rad( -Ang - overlap ) ) * radius, 0 ) )
local EndPos = self:LocalToWorld( Vector( math.cos( math.rad( -Ang + overlap + segmentdist ) ) * radius, -math.sin( math.rad( -Ang + overlap + segmentdist ) ) * radius, 0 ) )
render.DrawBeam( StartPos, EndPos, Width, 0, 1, Color( 255, 255, 255, Alpha ) )
end
end
end
do
local Width = self.Radius / 2
local Alpha = Mul * 255
local radius = self.Radius * ((1 - Mul) ^ 5)
local AngOffset = Mul * 360
if Alpha > 0 then
for a = segmentdist, 360, segmentdist do
local Ang = a + AngOffset
local StartPos = self:LocalToWorld( Vector( math.cos( math.rad( -Ang - overlap ) ) * radius, -math.sin( math.rad( -Ang - overlap ) ) * radius, 0 ) )
local EndPos = self:LocalToWorld( Vector( math.cos( math.rad( -Ang + overlap + segmentdist ) ) * radius, -math.sin( math.rad( -Ang + overlap + segmentdist ) ) * radius, 0 ) )
render.DrawBeam( StartPos, EndPos, Width, 0, 1, Color( 255, 255, 255, Alpha ) )
end
end
end
end

View File

@@ -0,0 +1,85 @@
local LastImpact = 0
function EFFECT:Init( data )
self.Ent = data:GetEntity()
self.Pos = data:GetOrigin()
self.mat = Material( "sprites/light_glow02_add" )
local T = CurTime()
self.LifeTime = 0.2
self.DieTime = T + self.LifeTime
local DontHurtEars = math.Clamp( T - LastImpact, 0.4, 1 ) ^ 2
LastImpact = T
sound.Play( "lvs/shield_deflect.ogg", self.Pos, 120, 100, DontHurtEars )
self:Spark( self.Pos )
if IsValid( self.Ent ) then
self.Model = ClientsideModel( self.Ent:GetModel(), RENDERMODE_TRANSCOLOR )
self.Model:SetMaterial("models/alyx/emptool_glow")
self.Model:SetColor( Color(200,220,255,255) )
self.Model:SetParent( self.Ent, 0 )
self.Model:SetMoveType( MOVETYPE_NONE )
self.Model:SetLocalPos( Vector( 0, 0, 0 ) )
self.Model:SetLocalAngles( Angle( 0, 0, 0 ) )
self.Model:AddEffects( EF_BONEMERGE )
end
end
function EFFECT:Spark( pos )
local emitter = ParticleEmitter( pos, false )
for i = 0, 20 do
local particle = emitter:Add( "sprites/rico1", pos )
local vel = VectorRand() * 500
if not particle then continue end
particle:SetVelocity( vel )
particle:SetAngles( vel:Angle() + Angle(0,90,0) )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetStartAlpha( math.Rand( 200, 255 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(10,20) )
particle:SetEndSize( 0 )
particle:SetRoll( math.Rand(-100,100) )
particle:SetRollDelta( math.Rand(-100,100) )
particle:SetColor( 0, 127, 255 )
particle:SetAirResistance( 0 )
end
emitter:Finish()
end
function EFFECT:Think()
if not IsValid( self.Ent ) then
if IsValid( self.Model ) then
self.Model:Remove()
end
end
if self.DieTime < CurTime() then
if IsValid( self.Model ) then
self.Model:Remove()
end
return false
end
return true
end
function EFFECT:Render()
local Scale = (self.DieTime - CurTime()) / self.LifeTime
render.SetMaterial( self.mat )
render.DrawSprite( self.Pos, 800 * Scale, 800 * Scale, Color( 0, 127, 255, 255) )
render.DrawSprite( self.Pos, 200 * Scale, 200 * Scale, Color( 255, 255, 255, 255) )
end

View File

@@ -0,0 +1,90 @@
EFFECT.SmokeMat = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Ent = data:GetEntity()
if not IsValid( Ent ) then return end
local Offset = Ent:GetPos()
local Low, High = Ent:WorldSpaceAABB()
local Vel = Ent:GetVelocity()
local Radius = Ent:BoundingRadius()
local NumParticles = Radius
NumParticles = NumParticles * 4
NumParticles = math.Clamp( NumParticles, 32, 256 )
local emitter = ParticleEmitter( Offset )
for i = 0, NumParticles do
local Pos = Vector( math.Rand( Low.x, High.x ), math.Rand( Low.y, High.y ), math.Rand( Low.z, High.z ) )
local particle = emitter:Add( "effects/fleck_tile"..math.random(1,2), Pos )
if not particle then continue end
particle:SetVelocity( ( Pos - Offset ) * 5 + Vel * 0.5 )
particle:SetLifeTime( 0 )
particle:SetDieTime( math.Rand( 0.5, 1 ) )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand(3,6) * Radius * 0.025 )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand( 0, 360 ) )
particle:SetRollDelta( math.Rand(-10,10) )
particle:SetAirResistance( 25 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
particle:SetColor( 50, 50, 50 )
particle:SetBounce( 0.3 )
particle:SetLighting( true )
end
for i = 1, 2 do
local particle = emitter:Add( self.SmokeMat[ math.random(1,#self.SmokeMat) ] , Offset )
if not particle then continue end
particle:SetVelocity( VectorRand() * 100 * Radius + Vel * 0.5 )
particle:SetDieTime( math.Rand(0.2,0.6) )
particle:SetAirResistance( 200 * Radius )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 0.5 * Radius )
particle:SetEndSize( 2 * Radius )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( 255, 255, 255 )
particle:SetGravity( Vector(0,0,600) )
particle:SetCollide( false )
particle:SetLighting( true )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,202 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
self.emitter = ParticleEmitter( pos, false )
self.OldPos = pos
self.Dir = dir
if not self.emitter then return end
local VecCol = (render.GetLightColor( pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
for i = 0, 2 do
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], pos )
if not particle then continue end
particle:SetVelocity( dir * 700 + VectorRand() * 200 )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 5 )
particle:SetEndSize( 80 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,100) )
particle:SetCollide( false )
end
for i = 0, math.random(1,12) do
local particle = self.emitter:Add( "sprites/rico1", pos )
if not particle then continue end
particle:SetVelocity( dir * 2000 + VectorRand() * 50 )
particle:SetDieTime( math.Rand(0.1,0.2) )
particle:SetStartAlpha( 0 )
particle:SetEndAlpha( 5 )
particle:SetStartSize( math.Rand(0,0.5) )
particle:SetEndSize( math.Rand(0,0.5) )
particle:SetRollDelta( 100 )
particle:SetAirResistance( 0 )
particle:SetColor( 255, 200, 120 )
end
local trace = util.TraceLine( {
start = pos,
endpos = pos - Vector(0,0,500),
mask = MASK_SOLID_BRUSHONLY,
} )
if not trace or not trace.Hit then return end
local VecCol = (render.GetLightColor( trace.HitPos + trace.HitNormal ) * 0.8 + Vector(0.17,0.15,0.1)) * 255
for i = 1, 12 do
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], trace.HitPos )
if not particle then continue end
local ang = i * 30
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
particle:SetVelocity( Vector(X,Y,0) * 1000 )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 25 )
particle:SetEndSize( 80 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,150) + self.Dir * 1000 )
particle:SetCollide( false )
end
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local ViewEnt = ply:GetViewEntity()
if not IsValid( ViewEnt ) then return end
local Intensity = 2
local Ratio = math.min( 250 / (ViewEnt:GetPos() - trace.HitPos):Length(), 1 )
if Ratio < 0 then return end
util.ScreenShake( trace.HitPos, Intensity * Ratio, 0.1, 0.5, 250 )
end
function EFFECT:Think()
local bullet = LVS:GetBullet( self.ID )
if not bullet then
if self.emitter then
self.emitter:Finish()
end
local StartPos = self.OldPos
local EndPos = StartPos + self.Dir * 1000
local trace = util.TraceLine( {
start = StartPos,
endpos = EndPos,
} )
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Dir )
effectdata:SetEntity( trace.Entity )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetSurfaceProp( trace.SurfaceProps )
effectdata:SetMagnitude( 0.5 )
util.Effect( "lvs_bullet_impact_ap", effectdata )
return false
end
if not self.emitter then return true end
local Pos = bullet:GetPos()
self.Dir = bullet:GetDir()
local Sub = self.OldPos - Pos
local Dist = Sub:Length()
local Dir = Sub:GetNormalized()
local Vel = bullet.Velocity / 10
for i = 0, Dist, 100 do
local cur_pos = self.OldPos + Dir * i
local VecCol = (render.GetLightColor( cur_pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], cur_pos )
if not particle then continue end
particle:SetVelocity( -Dir * Vel + VectorRand() * 10 )
particle:SetDieTime( math.Rand(0.05,1) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 100 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 0 )
particle:SetEndSize( 15 )
particle:SetRollDelta( 1 )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetCollide( false )
end
self.OldPos = Pos
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 2000 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len * 0.1, 10, 1, 0, Color( 100, 100, 100, 100 ) )
render.DrawBeam( endpos - dir * len * 0.5, endpos + dir * len * 0.1, 5, 1, 0, Color( 255, 255, 255, 255 ) )
render.SetMaterial( self.MatSprite )
render.DrawSprite( endpos, 400, 400, Color( 100, 100, 100, 255 ) )
end

View File

@@ -0,0 +1,187 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
self.emitter = ParticleEmitter( pos, false )
self.OldPos = pos
self.Dir = dir
if not self.emitter then return end
local VecCol = (render.GetLightColor( pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
for i = 0,10 do
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], pos )
if not particle then continue end
particle:SetVelocity( dir * 700 + VectorRand() * 200 )
particle:SetDieTime( math.Rand(2,3) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 5 )
particle:SetEndSize( 120 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,100) )
particle:SetCollide( false )
end
local trace = util.TraceLine( {
start = pos,
endpos = pos - Vector(0,0,500),
mask = MASK_SOLID_BRUSHONLY,
} )
if not trace or not trace.Hit then return end
local VecCol = (render.GetLightColor( trace.HitPos + trace.HitNormal ) * 0.8 + Vector(0.17,0.15,0.1)) * 255
for i = 1,24 do
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], trace.HitPos )
if not particle then continue end
local ang = i * 15
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
particle:SetVelocity( Vector(X,Y,0) * 2000 )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( 500 )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 25 )
particle:SetEndSize( 120 )
particle:SetRollDelta( math.Rand(-1,1) )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetGravity( Vector(0,0,150) + self.Dir * 2000 )
particle:SetCollide( false )
end
local ply = LocalPlayer()
if not IsValid( ply ) then return end
local ViewEnt = ply:GetViewEntity()
if not IsValid( ViewEnt ) then return end
local Intensity = 8
local Ratio = math.min( 250 / (ViewEnt:GetPos() - trace.HitPos):Length(), 1 )
if Ratio < 0 then return end
util.ScreenShake( trace.HitPos, Intensity * Ratio, 0.1, 0.5, 250 )
end
function EFFECT:Think()
local bullet = LVS:GetBullet( self.ID )
if not bullet then
if self.emitter then
self.emitter:Finish()
end
local StartPos = self.OldPos
local EndPos = StartPos + self.Dir * 1000
local trace = util.TraceLine( {
start = StartPos,
endpos = EndPos,
} )
if not trace.Hit then return false end
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Dir )
effectdata:SetEntity( trace.Entity )
effectdata:SetNormal( trace.HitNormal )
effectdata:SetSurfaceProp( trace.SurfaceProps )
effectdata:SetMagnitude( 1 )
util.Effect( "lvs_bullet_impact_ap", effectdata )
return false
end
if not self.emitter then return true end
local Pos = bullet:GetPos()
self.Dir = bullet:GetDir()
local Sub = self.OldPos - Pos
local Dist = Sub:Length()
local Dir = Sub:GetNormalized()
local Vel = bullet.Velocity / 10
for i = 0, Dist, 25 do
local cur_pos = self.OldPos + Dir * i
local VecCol = (render.GetLightColor( cur_pos ) * 0.8 + Vector(0.2,0.2,0.2)) * 255
local particle = self.emitter:Add( self.MatSmoke[math.random(1,#self.MatSmoke)], cur_pos )
if not particle then continue end
particle:SetVelocity( -Dir * Vel + VectorRand() * 10 )
particle:SetDieTime( math.Rand(0.05,1) )
particle:SetAirResistance( 250 )
particle:SetStartAlpha( 100 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 0 )
particle:SetEndSize( 30 )
particle:SetRollDelta( 1 )
particle:SetColor( math.min( VecCol.r, 255 ), math.min( VecCol.g, 255 ), math.min( VecCol.b, 255 ) )
particle:SetCollide( false )
end
self.OldPos = Pos
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 3000 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len * 0.1, 32, 1, 0, Color( 100, 100, 100, 100 ) )
render.DrawBeam( endpos - dir * len * 0.5, endpos + dir * len * 0.1, 16, 1, 0, Color( 255, 255, 255, 255 ) )
render.SetMaterial( self.MatSprite )
render.DrawSprite( endpos, 250, 250, Color( 100, 100, 100, 255 ) )
end

View File

@@ -0,0 +1,30 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1600 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 3, 1, 0, Color( 225, 255, 225, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 10, 1, 0, Color( 150, 200, 150, 255 ) )
end

View File

@@ -0,0 +1,128 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
EFFECT.MatSprite = Material( "sprites/light_glow02_add" )
EFFECT.MatSmoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
self.emitter = ParticleEmitter( pos, false )
self.OldPos = pos
self.Dir = dir
end
function EFFECT:doFX( pos, curpos )
if not IsValid( self.emitter ) then return end
local particle = self.emitter:Add( self.MatSmoke[ math.random(1, #self.MatSmoke ) ], pos )
if particle then
particle:SetGravity( Vector(0,0,100) + VectorRand() * 50 )
particle:SetVelocity( -self.Dir * 200 )
particle:SetAirResistance( 600 )
particle:SetDieTime( math.Rand(1.5,2) )
particle:SetStartAlpha( 50 )
particle:SetStartSize( 20 )
particle:SetEndSize( 60 )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor(40,40,40)
particle:SetCollide( false )
end
local particle = self.emitter:Add( "particles/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( -self.Dir * math.Rand(250,800) + self.Dir * 1500 )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 8 )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
local particle = self.emitter:Add( "particles/flamelet"..math.random(1,5), curpos )
if particle then
particle:SetVelocity( -self.Dir * 200 + VectorRand() * 50 )
particle:SetDieTime( 0.25 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 6 )
particle:SetEndSize( 2 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 255,255,255 )
particle:SetGravity( Vector( 0, 0, 0 ) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then
if self.emitter then
self.emitter:Finish()
end
return false
end
if not self.emitter then return true end
local T = CurTime()
if (self.nextDFX or 0) <= T then
self.nextDFX = T + 0.02
local bullet = LVS:GetBullet( self.ID )
local Pos = bullet:GetPos()
local Sub = self.OldPos - Pos
local Dist = Sub:Length()
local Dir = Sub:GetNormalized()
for i = 0, Dist, 45 do
local cur_pos = self.OldPos + Dir * i
self:doFX( cur_pos, Pos )
end
self.OldPos = Pos
end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local pos = bullet:GetPos()
render.SetMaterial( self.MatSprite )
render.DrawSprite( pos, 100, 100, Color( 255, 200, 150, 255 ) )
end

View File

@@ -0,0 +1,30 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1600 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 3, 1, 0, Color( 255, 255, 0, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 10, 1, 0, Color( 125, 50, 0, 255 ) )
end

View File

@@ -0,0 +1,104 @@
EFFECT.GlowColor = Color( 0, 127, 255, 255 )
EFFECT.GlowMat = Material( "sprites/light_glow02_add" )
EFFECT.MatSprite = Material( "effects/select_ring" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
self.emitter = ParticleEmitter( pos, false )
self.OldPos = pos
self.Dir = dir
end
function EFFECT:doFX( pos, curpos )
if not IsValid( self.emitter ) then return end
local particle = self.emitter:Add( "particles/flamelet"..math.random(1,5), pos )
if particle then
particle:SetVelocity( -self.Dir * math.Rand(250,800) + self.Dir * 5000 )
particle:SetDieTime( math.Rand(0.2,0.4) )
particle:SetAirResistance( 0 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 8 )
particle:SetEndSize( 1 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,255 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
local particle = self.emitter:Add( "particles/flamelet"..math.random(1,5), curpos )
if particle then
particle:SetVelocity( self.Dir * 5000 + VectorRand() * 50 )
particle:SetDieTime( 1 )
particle:SetAirResistance( 600 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 6 )
particle:SetEndSize( 2 )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 0,0,255 )
particle:SetGravity( Vector( 0, 0, 600 ) )
particle:SetCollide( false )
end
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then
if self.emitter then
self.emitter:Finish()
end
return false
end
if not self.emitter then return true end
local T = CurTime()
if (self.nextDFX or 0) <= T then
self.nextDFX = T + 0.02
local bullet = LVS:GetBullet( self.ID )
local Pos = bullet:GetPos()
local Sub = self.OldPos - Pos
local Dist = Sub:Length()
local Dir = Sub:GetNormalized()
for i = 0, Dist, 45 do
local cur_pos = self.OldPos + Dir * i
self:doFX( cur_pos, Pos )
end
self.OldPos = Pos
end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local pos = bullet:GetPos()
render.SetMaterial( self.MatSprite )
render.DrawSprite( pos, 100, 100, Color( 0, 127, 255, 50 ) )
render.SetMaterial( self.GlowMat )
for i = 0, 30 do
local Size = ((30 - i) / 30) ^ 2 * 128
render.DrawSprite( pos - self.Dir * i * 7, Size, Size, self.GlowColor )
end
end

View File

@@ -0,0 +1,30 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1600 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 3, 1, 0, Color( 255, 255, 255, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 10, 1, 0, Color( 150, 150, 150, 255 ) )
end

View File

@@ -0,0 +1,30 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 1600 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 3, 1, 0, Color( 255, 255, 125, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 10, 1, 0, Color( 125, 80, 0, 255 ) )
end

View File

@@ -0,0 +1,30 @@
EFFECT.MatBeam = Material( "effects/lvs_base/spark" )
function EFFECT:Init( data )
local pos = data:GetOrigin()
local dir = data:GetNormal()
self.ID = data:GetMaterialIndex()
self:SetRenderBoundsWS( pos, pos + dir * 50000 )
end
function EFFECT:Think()
if not LVS:GetBullet( self.ID ) then return false end
return true
end
function EFFECT:Render()
local bullet = LVS:GetBullet( self.ID )
local endpos = bullet:GetPos()
local dir = bullet:GetDir()
local len = 500 * bullet:GetLength()
render.SetMaterial( self.MatBeam )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 4, 1, 0, Color( 255, 255, 125, 255 ) )
render.DrawBeam( endpos - dir * len, endpos + dir * len, 8, 1, 0, Color( 125, 80, 0, 255 ) )
end

View File

@@ -0,0 +1,81 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local effectdata = EffectData()
effectdata:SetOrigin( pos )
util.Effect( "cball_explode", effectdata, true, true )
local effectdata = EffectData()
effectdata:SetOrigin( pos )
effectdata:SetNormal( Vector(0,0,1) )
util.Effect( "manhacksparks", effectdata, true, true )
local emitter = ParticleEmitter( pos, false )
for i = 0,30 do
local particle = emitter:Add( "effects/fleck_tile"..math.random(1,2), pos )
local vel = VectorRand() * math.Rand(150,200)
vel.z = math.Rand(200,250)
if not particle then continue end
particle:SetVelocity( vel )
particle:SetDieTime( math.Rand(2,6) )
particle:SetAirResistance( 10 )
particle:SetStartAlpha( 255 )
particle:SetStartSize( 2 )
particle:SetEndSize( 2 )
particle:SetRoll( math.Rand(-1,1) * math.pi )
particle:SetColor( 0,0,0 )
particle:SetGravity( Vector( 0, 0, -600 ) )
particle:SetCollide( true )
particle:SetBounce( 0.3 )
end
for i = 0,4 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], pos )
local vel = VectorRand() * 200
if particle then
particle:SetVelocity( vel )
particle:SetDieTime( math.Rand(2.5,5) )
particle:SetAirResistance( 100 )
particle:SetStartAlpha( 200 )
particle:SetStartSize( 50 )
particle:SetEndSize( 200 )
particle:SetRoll( math.Rand(-5,5) )
particle:SetColor( 10,10,10 )
particle:SetGravity( Vector(0,0,20) )
particle:SetCollide( false )
end
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,84 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local Pos = data:GetOrigin()
local Dir = data:GetNormal()
local Ent = data:GetEntity()
if not IsValid( Ent ) or not isfunction( Ent.GetThrottle ) then return end
local Engine = Ent:GetEngine()
if not IsValid( Engine ) or not isfunction( Engine.GetRPM ) then return end
local Vel = Ent:GetVelocity()
local emitter = Ent:GetParticleEmitter( Pos )
if not IsValid( emitter ) then return end
local throttle = math.min( Ent:GetThrottle() / 0.5, 1 )
local clutch = Ent:GetQuickVar( "clutch" )
local hasClutch = Ent:HasQuickVar( "clutch" )
local ClutchActive = Engine:GetClutch()
if not clutch then
clutch = ClutchActive and 1 or 0
end
if ClutchActive then
throttle = math.max( throttle - clutch, 0 )
end
local Scale = math.min( (math.max( Engine:GetRPM() - Ent.EngineIdleRPM, 0 ) / (Ent.EngineMaxRPM - Ent.EngineIdleRPM)) * (throttle ^ 2), 1 )
local temp = 0
if Ent:HasQuickVar("temp") then
temp = math.Clamp( 1 - Ent:GetQuickVar( "temp" ) / 0.5, 0, 1 )
end
local Col = 50 + 205 * temp
Col = Col - (Scale * Col)
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ], Pos )
if not particle then return end
local invert = (1 - Dir.z) / 2
particle:SetVelocity( Vel + Dir * (100 + math.min( 800 * Scale, 300)) + VectorRand() * 50 * Scale + (Ent:GetVelocity() * 0.5 + Vector(0,0,Scale * 100)) * invert )
particle:SetDieTime( math.max((1.4 - temp) - Ent:GetVelocity():LengthSqr() * 0.0001,0.2) + Scale * math.Rand(0.8,1.2) )
particle:SetAirResistance( 400 )
particle:SetStartAlpha( 100 - 50 * temp + Scale * 150 )
particle:SetStartSize( 2 + (throttle + Scale) * 4 )
particle:SetEndSize( 10 + 35 * (throttle + Scale) )
particle:SetRoll( math.Rand( -1, 1 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) * (2 - Scale * 1.75) )
particle:SetColor( Col, Col, Col )
particle:SetGravity( Vector( 0, 0, 10 + Scale * 300 ) + Ent:GetVelocity() * 4 )
particle:SetCollide( true )
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,43 @@
function EFFECT:Init( data )
self.Ent = data:GetEntity()
self.Pos = data:GetOrigin()
local T = CurTime()
self.LifeTime = 1
self.DieTime = T + self.LifeTime
if IsValid( self.Ent ) then
self.Model = ClientsideModel( self.Ent:GetModel(), RENDERMODE_TRANSCOLOR )
self.Model:SetMaterial("models/alyx/emptool_glow")
self.Model:SetColor( Color(0,127,255,255) )
self.Model:SetParent( self.Ent, 0 )
self.Model:SetMoveType( MOVETYPE_NONE )
self.Model:SetLocalPos( Vector( 0, 0, 0 ) )
self.Model:SetLocalAngles( Angle( 0, 0, 0 ) )
self.Model:AddEffects( EF_BONEMERGE )
self.Model:SetModelScale( self.Ent:GetModelScale() )
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then
if IsValid( self.Model ) then
self.Model:Remove()
end
end
if self.DieTime < CurTime() then
if IsValid( self.Model ) then
self.Model:Remove()
end
return false
end
return true
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,43 @@
function EFFECT:Init( data )
self.Ent = data:GetEntity()
self.Pos = data:GetOrigin()
local T = CurTime()
self.LifeTime = 1
self.DieTime = T + self.LifeTime
if IsValid( self.Ent ) then
self.Model = ClientsideModel( self.Ent:GetModel(), RENDERMODE_TRANSCOLOR )
self.Model:SetMaterial("models/alyx/emptool_glow")
self.Model:SetColor( Color(255,200,50,255) )
self.Model:SetParent( self.Ent, 0 )
self.Model:SetMoveType( MOVETYPE_NONE )
self.Model:SetLocalPos( Vector( 0, 0, 0 ) )
self.Model:SetLocalAngles( Angle( 0, 0, 0 ) )
self.Model:AddEffects( EF_BONEMERGE )
self.Model:SetModelScale( self.Ent:GetModelScale() )
end
end
function EFFECT:Think()
if not IsValid( self.Ent ) then
if IsValid( self.Model ) then
self.Model:Remove()
end
end
if self.DieTime < CurTime() then
if IsValid( self.Model ) then
self.Model:Remove()
end
return false
end
return true
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,54 @@
local Materials = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
local pos = data:GetOrigin()
local emitter = ParticleEmitter( pos, false )
for i = 1,12 do
local particle = emitter:Add( Materials[ math.random(1, #Materials ) ],pos )
if not particle then continue end
local ang = i * 30
local X = math.cos( math.rad(ang) )
local Y = math.sin( math.rad(ang) )
particle:SetVelocity( Vector(X,Y,0) * math.Rand(3000,4000) )
particle:SetDieTime( math.Rand(0.5,1) )
particle:SetAirResistance( math.Rand(3000,5000) )
particle:SetStartAlpha( 100 )
particle:SetStartSize( 20 )
particle:SetEndSize( math.Rand(30,40) )
particle:SetRoll( math.Rand(-1,1) )
particle:SetColor( 60,60,60 )
particle:SetGravity( VectorRand() * 200 + Vector(0,0,1000) )
particle:SetCollide( false )
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,63 @@
local MuzzleFX = Material("sprites/strider_blackball")
local BeamFX = Material("sprites/bluelaser1")
local WarpFX = Material("particle/warp5_warp")
function EFFECT:Init( data )
self.Ent = data:GetEntity()
if not IsValid( self.Ent ) then return end
self.LifeTime = 2
self.DieTime = CurTime() + self.LifeTime
self.Ent:EmitSound( "NPC_Strider.Charge" )
self:SetRenderBoundsWS( self.Ent:GetPos(), self.Ent:GetPos() - self.Ent:GetUp() * 50000 )
end
function EFFECT:Think()
if (self.DieTime or 0) < CurTime() then return false end
return true
end
function EFFECT:Render()
if not IsValid( self.Ent ) then return end
local Muzzle = self.Ent:GetAttachment( self.Ent:LookupAttachment( "bellygun" ) )
if not Muzzle then return end
local T = CurTime()
local Delta = ((T + self.LifeTime) - self.DieTime) / self.LifeTime
local trace = util.TraceLine( {
start = Muzzle.Pos,
endpos = Muzzle.Pos + self.Ent:GetAimVector() * 50000,
mask = MASK_SOLID_BRUSHONLY
} )
self:SetRenderBoundsWS( Muzzle.Pos, trace.HitPos )
render.SetMaterial( MuzzleFX )
render.DrawSprite( Muzzle.Pos, Delta * 32, Delta * 32, Color( 255, 255, 255, Delta * 255) )
render.SetMaterial( BeamFX )
render.DrawBeam( Muzzle.Pos, trace.HitPos, (Delta ^ 2) * 64, 0, 1, Color( 255, 255, 255 ) )
render.SetMaterial( WarpFX )
render.DrawSprite( Muzzle.Pos, (Delta ^ 2) * 256, (Delta ^ 2) * 256, Color( 255, 255, 255, 100) )
local dlight = DynamicLight( self:EntIndex() * 1337 )
if dlight then
dlight.pos = Muzzle.Pos
dlight.r = 0
dlight.g = 255
dlight.b = 255
dlight.brightness = Delta * 10
dlight.Decay = 100
dlight.Size = 128
dlight.DieTime = CurTime() + 0.2
end
end

View File

@@ -0,0 +1,76 @@
local MuzzleFX = Material("sprites/strider_blackball")
local BeamFX = Material("sprites/bluelaser1")
local WarpFX = Material("particle/warp5_warp")
function EFFECT:Init( data )
self.Ent = data:GetEntity()
if not IsValid( self.Ent ) then return end
self.LifeTime = 0.2
self.DieTime = CurTime() + self.LifeTime
self.Ent:EmitSound( "NPC_Strider.Shoot" )
self:SetRenderBoundsWS( self.Ent:GetPos(), self.Ent:GetPos() - self.Ent:GetUp() * 50000 )
end
function EFFECT:Think()
if (self.DieTime or 0) < CurTime() then
self:DoImpactEffect()
return false
end
return true
end
function EFFECT:DoImpactEffect()
if not IsValid( self.Ent ) then return end
local Muzzle = self.Ent:GetAttachment( self.Ent:LookupAttachment( "bellygun" ) )
if not Muzzle then return end
local trace = util.TraceLine( {
start = Muzzle.Pos,
endpos = Muzzle.Pos + self.Ent:GetAimVector() * 50000,
mask = MASK_SOLID_BRUSHONLY
} )
local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos + trace.HitNormal )
effectdata:SetRadius( 256 )
effectdata:SetNormal( trace.HitNormal )
util.Effect( "AR2Explosion", effectdata, true, true )
end
function EFFECT:Render()
if not IsValid( self.Ent ) then return end
local Muzzle = self.Ent:GetAttachment( self.Ent:LookupAttachment( "bellygun" ) )
if not Muzzle then return end
local T = CurTime()
local Delta = ((T + self.LifeTime) - self.DieTime) / self.LifeTime
local trace = util.TraceLine( {
start = Muzzle.Pos,
endpos = Muzzle.Pos + self.Ent:GetAimVector() * 50000,
mask = MASK_SOLID_BRUSHONLY
} )
self:SetRenderBoundsWS( Muzzle.Pos, trace.HitPos )
render.SetMaterial( BeamFX )
render.DrawBeam( Muzzle.Pos, trace.HitPos, (Delta ^ 2) * 64, 0, 1, Color( 255, 255, 255 ) )
local Sub = trace.HitPos - Muzzle.Pos
local Dir = Sub:GetNormalized()
local Dist = Sub:Length()
local Scale = 512 - Delta * 512
render.SetMaterial( WarpFX )
render.DrawSprite( Muzzle.Pos + Dir * Dist * Delta, Scale, Scale, Color( 255, 255, 255, 255) )
end