add sborka
This commit is contained in:
75
garrysmod/addons/tacrp/lua/effects/tacrp_chargesmoke.lua
Normal file
75
garrysmod/addons/tacrp/lua/effects/tacrp_chargesmoke.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
function EFFECT:Init(data)
|
||||
if CurTime() < 1 then self:Remove() return end
|
||||
|
||||
self.TrailEnt = data:GetEntity()
|
||||
if !IsValid(self.TrailEnt) then self:Remove() return end
|
||||
|
||||
local pos = data:GetOrigin() + Vector(0, 0, 4)
|
||||
local dir = data:GetNormal()
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
local amt = 24
|
||||
|
||||
for i = 1, amt do
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * math.Rand(-300, -100) + VectorRand() * 256 + Vector(0, 0, math.Rand(100, 300)))
|
||||
smoke:SetGravity(Vector(0, 0, -300))
|
||||
smoke:SetStartAlpha(75)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(math.Rand(8, 12))
|
||||
smoke:SetEndSize(math.Rand(48, 64))
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(200)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(math.Rand(0.9, 1.25))
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if !IsValid(self.TrailEnt) or (self.TrailEnt:IsPlayer() and !self.TrailEnt:Alive()) or !self.TrailEnt:GetNWBool("TacRPChargeState") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
--if self.TrailEnt:IsOnGround() then
|
||||
local pos = self.TrailEnt:GetPos() + Vector(math.Rand(-8, 8), math.Rand(-8, 8), 4)
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
if self.TrailEnt:IsOnGround() then
|
||||
smoke:SetVelocity(self.TrailEnt:GetVelocity() * 0.2 + VectorRand() * 32 + Vector(0, 0, math.Rand(32, 64)))
|
||||
smoke:SetGravity(Vector(0, 0, -128))
|
||||
|
||||
smoke:SetStartSize(math.Rand(8, 12))
|
||||
smoke:SetEndSize(math.Rand(48, 64))
|
||||
smoke:SetDieTime(math.Rand(0.8, 1))
|
||||
else
|
||||
smoke:SetPos(pos + Vector(0, 0, 16))
|
||||
smoke:SetVelocity(VectorRand() * 32)
|
||||
smoke:SetGravity(Vector(0, 0, -128))
|
||||
smoke:SetStartSize(16)
|
||||
smoke:SetEndSize(32)
|
||||
smoke:SetDieTime(math.Rand(0.4, 0.6))
|
||||
end
|
||||
|
||||
smoke:SetStartAlpha(25)
|
||||
smoke:SetEndAlpha(0)
|
||||
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(25)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
|
||||
emitter:Finish()
|
||||
--end
|
||||
end
|
||||
66
garrysmod/addons/tacrp/lua/effects/tacrp_confetti.lua
Normal file
66
garrysmod/addons/tacrp/lua/effects/tacrp_confetti.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
function EFFECT:Init( data )
|
||||
|
||||
local vOffset = data:GetOrigin()
|
||||
local dir = data:GetAngles()
|
||||
local velocity = data:GetMagnitude()
|
||||
local spread = data:GetScale()
|
||||
|
||||
// sound.Play( "tacrp/kids_cheering.mp3", vOffset, 80, 100 )
|
||||
|
||||
local NumParticles = 100
|
||||
|
||||
local emitter = ParticleEmitter( vOffset, true )
|
||||
|
||||
local forward, up, right = dir:Forward(), dir:Up(), dir:Right()
|
||||
|
||||
for i = 0, NumParticles do
|
||||
|
||||
local oDir = Angle(dir)
|
||||
local a = math.Rand(0, 360)
|
||||
local angleRand = Angle(math.sin(a), math.cos(a), 0)
|
||||
angleRand:Mul(spread * math.Rand(0, 45) * 1.4142135623730)
|
||||
|
||||
oDir:RotateAroundAxis(right, angleRand.p)
|
||||
oDir:RotateAroundAxis(up, angleRand.y)
|
||||
oDir:RotateAroundAxis(forward, angleRand.r)
|
||||
|
||||
local particle = emitter:Add( "particles/balloon_bit", vOffset + VectorRand(spread) )
|
||||
if ( particle ) then
|
||||
|
||||
particle:SetVelocity( oDir:Forward() * math.Rand(0.5, 1) * velocity)
|
||||
|
||||
particle:SetLifeTime( 0 )
|
||||
particle:SetDieTime( 10 )
|
||||
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 255 )
|
||||
|
||||
local Size = math.Rand( 1.5, 3 )
|
||||
particle:SetStartSize( Size )
|
||||
particle:SetEndSize( 0 )
|
||||
|
||||
particle:SetRoll( math.Rand( 0, 360 ) )
|
||||
particle:SetRollDelta( math.Rand( -2, 2 ) )
|
||||
|
||||
particle:SetAirResistance( 50 )
|
||||
particle:SetGravity( Vector( 0, 0, -75 ) )
|
||||
|
||||
particle:SetColor( math.Rand(50, 255), math.Rand(50, 255), math.Rand(50, 255) )
|
||||
|
||||
particle:SetCollide( true )
|
||||
|
||||
particle:SetAngleVelocity( Angle( math.Rand( -160, 160 ), math.Rand( -160, 160 ), math.Rand( -160, 160 ) ) )
|
||||
|
||||
particle:SetBounce( 0.7 )
|
||||
particle:SetLighting( true )
|
||||
end
|
||||
end
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
84
garrysmod/addons/tacrp/lua/effects/tacrp_dashsmoke.lua
Normal file
84
garrysmod/addons/tacrp/lua/effects/tacrp_dashsmoke.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
function EFFECT:Init(data)
|
||||
if CurTime() < 1 then self:Remove() return end
|
||||
|
||||
local pos = data:GetOrigin()
|
||||
local dir = data:GetNormal()
|
||||
|
||||
self.EndTime = CurTime() + 0.25
|
||||
self.TrailEnt = data:GetEntity()
|
||||
if !IsValid(self.TrailEnt) then self:Remove() return end
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
local amt = 16
|
||||
|
||||
if IsValid(self.TrailEnt) and self.TrailEnt:IsOnGround() then
|
||||
pos = pos + Vector(0, 0, 2)
|
||||
|
||||
for i = 1, amt do
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * -200 + VectorRand() * 128 + Vector(0, 0, math.Rand(50, 100)))
|
||||
smoke:SetStartAlpha(200)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(24)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.5)
|
||||
end
|
||||
else
|
||||
for i = 1, amt do
|
||||
local _, a = LocalToWorld(Vector(), Angle((i / amt) * 360, 90, 0), pos, dir:Angle())
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * -50 + 150 * a:Up())
|
||||
smoke:SetStartAlpha(200)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(24)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.5)
|
||||
end
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if CurTime() > self.EndTime or !IsValid(self.TrailEnt) or (self.TrailEnt:IsPlayer() and !self.TrailEnt:Alive()) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
local pos = self.TrailEnt:GetPos() + Vector( 0, 0, 1 )
|
||||
local emitter = ParticleEmitter(pos)
|
||||
local d = math.Clamp((self.EndTime - CurTime()) / 0.15, 0, 1) ^ 2
|
||||
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(VectorRand() * 4)
|
||||
smoke:SetStartAlpha(d * 150)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(4)
|
||||
smoke:SetEndSize(24)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(15)
|
||||
smoke:SetCollide(false)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.25)
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
78
garrysmod/addons/tacrp/lua/effects/tacrp_divesmoke.lua
Normal file
78
garrysmod/addons/tacrp/lua/effects/tacrp_divesmoke.lua
Normal file
@@ -0,0 +1,78 @@
|
||||
function EFFECT:Init(data)
|
||||
if CurTime() < 1 then self:Remove() return end
|
||||
|
||||
local pos = data:GetOrigin()
|
||||
local dir = data:GetNormal()
|
||||
|
||||
self.EndTime = CurTime() + 0.2
|
||||
self.TrailEnt = data:GetEntity()
|
||||
if !IsValid(self.TrailEnt) then self:Remove() return end
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
|
||||
local tr = util.TraceLine({
|
||||
start = pos,
|
||||
endpos = pos - Vector(0, 0, 2048),
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
pos = pos - dir * 32
|
||||
local amt = 12 + math.ceil(tr.Fraction / 20)
|
||||
|
||||
for i = 1, amt do
|
||||
local _, a = LocalToWorld(Vector(), Angle((i / amt) * 360, 90, 0), pos, dir:Angle())
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * -(150 + tr.Fraction * 100) + (300 - tr.Fraction * 100) * a:Up())
|
||||
smoke:SetStartAlpha(20 + tr.Fraction * 50)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(24 + tr.Fraction * 16)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(50)
|
||||
smoke:SetCollide(false)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetDieTime(0.15 + tr.Fraction * 0.6)
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if CurTime() > self.EndTime or !IsValid(self.TrailEnt) or (self.TrailEnt:IsPlayer() and !self.TrailEnt:Alive()) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
if self.TrailEnt:IsOnGround() then
|
||||
local pos = self.TrailEnt:GetPos() + Vector(math.Rand(-8, 8), math.Rand(-8, 8), 4)
|
||||
local dir = self.TrailEnt:GetVelocity():GetNormalized()
|
||||
local vel = self.TrailEnt:GetVelocity():Length()
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
|
||||
if engine.TickCount() % 2 == 0 then
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(VectorRand() * (50 + math.min(vel, 500) * 0.25) + dir * math.min(vel, 500) + Vector(0, 0, 200 - math.min(vel, 200)))
|
||||
smoke:SetGravity(Vector(0, 0, -400))
|
||||
smoke:SetStartAlpha(50)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(4)
|
||||
smoke:SetEndSize(32)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(25)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(math.Rand(0.75, 1))
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
end
|
||||
92
garrysmod/addons/tacrp/lua/effects/tacrp_flare_explode.lua
Normal file
92
garrysmod/addons/tacrp/lua/effects/tacrp_flare_explode.lua
Normal file
@@ -0,0 +1,92 @@
|
||||
EFFECT.Model = "models/Items/AR2_Grenade.mdl"
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self:SetModel(self.Model)
|
||||
local emitter = ParticleEmitter(data:GetOrigin())
|
||||
if not IsValid(emitter) then return end
|
||||
for i = 1, 5 do
|
||||
local smoke = emitter:Add("particle/smokestack", data:GetOrigin())
|
||||
smoke:SetVelocity(VectorRand() * 100)
|
||||
smoke:SetGravity(Vector(math.Rand(-5, 5), math.Rand(-5, 5), 70))
|
||||
smoke:SetDieTime(math.Rand(5, 7))
|
||||
smoke:SetStartAlpha(40)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(math.Rand(20, 40))
|
||||
smoke:SetEndSize(60)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
smoke:SetColor(175, 175, 175)
|
||||
smoke:SetAirResistance(120)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetBounce(0.5)
|
||||
smoke:SetCollide(true)
|
||||
end
|
||||
|
||||
for i = 1, 5 do
|
||||
local smoke = emitter:Add("particle/smokestack", data:GetOrigin())
|
||||
smoke:SetVelocity(VectorRand() * 800)
|
||||
smoke:SetGravity(Vector(math.Rand(-25, 25), math.Rand(-25, 25), -500))
|
||||
smoke:SetDieTime(math.Rand(0.6, 1))
|
||||
smoke:SetStartAlpha(100)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(80)
|
||||
smoke:SetEndSize(250)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
smoke:SetColor(100, 100, 100)
|
||||
smoke:SetAirResistance(300)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetBounce(0.5)
|
||||
smoke:SetCollide(true)
|
||||
end
|
||||
|
||||
for i = 1, 5 do
|
||||
local fire = emitter:Add("effects/fire_cloud" .. math.random(1, 2), data:GetOrigin())
|
||||
fire:SetVelocity(VectorRand() * 1200 - Vector(0, 0, 100))
|
||||
fire:SetGravity(Vector(0, 0, 0))
|
||||
fire:SetDieTime(math.Rand(0.1, 0.25))
|
||||
fire:SetStartAlpha(150)
|
||||
fire:SetEndAlpha(0)
|
||||
fire:SetStartSize(math.Rand(15, 30))
|
||||
fire:SetEndSize(math.Rand(120, 160))
|
||||
fire:SetRoll(math.Rand(-180, 180))
|
||||
fire:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
fire:SetColor(200, 150, 50)
|
||||
fire:SetAirResistance(300)
|
||||
fire:SetPos(self:GetPos())
|
||||
fire:SetLighting(false)
|
||||
fire:SetBounce(0.5)
|
||||
fire:SetCollide(false)
|
||||
end
|
||||
|
||||
for i = 1, math.random(3, 5) do
|
||||
local fire = emitter:Add("sprites/glow04_noz", data:GetOrigin())
|
||||
fire:SetVelocity(VectorRand() * 100 + Vector(0, 0, math.Rand(100, 300)))
|
||||
fire:SetGravity(Vector(0, 0, -400))
|
||||
fire:SetDieTime(math.Rand(2, 3))
|
||||
fire:SetStartAlpha(200)
|
||||
fire:SetEndAlpha(0)
|
||||
fire:SetStartSize(math.Rand(3, 5))
|
||||
fire:SetEndSize(math.Rand(10, 20))
|
||||
fire:SetRoll(math.Rand(-180, 180))
|
||||
fire:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
fire:SetColor(255, 140, 80)
|
||||
fire:SetAirResistance(2)
|
||||
fire:SetPos(self:GetPos())
|
||||
fire:SetLighting(false)
|
||||
fire:SetBounce(0.2)
|
||||
fire:SetCollide(true)
|
||||
end
|
||||
emitter:Finish()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
77
garrysmod/addons/tacrp/lua/effects/tacrp_flashexplosion.lua
Normal file
77
garrysmod/addons/tacrp/lua/effects/tacrp_flashexplosion.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
local images_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"}
|
||||
|
||||
local function TableRandomChoice(tbl)
|
||||
return tbl[math.random(#tbl)]
|
||||
end
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.Origin = data:GetOrigin()
|
||||
|
||||
util.Decal("FadingScorch", self.Origin, self.Origin - Vector(0, 0, 16))
|
||||
|
||||
local emitter = ParticleEmitter( self.Origin + Vector( 0, 0, 16 ) )
|
||||
|
||||
for i = 0, 5 do
|
||||
local particle = emitter:Add( TableRandomChoice(images_smoke) , self.Origin )
|
||||
local scol = math.Rand( 200, 225 )
|
||||
|
||||
particle:SetVelocity( 250 * VectorRand() )
|
||||
particle:SetDieTime( math.Rand(1.5, 5) )
|
||||
particle:SetStartAlpha( 50 )
|
||||
particle:SetEndAlpha( 0 )
|
||||
particle:SetStartSize( math.Rand(100,200) )
|
||||
particle:SetEndSize( math.Rand(300,400) )
|
||||
particle:SetRoll( math.Rand(0,360) )
|
||||
particle:SetRollDelta( math.Rand(-1,1) )
|
||||
particle:SetColor( scol,scol,scol )
|
||||
particle:SetAirResistance( 100 )
|
||||
particle:SetGravity( Vector( math.Rand(-30,30) ,math.Rand(-30,30),math.Rand(10,40)) )
|
||||
particle:SetLighting( true )
|
||||
particle:SetCollide( true )
|
||||
particle:SetBounce( 0.5 )
|
||||
end
|
||||
|
||||
local particle = emitter:Add( "sprites/heatwave", self.Origin )
|
||||
particle:SetAirResistance( 0 )
|
||||
particle:SetDieTime( 1.5 )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 255 )
|
||||
particle:SetStartSize( 250 )
|
||||
particle:SetEndSize( 0 )
|
||||
particle:SetRoll( math.Rand(180,480) )
|
||||
particle:SetRollDelta( math.Rand(-5,5) )
|
||||
particle:SetColor( 255, 255, 255 )
|
||||
|
||||
local fire = emitter:Add( "particle/fire", self.Origin )
|
||||
fire:SetAirResistance( 0 )
|
||||
fire:SetDieTime( 0.1 )
|
||||
fire:SetStartAlpha( 255 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetEndSize( 0 )
|
||||
fire:SetStartSize( data:GetRadius() )
|
||||
fire:SetRoll( math.Rand(180,480) )
|
||||
fire:SetRollDelta( math.Rand(-1,1) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
|
||||
local light = DynamicLight(self:EntIndex())
|
||||
if (light) then
|
||||
light.Pos = self.Origin
|
||||
light.r = 255
|
||||
light.g = 255
|
||||
light.b = 255
|
||||
light.Brightness = 10 * data:GetScale()
|
||||
light.Decay = 2500
|
||||
light.Size = data:GetRadius()
|
||||
light.DieTime = CurTime() + 0.1
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
36
garrysmod/addons/tacrp/lua/effects/tacrp_jumpsmoke.lua
Normal file
36
garrysmod/addons/tacrp/lua/effects/tacrp_jumpsmoke.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
function EFFECT:Init(data)
|
||||
local pos = data:GetOrigin()
|
||||
local dir = data:GetNormal()
|
||||
self.TrailEnt = data:GetEntity()
|
||||
if !IsValid(self.TrailEnt) then self:Remove() return end
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
local amt = 16
|
||||
|
||||
for i = 1, amt do
|
||||
local _, a = LocalToWorld(Vector(0, 0, 2), Angle((i / amt) * 360, 90, 0), pos, dir:Angle())
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(150 * a:Up())
|
||||
smoke:SetStartAlpha(50)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(24)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.4)
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
97
garrysmod/addons/tacrp/lua/effects/tacrp_leapsmoke.lua
Normal file
97
garrysmod/addons/tacrp/lua/effects/tacrp_leapsmoke.lua
Normal file
@@ -0,0 +1,97 @@
|
||||
function EFFECT:Init(data)
|
||||
local pos = data:GetOrigin()
|
||||
local dir = data:GetNormal()
|
||||
|
||||
local emitter = ParticleEmitter(pos)
|
||||
local amt = 24
|
||||
|
||||
if IsValid(data:GetEntity()) and data:GetEntity():IsOnGround() and data:GetEntity():Crouching() then
|
||||
pos = pos + Vector(0, 0, 4)
|
||||
for i = 1, amt / 2 do
|
||||
local _, a = LocalToWorld(Vector(), Angle((i / amt) * 360, 90, 0), pos, dir:Angle())
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * -50 + 300 * a:Up() + VectorRand() * 128)
|
||||
smoke:SetGravity(Vector(0, 0, -200))
|
||||
smoke:SetStartAlpha(200)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(64)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(1)
|
||||
end
|
||||
|
||||
for i = 1, amt / 2 do
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * math.Rand(400, 800) + VectorRand() * 128)
|
||||
smoke:SetStartAlpha(200)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(32)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.75)
|
||||
end
|
||||
elseif IsValid(data:GetEntity()) and data:GetEntity():IsOnGround() then
|
||||
pos = pos + Vector(0, 0, 2)
|
||||
|
||||
local dir2 = Vector(dir)
|
||||
dir2.z = 0
|
||||
dir2:Normalize()
|
||||
|
||||
for i = 1, amt do
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir2 * math.Rand(-600, -200) + VectorRand() * 128 + Vector(0, 0, math.Rand(250, 400)))
|
||||
smoke:SetGravity(Vector(0, 0, -300))
|
||||
smoke:SetStartAlpha(150)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(32)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(200)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(1)
|
||||
end
|
||||
else
|
||||
for i = 1, amt do
|
||||
local _, a = LocalToWorld(Vector(), Angle((i / amt) * 360, 90, 0), pos, dir:Angle())
|
||||
local smoke = emitter:Add("particle/smokestack", pos)
|
||||
smoke:SetVelocity(dir * -50 + 150 * a:Up() + VectorRand() * 8)
|
||||
smoke:SetStartAlpha(200)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(8)
|
||||
smoke:SetEndSize(24)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(200, 200, 200)
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetCollide(true)
|
||||
smoke:SetBounce(0.2)
|
||||
smoke:SetLighting(true)
|
||||
smoke:SetDieTime(0.75)
|
||||
end
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
113
garrysmod/addons/tacrp/lua/effects/tacrp_m202_explode.lua
Normal file
113
garrysmod/addons/tacrp/lua/effects/tacrp_m202_explode.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
EFFECT.Model = "models/Items/AR2_Grenade.mdl"
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self:SetModel(self.Model)
|
||||
local emitter = ParticleEmitter(data:GetOrigin())
|
||||
if not IsValid(emitter) then return end
|
||||
for i = 1, 10 do
|
||||
local smoke = emitter:Add("particle/smokestack", data:GetOrigin())
|
||||
smoke:SetVelocity(VectorRand() * 100)
|
||||
smoke:SetGravity(Vector(math.Rand(-5, 5), math.Rand(-5, 5), 70))
|
||||
smoke:SetDieTime(math.Rand(5, 7))
|
||||
smoke:SetStartAlpha(80)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(math.Rand(20, 40))
|
||||
smoke:SetEndSize(80)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
smoke:SetColor(175, 175, 175)
|
||||
smoke:SetAirResistance(120)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetBounce(0.5)
|
||||
smoke:SetCollide(true)
|
||||
end
|
||||
|
||||
for i = 1, 10 do
|
||||
local smoke = emitter:Add("particle/smokestack", data:GetOrigin())
|
||||
smoke:SetVelocity(VectorRand() * 800)
|
||||
smoke:SetGravity(Vector(math.Rand(-25, 25), math.Rand(-25, 25), -500))
|
||||
smoke:SetDieTime(math.Rand(0.6, 1))
|
||||
smoke:SetStartAlpha(120)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(80)
|
||||
smoke:SetEndSize(250)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
smoke:SetColor(100, 100, 100)
|
||||
smoke:SetAirResistance(300)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetBounce(0.5)
|
||||
smoke:SetCollide(true)
|
||||
end
|
||||
|
||||
for i = 1, 10 do
|
||||
local fire = emitter:Add("effects/fire_cloud" .. math.random(1, 2), data:GetOrigin())
|
||||
fire:SetVelocity(VectorRand() * 1200 - Vector(0, 0, 100))
|
||||
fire:SetGravity(Vector(0, 0, 0))
|
||||
fire:SetDieTime(math.Rand(0.1, 0.25))
|
||||
fire:SetStartAlpha(255)
|
||||
fire:SetEndAlpha(0)
|
||||
fire:SetStartSize(math.Rand(15, 30))
|
||||
fire:SetEndSize(math.Rand(180, 200))
|
||||
fire:SetRoll(math.Rand(-180, 180))
|
||||
fire:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
fire:SetColor(200, 200, 200)
|
||||
fire:SetAirResistance(300)
|
||||
fire:SetPos(self:GetPos())
|
||||
fire:SetLighting(false)
|
||||
fire:SetBounce(0.5)
|
||||
fire:SetCollide(false)
|
||||
end
|
||||
|
||||
for i = 1, 20 do
|
||||
local fire = emitter:Add("effects/fire_embers" .. math.random(1, 3), data:GetOrigin())
|
||||
local v = VectorRand() * 1500
|
||||
v.z = v.z * 0.25
|
||||
fire:SetVelocity(v)
|
||||
fire:SetGravity(Vector(0, 0, -750))
|
||||
fire:SetDieTime(math.Rand(1.2, 3))
|
||||
fire:SetStartAlpha(200)
|
||||
fire:SetEndAlpha(0)
|
||||
fire:SetStartSize(math.Rand(30, 50))
|
||||
fire:SetEndSize(math.Rand(40, 70))
|
||||
fire:SetRoll(math.Rand(-180, 180))
|
||||
fire:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
fire:SetColor(200, 200, 200)
|
||||
fire:SetAirResistance(200)
|
||||
fire:SetPos(self:GetPos())
|
||||
fire:SetLighting(false)
|
||||
fire:SetBounce(0.5)
|
||||
fire:SetCollide(true)
|
||||
end
|
||||
|
||||
for i = 1, math.random(6, 9) do
|
||||
local fire = emitter:Add("sprites/glow04_noz", data:GetOrigin())
|
||||
fire:SetVelocity(VectorRand() * 100 + Vector(0, 0, math.Rand(300, 800)))
|
||||
fire:SetGravity(Vector(0, 0, -400))
|
||||
fire:SetDieTime(math.Rand(2, 3))
|
||||
fire:SetStartAlpha(200)
|
||||
fire:SetEndAlpha(0)
|
||||
fire:SetStartSize(math.Rand(3, 5))
|
||||
fire:SetEndSize(math.Rand(10, 20))
|
||||
fire:SetRoll(math.Rand(-180, 180))
|
||||
fire:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
fire:SetColor(255, 180, 100)
|
||||
fire:SetAirResistance(2)
|
||||
fire:SetPos(self:GetPos())
|
||||
fire:SetLighting(false)
|
||||
fire:SetBounce(0.2)
|
||||
fire:SetCollide(true)
|
||||
end
|
||||
emitter:Finish()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
65
garrysmod/addons/tacrp/lua/effects/tacrp_muzzleeffect.lua
Normal file
65
garrysmod/addons/tacrp/lua/effects/tacrp_muzzleeffect.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
function EFFECT:Init(data)
|
||||
local wpn = data:GetEntity()
|
||||
|
||||
if !IsValid(wpn) then self:Remove() return end
|
||||
|
||||
if wpn:GetOwner() == LocalPlayer() and wpn:GetValue("ScopeHideWeapon") and wpn:IsInScope() then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
local muzzle = TacRP.MuzzleEffects[data:GetFlags() or 1] or "muzzleflash_pistol"
|
||||
if wpn.GetValue then
|
||||
muzzle = wpn:GetValue("MuzzleEffect")
|
||||
end
|
||||
|
||||
local att = data:GetAttachment() or 1
|
||||
|
||||
local wm = false
|
||||
|
||||
if (LocalPlayer():ShouldDrawLocalPlayer() or wpn.Owner != LocalPlayer()) then
|
||||
wm = true
|
||||
att = data:GetHitBox()
|
||||
end
|
||||
|
||||
local parent = wpn
|
||||
|
||||
if !wm then
|
||||
parent = LocalPlayer():GetViewModel()
|
||||
end
|
||||
|
||||
if wpn.GetMuzzleDevice then
|
||||
parent = wpn:GetMuzzleDevice(wm)
|
||||
else
|
||||
parent = self
|
||||
end
|
||||
|
||||
-- if !IsValid(parent) then return end
|
||||
|
||||
if muzzle then
|
||||
if !istable(muzzle) then
|
||||
muzzle = {muzzle}
|
||||
end
|
||||
|
||||
for _, muzzleeffect in ipairs(muzzle) do
|
||||
local pcf = CreateParticleSystem(muz or parent, muzzleeffect, PATTACH_POINT_FOLLOW, att)
|
||||
|
||||
if IsValid(pcf) then
|
||||
pcf:StartEmission()
|
||||
|
||||
if (muz or parent) != vm and !wm then
|
||||
pcf:SetShouldDraw(false)
|
||||
table.insert(wpn.MuzzPCFs, pcf)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
130
garrysmod/addons/tacrp/lua/effects/tacrp_nukeexplosion.lua
Normal file
130
garrysmod/addons/tacrp/lua/effects/tacrp_nukeexplosion.lua
Normal file
@@ -0,0 +1,130 @@
|
||||
local images_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"}
|
||||
|
||||
local function TableRandomChoice(tbl)
|
||||
return tbl[math.random(#tbl)]
|
||||
end
|
||||
|
||||
local effecttime = 30
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.Origin = data:GetOrigin()
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
|
||||
util.Decal("FadingScorch", self.Origin, self.Origin - Vector(0, 0, 16))
|
||||
|
||||
local emitter = ParticleEmitter( self.Origin + Vector( 0, 0, 16 ) )
|
||||
|
||||
// smoke cloud
|
||||
|
||||
for i = 1,25 do
|
||||
local particle = emitter:Add( TableRandomChoice(images_smoke) , self.Origin )
|
||||
local scol = math.Rand( 200, 225 )
|
||||
|
||||
particle:SetVelocity( 250 * VectorRand() )
|
||||
particle:SetDieTime( math.Rand(0.9, 1.1) * effecttime )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 0 )
|
||||
particle:SetStartSize( math.Rand(300,400) )
|
||||
particle:SetEndSize( math.Rand(2000,2500) )
|
||||
particle:SetRoll( math.Rand(0,360) )
|
||||
particle:SetRollDelta( math.Rand(-1,1) )
|
||||
particle:SetColor( scol,scol,scol )
|
||||
particle:SetAirResistance( 50 )
|
||||
particle:SetGravity( Vector( math.Rand(-250, 250), math.Rand(-250, 250), 500) )
|
||||
particle:SetLighting( false )
|
||||
end
|
||||
|
||||
// stack
|
||||
|
||||
for i = 1,25 do
|
||||
local particle = emitter:Add( TableRandomChoice(images_smoke) , self.Origin )
|
||||
local scol = math.Rand( 200, 225 )
|
||||
|
||||
particle:SetVelocity( 250 * VectorRand() )
|
||||
particle:SetDieTime( math.Rand(0.9, 1.1) * effecttime )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 0 )
|
||||
particle:SetStartSize( math.Rand(300,400) )
|
||||
particle:SetEndSize( math.Rand(1000,1500) )
|
||||
particle:SetRoll( math.Rand(0,360) )
|
||||
particle:SetRollDelta( math.Rand(-1,1) )
|
||||
particle:SetColor( scol,scol,scol )
|
||||
particle:SetAirResistance( 50 )
|
||||
particle:SetGravity( Vector( math.Rand(-10, 10), math.Rand(-10, 10), math.Rand(0, 500)) )
|
||||
particle:SetLighting( false )
|
||||
end
|
||||
|
||||
// wave
|
||||
|
||||
local amt = 50
|
||||
|
||||
for i = 1, amt do
|
||||
local particle = emitter:Add( TableRandomChoice(images_smoke) , self.Origin )
|
||||
local scol = math.Rand( 200, 225 )
|
||||
|
||||
particle:SetVelocity( VectorRand() * 8 + (Angle(0, i * (360 / amt), 0):Forward() * 750) )
|
||||
particle:SetDieTime( math.Rand(0.9, 1.1) * effecttime )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 0 )
|
||||
particle:SetStartSize( math.Rand(300,400) )
|
||||
particle:SetEndSize( math.Rand(1000,1500) )
|
||||
particle:SetRoll( math.Rand(0,360) )
|
||||
particle:SetRollDelta( math.Rand(-1,1) )
|
||||
particle:SetColor( scol,scol,scol )
|
||||
particle:SetAirResistance( 5 )
|
||||
particle:SetLighting( false )
|
||||
particle:SetCollide( false )
|
||||
end
|
||||
|
||||
local particle = emitter:Add( "sprites/heatwave", self.Origin )
|
||||
particle:SetAirResistance( 0 )
|
||||
particle:SetDieTime( effecttime )
|
||||
particle:SetStartAlpha( 255 )
|
||||
particle:SetEndAlpha( 255 )
|
||||
particle:SetStartSize( 5000 )
|
||||
particle:SetEndSize( 0 )
|
||||
particle:SetRoll( math.Rand(180,480) )
|
||||
particle:SetRollDelta( math.Rand(-5,5) )
|
||||
particle:SetColor( 255, 255, 255 )
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
local light = DynamicLight(self:EntIndex())
|
||||
if (light) then
|
||||
light.Pos = self.Origin
|
||||
light.r = 255
|
||||
light.g = 255
|
||||
light.b = 255
|
||||
light.Brightness = 9
|
||||
light.Decay = 2500
|
||||
light.Size = 2048
|
||||
light.DieTime = CurTime() + 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if (self.SpawnTime + effecttime) < CurTime() then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local glaremat = Material("effects/ar2_altfire1b")
|
||||
|
||||
function EFFECT:Render()
|
||||
local d = (CurTime() - self.SpawnTime) / 15
|
||||
|
||||
d = 1 - d
|
||||
|
||||
d = math.Clamp(d, 0, 1)
|
||||
|
||||
cam.IgnoreZ(true)
|
||||
|
||||
render.SetMaterial(glaremat)
|
||||
render.DrawSprite(self.Origin, 15000 * d, 15000 * d, Color(255, 255, 255))
|
||||
|
||||
cam.IgnoreZ(false)
|
||||
end
|
||||
170
garrysmod/addons/tacrp/lua/effects/tacrp_shelleffect.lua
Normal file
170
garrysmod/addons/tacrp/lua/effects/tacrp_shelleffect.lua
Normal file
@@ -0,0 +1,170 @@
|
||||
EFFECT.Type = 1
|
||||
|
||||
EFFECT.Pitch = 100
|
||||
|
||||
EFFECT.Model = "models/shells/shell_57.mdl"
|
||||
|
||||
EFFECT.AlreadyPlayedSound = false
|
||||
EFFECT.ShellTime = 0.5
|
||||
EFFECT.SpawnTime = 0
|
||||
|
||||
EFFECT.VMContext = true
|
||||
|
||||
function EFFECT:Init(data)
|
||||
|
||||
local att = data:GetAttachment()
|
||||
local ent = data:GetEntity()
|
||||
|
||||
self.Type = data:GetFlags() or self.Type
|
||||
|
||||
local typetbl = TacRP.ShellTypes[self.Type]
|
||||
|
||||
if !IsValid(ent) then self:Remove() return end
|
||||
if !IsValid(ent:GetOwner()) then self:Remove() return end
|
||||
|
||||
local origin, ang, dir
|
||||
|
||||
if ent:GetOwner() == LocalPlayer() and ent:GetValue("ScopeHideWeapon") and ent:IsInScope() then
|
||||
origin = EyePos()
|
||||
+ EyeAngles():Right() * ent.PassivePos.x
|
||||
+ EyeAngles():Forward() * ent.PassivePos.y
|
||||
+ EyeAngles():Up() * ent.PassivePos.z
|
||||
ang = EyeAngles()
|
||||
dir = ang:Right() -- not exactly correct but we can't rely on weapon model here
|
||||
else
|
||||
if LocalPlayer():ShouldDrawLocalPlayer() or ent:GetOwner() != LocalPlayer() then
|
||||
mdl = ent
|
||||
att = data:GetHitBox()
|
||||
self.VMContext = false
|
||||
else
|
||||
mdl = LocalPlayer():GetViewModel()
|
||||
table.insert(ent.ActiveEffects, self)
|
||||
end
|
||||
|
||||
if !IsValid(ent) then self:Remove() return end
|
||||
if !mdl or !IsValid(mdl) then self:Remove() return end
|
||||
if !mdl:GetAttachment(att) then self:Remove() return end
|
||||
if !typetbl then return end
|
||||
|
||||
origin = mdl:GetAttachment(att).Pos
|
||||
ang = mdl:GetAttachment(att).Ang
|
||||
|
||||
-- ang:RotateAroundAxis(ang:Up(), -90)
|
||||
|
||||
-- ang:RotateAroundAxis(ang:Right(), (ent.ShellRotateAngle or Angle(0, 0, 0))[1])
|
||||
-- ang:RotateAroundAxis(ang:Up(), (ent.ShellRotateAngle or Angle(0, 0, 0))[2])
|
||||
-- ang:RotateAroundAxis(ang:Forward(), (ent.ShellRotateAngle or Angle(0, 0, 0))[3])
|
||||
|
||||
dir = ang:Forward()
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), 0)
|
||||
ang:RotateAroundAxis(ang:Up(), 0)
|
||||
end
|
||||
|
||||
self:SetPos(origin)
|
||||
self:SetModel(typetbl.Model)
|
||||
self:SetModelScale(data:GetScale(), 0)
|
||||
self:DrawShadow(true)
|
||||
self:SetAngles(ang)
|
||||
|
||||
self:SetNoDraw(true)
|
||||
|
||||
self.Sounds = typetbl.Sounds
|
||||
|
||||
local pb_vert = 2
|
||||
local pb_hor = 0.25
|
||||
|
||||
local mag = 150
|
||||
|
||||
self:PhysicsInitBox(Vector(-pb_vert,-pb_hor,-pb_hor), Vector(pb_vert,pb_hor,pb_hor))
|
||||
|
||||
self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
local plyvel = Vector(0, 0, 0)
|
||||
|
||||
if IsValid(ent.Owner) then
|
||||
plyvel = ent.Owner:GetAbsVelocity()
|
||||
end
|
||||
|
||||
phys:Wake()
|
||||
phys:SetDamping(0, 0)
|
||||
phys:SetMass(1)
|
||||
phys:SetMaterial("gmod_silent")
|
||||
|
||||
phys:SetVelocity((dir * mag * math.Rand(1, 2)) + plyvel)
|
||||
|
||||
phys:AddAngleVelocity(VectorRand() * 100)
|
||||
phys:AddAngleVelocity(ang:Up() * -2500 * math.Rand(0.75, 1.25))
|
||||
|
||||
local smoke = true
|
||||
|
||||
if smoke and IsValid(mdl) then
|
||||
local pcf = CreateParticleSystem(mdl, "port_smoke", PATTACH_POINT_FOLLOW, att)
|
||||
|
||||
if IsValid(pcf) then
|
||||
pcf:StartEmission()
|
||||
end
|
||||
|
||||
local smkpcf = CreateParticleSystem(self, "shellsmoke", PATTACH_ABSORIGIN_FOLLOW, 0)
|
||||
|
||||
if IsValid(smkpcf) then
|
||||
smkpcf:StartEmission()
|
||||
end
|
||||
|
||||
if self.VMContext then
|
||||
table.insert(ent.PCFs, pcf)
|
||||
table.insert(ent.PCFs, smkpcf)
|
||||
|
||||
pcf:SetShouldDraw(false)
|
||||
smkpcf:SetShouldDraw(false)
|
||||
end
|
||||
end
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
end
|
||||
|
||||
function EFFECT:PhysicsCollide(colData)
|
||||
if self.AlreadyPlayedSound then return end
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:SetVelocityInstantaneous(colData.HitNormal * -150)
|
||||
|
||||
sound.Play(self.Sounds[math.random(#self.Sounds)], self:GetPos(), 65, 100, 1)
|
||||
self:StopSound("Default.ImpactHard")
|
||||
self.VMContext = false
|
||||
self:SetNoDraw(false)
|
||||
|
||||
self.AlreadyPlayedSound = true
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if self:GetVelocity():Length() > 0 then self.SpawnTime = CurTime() end
|
||||
self:StopSound("Default.ScrapeRough")
|
||||
|
||||
if (self.SpawnTime + self.ShellTime) <= CurTime() then
|
||||
if !IsValid(self) then return end
|
||||
self:SetRenderFX( kRenderFxFadeFast )
|
||||
if (self.SpawnTime + self.ShellTime + 0.25) <= CurTime() then
|
||||
if !IsValid(self:GetPhysicsObject()) then return end
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
if (self.SpawnTime + self.ShellTime + 0.5) <= CurTime() then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
function EFFECT:DrawTranslucent()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self:DrawModel()
|
||||
end
|
||||
101
garrysmod/addons/tacrp/lua/effects/tacrp_tracer.lua
Normal file
101
garrysmod/addons/tacrp/lua/effects/tacrp_tracer.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
EFFECT.StartPos = Vector(0, 0, 0)
|
||||
EFFECT.EndPos = Vector(0, 0, 0)
|
||||
EFFECT.StartTime = 0
|
||||
EFFECT.LifeTime = 0.15
|
||||
EFFECT.LifeTime2 = 0.15
|
||||
EFFECT.DieTime = 0
|
||||
EFFECT.Color = Color(255, 255, 255)
|
||||
EFFECT.Speed = 5000
|
||||
|
||||
local head = Material("particle/fire")
|
||||
local tracer = Material("tacrp/tracer")
|
||||
|
||||
function EFFECT:Init(data)
|
||||
|
||||
local hit = data:GetOrigin()
|
||||
local wep = data:GetEntity()
|
||||
|
||||
if !IsValid(wep) then return end
|
||||
local tacrp = wep.ArcticTacRP and wep.GetValue
|
||||
|
||||
local start = data:GetStart()
|
||||
if wep:GetOwner() == LocalPlayer() and tacrp and wep:GetValue("ScopeHideWeapon") and wep:IsInScope() then
|
||||
start = EyePos()
|
||||
+ EyeAngles():Right() * wep.PassivePos.x
|
||||
+ EyeAngles():Forward() * wep.PassivePos.y
|
||||
+ EyeAngles():Up() * wep.PassivePos.z
|
||||
elseif wep.GetTracerOrigin then
|
||||
start = wep:GetTracerOrigin()
|
||||
end
|
||||
|
||||
if !start then
|
||||
start = wep:GetPos() -- ???
|
||||
end
|
||||
|
||||
local diff = hit - start
|
||||
local dist = diff:Length()
|
||||
|
||||
if !tacrp then
|
||||
self.Speed = 15000
|
||||
elseif TacRP.ConVars["physbullet"]:GetBool() then
|
||||
self.Speed = math.max(wep:GetValue("MuzzleVelocity") or data:GetScale(), 5000)
|
||||
else
|
||||
self.Speed = math.max(wep:GetValue("MuzzleVelocity") or data:GetScale(), dist / 0.4)
|
||||
end
|
||||
|
||||
self.LifeTime = dist / self.Speed
|
||||
self.StartTime = UnPredictedCurTime()
|
||||
self.DieTime = UnPredictedCurTime() + math.max(self.LifeTime, self.LifeTime2)
|
||||
|
||||
self.StartPos = start
|
||||
self.EndPos = hit
|
||||
self.Dir = diff:GetNormalized()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return self.DieTime > UnPredictedCurTime()
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
|
||||
if !self.Dir then return end
|
||||
|
||||
local d = (UnPredictedCurTime() - self.StartTime) / self.LifeTime
|
||||
local startpos = self.StartPos + (d * 0.2 * (self.EndPos - self.StartPos))
|
||||
local endpos = self.StartPos + (d * (self.EndPos - self.StartPos))
|
||||
|
||||
--[[]
|
||||
local col = LerpColor(d, self.Color, Color(0, 0, 0, 0))
|
||||
local col2 = LerpColor(d2, Color(255, 255, 255, 255), Color(0, 0, 0, 0))
|
||||
|
||||
render.SetMaterial(head)
|
||||
render.DrawSprite(endpos, size * 3, size * 3, col)
|
||||
|
||||
render.SetMaterial(tracer)
|
||||
render.DrawBeam(endpos, startpos, size, 0, 1, col)
|
||||
]]
|
||||
|
||||
local size = math.Clamp(math.log(EyePos():DistToSqr(endpos) - math.pow(256, 2)), 0, math.huge)
|
||||
|
||||
local vel = self.Dir * self.Speed - LocalPlayer():GetVelocity()
|
||||
|
||||
local dot = math.abs(EyeAngles():Forward():Dot(vel:GetNormalized()))
|
||||
--dot = math.Clamp(((dot * dot) - 0.25) * 5, 0, 1)
|
||||
local headsize = size * dot * 2 -- * math.min(EyePos():DistToSqr(pos) / math.pow(2500, 2), 1)
|
||||
-- cam.Start3D()
|
||||
|
||||
local col = Color(255, 225, 200)
|
||||
-- local col = Color(255, 225, 200)
|
||||
|
||||
render.SetMaterial(head)
|
||||
render.DrawSprite(endpos, headsize, headsize, col)
|
||||
|
||||
-- local tailpos = startpos
|
||||
-- if (endpos - startpos):Length() > 512 then
|
||||
-- tailpos = endpos - self.Dir * 512
|
||||
-- end
|
||||
local tail = (self.Dir * math.min(self.Speed / 25, 512, (endpos - startpos):Length() - 64))
|
||||
|
||||
render.SetMaterial(tracer)
|
||||
render.DrawBeam(endpos, endpos - tail, size * 0.75, 0, 1, col)
|
||||
end
|
||||
Reference in New Issue
Block a user