diff --git a/lua/entities/acf_engine/init.lua b/lua/entities/acf_engine/init.lua index 8eb071e5a..1bfa7ef8b 100644 --- a/lua/entities/acf_engine/init.lua +++ b/lua/entities/acf_engine/init.lua @@ -127,7 +127,7 @@ local function GetPitchVolume(Engine) local RPM = Engine.FlyRPM local Pitch = Clamp(20 + (RPM * Engine.SoundPitch) * 0.02, 1, 255) -- Rev limiter code disabled because it has issues with the volume delta time, but it's still here if we need it - local Throttle = --[[Engine.RevLimited and 0 or]] Engine.Throttle + local Throttle = Engine.Throttle -- Engine.RevLimited and 0 or Engine.Throttle local Volume = 0.25 + (0.1 + 0.9 * ((RPM / Engine.LimitRPM) ^ 1.5)) * Throttle * 0.666 return Pitch, Volume * Engine.SoundVolume @@ -611,9 +611,11 @@ end function ENT:UpdateSound(SelfTbl) SelfTbl = SelfTbl or self:GetTable() - local Path = SelfTbl.SoundPath - if Path ~= SelfTbl.LastSound then + local Path = SelfTbl.SoundPath + local LastSound = SelfTbl.LastSound + + if Path ~= LastSound and LastSound ~= nil then self:DestroySound() SelfTbl.LastSound = Path diff --git a/lua/entities/acf_engine_update/init.lua b/lua/entities/acf_engine_update/init.lua index 19de42488..2d12547da 100644 --- a/lua/entities/acf_engine_update/init.lua +++ b/lua/entities/acf_engine_update/init.lua @@ -135,7 +135,7 @@ local function GetPitchVolume(Engine) local RPM = Engine.FlyRPM local Pitch = Clamp(20 + (RPM * Engine.SoundPitch) * 0.02, 1, 255) -- Rev limiter code disabled because it has issues with the volume delta time, but it's still here if we need it - local Throttle = --[[Engine.RevLimited and 0 or]] Engine.Throttle + local Throttle = Engine.Throttle -- Engine.RevLimited and 0 or Engine.Throttle local Volume = 0.25 + (0.1 + 0.9 * ((RPM / Engine.LimitRPM) ^ 1.5)) * Throttle * 0.666 return Pitch, Volume * Engine.SoundVolume @@ -629,9 +629,11 @@ end function ENT:UpdateSound(SelfTbl) SelfTbl = SelfTbl or self:GetTable() - local Path = SelfTbl.SoundPath - if Path ~= SelfTbl.LastSound then + local Path = SelfTbl.SoundPath + local LastSound = SelfTbl.LastSound + + if Path ~= LastSound and LastSound ~= nil then self:DestroySound() SelfTbl.LastSound = Path