Ambience no longer plays in the lobby (#11416)
Co-authored-by: matthst <32034333+matthst@users.noreply.github.com> Co-authored-by: Matthias Steinletzberger <matthias.steinletzberger@ntsretail.com>
This commit is contained in:
@@ -135,7 +135,8 @@ namespace Content.Client.Audio
|
|||||||
private void EntParentChanged(ref EntParentChangedMessage message)
|
private void EntParentChanged(ref EntParentChangedMessage message)
|
||||||
{
|
{
|
||||||
if(_playMan.LocalPlayer is null || _playMan.LocalPlayer.ControlledEntity != message.Entity ||
|
if(_playMan.LocalPlayer is null || _playMan.LocalPlayer.ControlledEntity != message.Entity ||
|
||||||
!_timing.IsFirstTimePredicted) return;
|
!_timing.IsFirstTimePredicted)
|
||||||
|
return;
|
||||||
|
|
||||||
// Check if we traversed to grid.
|
// Check if we traversed to grid.
|
||||||
CheckAmbience(message.Transform);
|
CheckAmbience(message.Transform);
|
||||||
@@ -143,15 +144,17 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
private void ChangeAmbience(SoundCollectionPrototype newAmbience)
|
private void ChangeAmbience(SoundCollectionPrototype newAmbience)
|
||||||
{
|
{
|
||||||
if (_currentCollection == newAmbience) return;
|
if (_currentCollection == newAmbience)
|
||||||
|
return;
|
||||||
_timerCancelTokenSource.Cancel();
|
_timerCancelTokenSource.Cancel();
|
||||||
_currentCollection = newAmbience;
|
_currentCollection = newAmbience;
|
||||||
_timerCancelTokenSource = new();
|
_timerCancelTokenSource = new();
|
||||||
Timer.Spawn(1500, () =>
|
Timer.Spawn(1500, () =>
|
||||||
{
|
{
|
||||||
// If we traverse a few times then don't interrupt an existing song.
|
// If we traverse a few times then don't interrupt an existing song.
|
||||||
if (_playingCollection == _currentCollection) return;
|
// If we are not in gameplay, don't call StartAmbience because of player movement
|
||||||
EndAmbience();
|
if (_playingCollection == _currentCollection || _stateManager.CurrentState is not GameplayState)
|
||||||
|
return;
|
||||||
StartAmbience();
|
StartAmbience();
|
||||||
}, _timerCancelTokenSource.Token);
|
}, _timerCancelTokenSource.Token);
|
||||||
}
|
}
|
||||||
@@ -299,7 +302,8 @@ namespace Content.Client.Audio
|
|||||||
|
|
||||||
public void StartLobbyMusic()
|
public void StartLobbyMusic()
|
||||||
{
|
{
|
||||||
if (_lobbyStream != null || !_configManager.GetCVar(CCVars.LobbyMusicEnabled)) return;
|
if (_lobbyStream != null || !_configManager.GetCVar(CCVars.LobbyMusicEnabled))
|
||||||
|
return;
|
||||||
|
|
||||||
var file = _gameTicker.LobbySong;
|
var file = _gameTicker.LobbySong;
|
||||||
if (file == null) // We have not received the lobby song yet.
|
if (file == null) // We have not received the lobby song yet.
|
||||||
|
|||||||
Reference in New Issue
Block a user