A car whose engine is running makes no engine sound for other players once it streams back in for them, e.g. after they walk or drive far away and come back, or relog. Only the start-up sound plays when it streams in, then nothing. The idle and revving sound comes back as soon as someone gets into the car.
Players on our community server keep reporting it: a car left running is completely silent when you walk back to it.
Cause (from the 1.30 scripts, confirmed with logging)
On a client that is not driving the car, Car.EngineIsOn() returns false after the car streams in, even though the engine runs: the synced m_CarEngineSoundState is START_OK, m_EngineStarted is true and EngineGetRPM() is 850. The engine loop sounds scale with the engineOn sound controller (CarSoundCtrl.ENGINE), which stays 0, so the loop is silent.
Client log from the test (Gunter left idling, observer came back from ~7 km):
streamed in Hatchback_02 engineOn false started false soundState 2 rpm 0
after 3 s Hatchback_02 engineOn false started true soundState 2 rpm 850
A test override of CarScript.OnSound that returns 1 for CarSoundCtrl.ENGINE when m_EngineStarted, m_CarEngineSoundState == START_OK and EngineGetRPM() > 0 brings the sound back, which confirms the engine-on controller is the problem:
override float OnSound(CarSoundCtrl ctrl, float oldValue)
{
float value = super.OnSound(ctrl, oldValue)
if (ctrl == CarSoundCtrl.ENGINE && value == 0 && m_EngineStarted && m_CarEngineSoundState == CarEngineSoundState.START_OK && EngineGetRPM() > 0)
return 1
return value
}
That is only a workaround: the real fix is syncing the engine-on state to clients that stream the car in. Side issue: HandleEngineSound(START_OK) also replays the engine start sound on every stream-in.