Use UnPredictedCurTime for particles

This commit is contained in:
Fesiug 2023-11-29 18:17:08 -05:00
parent bc55cdbd30
commit 526eeeb0df
1 changed files with 13 additions and 13 deletions

View File

@ -16,8 +16,8 @@ function EFFECT:Init( data )
self.ea = data:GetAttachment() self.ea = data:GetAttachment()
self.particles = 1 self.particles = 1
self.CreationTime = CurTime() self.CreationTime = UnPredictedCurTime()
self.DieTime = CurTime() + 0.05 self.DieTime = UnPredictedCurTime() + 0.1
self:SetRenderBounds( rbb, rba ) self:SetRenderBounds( rbb, rba )
@ -31,9 +31,9 @@ function EFFECT:Init( data )
dlight.r = 255 dlight.r = 255
dlight.g = 200 dlight.g = 200
dlight.b = 150 dlight.b = 150
dlight.Brightness = 4 dlight.Brightness = 1
dlight.Size = 72*1.5 dlight.Size = 72*3
dlight.DieTime = CurTime() + 0.07 dlight.DieTime = UnPredictedCurTime() + 0.05
dlight.Decay = 72*20 dlight.Decay = 72*20
end end
@ -86,12 +86,12 @@ function EFFECT:Init( data )
end end
function EFFECT:Think() function EFFECT:Think()
return (self.DieTime >= CurTime()) -- Return false to kill return (self.DieTime >= UnPredictedCurTime()) -- Return false to kill
end end
function EFFECT:Render() function EFFECT:Render()
local atti = self.en:GetAttachment( self.ea ) local atti = self.en:GetAttachment( self.ea )
local tf = 1-math.TimeFraction( self.DieTime, self.CreationTime, CurTime() ) local tf = 1-math.TimeFraction( self.DieTime, self.CreationTime, UnPredictedCurTime() )
-- Big flash! -- Big flash!
if true then if true then
@ -110,13 +110,13 @@ function EFFECT:Render()
p:SetEndAlpha( 255 ) p:SetEndAlpha( 255 )
p:SetStartSize( Lerp( tf, 6, 0 ) ) p:SetStartSize( Lerp( tf, 6, 0 ) )
p:SetEndSize( Lerp( tf, 6, 0 ) ) p:SetEndSize( Lerp( tf, 6, 0 ) )
p:SetNextThink( CurTime() ) p:SetNextThink( UnPredictedCurTime() )
p:SetThinkFunction( function( pa ) p:SetThinkFunction( function( pa )
timer.Simple( 0, function() timer.Simple( 0, function()
pa:SetStartAlpha( 0 ) pa:SetStartAlpha( 0 )
pa:SetEndAlpha( 0 ) pa:SetEndAlpha( 0 )
end) end)
pa:SetNextThink( CurTime() ) pa:SetNextThink( UnPredictedCurTime() )
end) end)
end end
end end
@ -142,13 +142,13 @@ function EFFECT:Render()
p:SetStartLength( Lerp( tf, 12, 16 ) ) p:SetStartLength( Lerp( tf, 12, 16 ) )
p:SetEndSize( Lerp( tf, 16, 4 ) ) p:SetEndSize( Lerp( tf, 16, 4 ) )
p:SetEndLength( Lerp( tf, 12, 16 ) ) p:SetEndLength( Lerp( tf, 12, 16 ) )
p:SetNextThink( CurTime() ) p:SetNextThink( UnPredictedCurTime() )
p:SetThinkFunction( function( pa ) p:SetThinkFunction( function( pa )
timer.Simple( 0, function() timer.Simple( 0, function()
pa:SetStartAlpha( 0 ) pa:SetStartAlpha( 0 )
pa:SetEndAlpha( 0 ) pa:SetEndAlpha( 0 )
end) end)
pa:SetNextThink( CurTime() ) pa:SetNextThink( UnPredictedCurTime() )
end) end)
end end
end end
@ -182,13 +182,13 @@ function EFFECT:Render()
p:SetStartLength( Lerp( tf, 10, 1 ) ) p:SetStartLength( Lerp( tf, 10, 1 ) )
p:SetEndSize( Lerp( tf, 1, 12 ) ) p:SetEndSize( Lerp( tf, 1, 12 ) )
p:SetEndLength( Lerp( tf, 10, 1 ) ) p:SetEndLength( Lerp( tf, 10, 1 ) )
p:SetNextThink( CurTime() ) p:SetNextThink( UnPredictedCurTime() )
p:SetThinkFunction( function( pa ) p:SetThinkFunction( function( pa )
timer.Simple( 0, function() timer.Simple( 0, function()
pa:SetStartAlpha( 0 ) pa:SetStartAlpha( 0 )
pa:SetEndAlpha( 0 ) pa:SetEndAlpha( 0 )
end) end)
pa:SetNextThink( CurTime() ) pa:SetNextThink( UnPredictedCurTime() )
end) end)
end end
end end