add sborka
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
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: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
|
||||
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
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
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
|
||||
|
||||
|
||||
local trace = util.TraceLine( {
|
||||
start = pos,
|
||||
endpos = pos - Vector(0,0,500),
|
||||
mask = MASK_SOLID_BRUSHONLY,
|
||||
} )
|
||||
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if not IsValid( ply ) then return end
|
||||
|
||||
local ViewEnt = ply:GetViewEntity()
|
||||
|
||||
if not IsValid( ViewEnt ) then return end
|
||||
|
||||
local Intensity = ply:InVehicle() and 5 or 50
|
||||
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
|
||||
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 )
|
||||
util.Effect( "lvs_bullet_impact_ap", effectdata )
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if not self.emitter then return true end
|
||||
|
||||
local bullet = LVS:GetBullet( self.ID )
|
||||
|
||||
local Pos = bullet:GetPos()
|
||||
|
||||
local Sub = self.OldPos - Pos
|
||||
local Dist = Sub:Length()
|
||||
local Dir = Sub:GetNormalized()
|
||||
|
||||
|
||||
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
|
||||
35
garrysmod/addons/swbombs/lua/effects/lvs_tracer_red.lua
Normal file
35
garrysmod/addons/swbombs/lua/effects/lvs_tracer_red.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
EFFECT.MatBeam = Material( "effects/lvs_base/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 = 3000 * bullet:GetLength()
|
||||
|
||||
render.SetMaterial( self.MatBeam )
|
||||
|
||||
render.DrawBeam( endpos - dir * len, endpos + dir * len * 0.1, 10, 1, 0, Color( 255, 0, 0, 255 ) )
|
||||
render.DrawBeam( endpos - dir * len * 0.5, endpos + dir * len * 0.1, 5, 1, 0, Color( 255, 0, 0, 255 ) )
|
||||
|
||||
render.SetMaterial( self.MatSprite )
|
||||
render.DrawSprite( endpos, 400, 400, Color( 125, 0, 0, 255 ) )
|
||||
end
|
||||
@@ -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( 200 )
|
||||
particle:SetEndSize( 400 )
|
||||
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
|
||||
@@ -0,0 +1,53 @@
|
||||
--DO NOT EDIT OR REUPLOAD THIS FILE
|
||||
|
||||
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() * 1
|
||||
|
||||
local emitter = ParticleEmitter( Pos, false )
|
||||
|
||||
if emitter then
|
||||
local particle = emitter:Add( Materials[math.Round(math.Rand(1,table.Count( Materials )),0)], Pos )
|
||||
|
||||
if particle then
|
||||
particle:SetVelocity( VectorRand() * 100 )
|
||||
particle:SetDieTime( math.random(10,15) )
|
||||
particle:SetAirResistance( 200 )
|
||||
particle:SetStartAlpha( 155 )
|
||||
particle:SetStartSize( 10 )
|
||||
particle:SetEndAlpha( 50 )
|
||||
particle:SetEndSize( math.Rand(250,300) )
|
||||
particle:SetRoll( math.Rand(-1,1) * 100 )
|
||||
particle:SetColor( data:GetColor() )
|
||||
particle:SetGravity( Vector( 0, 0, 500 ) )
|
||||
particle:SetCollide( false )
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
57
garrysmod/addons/swbombs/lua/effects/sw_torpedo_v3.lua
Normal file
57
garrysmod/addons/swbombs/lua/effects/sw_torpedo_v3.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
function EFFECT:Init( data )
|
||||
local Pos = data:GetOrigin()
|
||||
local Ent = data:GetEntity()
|
||||
|
||||
if not IsValid( Ent ) then return end
|
||||
|
||||
self.LifeTime = math.Rand(2,4)
|
||||
self.DieTime = CurTime() + self.LifeTime
|
||||
|
||||
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( 25 )
|
||||
particle:SetEndSize( 50 )
|
||||
particle:SetRoll( math.Rand(-1,1) * 100 )
|
||||
particle:SetColor( 255,255,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 self.Splash and self.LifeTime then
|
||||
local Scale = (self.DieTime - self.LifeTime - CurTime()) / self.LifeTime
|
||||
local S = 100 - Scale * 200
|
||||
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( 255, 255, 255 , Alpha )
|
||||
surface.DrawTexturedRectRotated( 0, 0, S , S, self.Splash.RandomAng )
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user