mirror of
https://github.com/SpaxscE/simfphys_base.git
synced 2025-03-04 03:13:26 -05:00
Merge pull request #91 from NathanX-S/master
optimize: ManageSmoke is expensive.
This commit is contained in:
commit
a5cfdb442c
@ -549,9 +549,11 @@ if CLIENT then
|
||||
end
|
||||
|
||||
function ENT:ManageSmoke()
|
||||
|
||||
local BaseEnt = self:GetBaseEnt()
|
||||
if not IsValid( BaseEnt ) then return end
|
||||
|
||||
|
||||
if LocalPlayer():GetPos():DistToSqr(self:GetPos()) > 6000 * 6000 or not BaseEnt:GetActive() then return end
|
||||
local WheelOnGround = self:GetOnGround()
|
||||
local GripLoss = self:GetGripLoss()
|
||||
local Material = self:GetSurfaceMaterial()
|
||||
@ -562,7 +564,7 @@ if CLIENT then
|
||||
self.FadeHeat = self.FadeHeat * 0.995
|
||||
end
|
||||
|
||||
local Scale = self.FadeHeat ^ 3 / 1000
|
||||
local Scale = self.FadeHeat ^ 3 * 0.001
|
||||
local SmokeOn = (self.FadeHeat >= 7)
|
||||
local DirtOn = GripLoss > 0.05
|
||||
local lcolor = BaseEnt:GetTireSmokeColor() * 255
|
||||
@ -601,6 +603,7 @@ if CLIENT then
|
||||
if (Speed > 150 or DirtOn) and OnRim then
|
||||
self:MakeSparks( GripLoss, Dir, Pos, WheelSize )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:MakeSparks( Scale, Dir, Pos, WheelSize )
|
||||
@ -622,4 +625,4 @@ if CLIENT then
|
||||
|
||||
function ENT:OnRemove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user