Actually fix round restart audio this time (#24754)
In which I'm a goober and don't clean up after myself and accientally don't fix the issue I tried to fix in my last round restart PR. The audio is now maintained just like music during restarts (yippee to ContentAudioSystem::OnRoundRestart) This needs a refactor but at least the defect is fixed now.
This commit is contained in:
committed by
GitHub
parent
e7ee364af3
commit
2e7d23674e
@@ -50,15 +50,24 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem
|
||||
_fadingOut.Clear();
|
||||
|
||||
// Preserve lobby music but everything else should get dumped.
|
||||
var lobbyStream = EntityManager.System<BackgroundAudioSystem>().LobbyStream;
|
||||
TryComp(lobbyStream, out AudioComponent? audioComp);
|
||||
var oldGain = audioComp?.Gain;
|
||||
var lobbyMusic = EntityManager.System<BackgroundAudioSystem>().LobbyMusicStream;
|
||||
TryComp(lobbyMusic, out AudioComponent? lobbyMusicComp);
|
||||
var oldMusicGain = lobbyMusicComp?.Gain;
|
||||
|
||||
var restartAudio = EntityManager.System<BackgroundAudioSystem>().LobbyRoundRestartAudioStream;
|
||||
TryComp(restartAudio, out AudioComponent? restartComp);
|
||||
var oldAudioGain = restartComp?.Gain;
|
||||
|
||||
SilenceAudio();
|
||||
|
||||
if (oldGain != null)
|
||||
if (oldMusicGain != null)
|
||||
{
|
||||
Audio.SetGain(lobbyStream, oldGain.Value, audioComp);
|
||||
Audio.SetGain(lobbyMusic, oldMusicGain.Value, lobbyMusicComp);
|
||||
}
|
||||
|
||||
if (oldAudioGain != null)
|
||||
{
|
||||
Audio.SetGain(restartAudio, oldAudioGain.Value, restartComp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user