Skip to content

Commit

Permalink
Update engine sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyunge committed Apr 14, 2024
1 parent 7d21d06 commit 1e2aa12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lua/entities/acf_engine/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions lua/entities/acf_engine_update/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1e2aa12

Please sign in to comment.