Round end sound now respects lobby music option toggle. (#8699)
Now it only plays when the round restarts *after* a regular roundend. Meaning that if you spam the "restartroundnow" command, it won't play even if you have roundend sounds enabled in the options.
This commit is contained in:
committed by
GitHub
parent
2bc332a1b6
commit
0c337d6235
@@ -7,7 +7,9 @@ using Content.Shared.GameWindow;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Client.GameTicking.Managers
|
namespace Content.Client.GameTicking.Managers
|
||||||
@@ -23,6 +25,7 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
[ViewVariables] public bool AreWeReady { get; private set; }
|
[ViewVariables] public bool AreWeReady { get; private set; }
|
||||||
[ViewVariables] public bool IsGameStarted { get; private set; }
|
[ViewVariables] public bool IsGameStarted { get; private set; }
|
||||||
[ViewVariables] public string? LobbySong { get; private set; }
|
[ViewVariables] public string? LobbySong { get; private set; }
|
||||||
|
[ViewVariables] public string? RestartSound { get; private set; }
|
||||||
[ViewVariables] public string? LobbyBackground { get; private set; }
|
[ViewVariables] public string? LobbyBackground { get; private set; }
|
||||||
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
|
[ViewVariables] public bool DisallowedLateJoin { get; private set; }
|
||||||
[ViewVariables] public string? ServerInfoBlob { get; private set; }
|
[ViewVariables] public string? ServerInfoBlob { get; private set; }
|
||||||
@@ -55,6 +58,7 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
});
|
});
|
||||||
SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus);
|
SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus);
|
||||||
SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable);
|
SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable);
|
||||||
|
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup);
|
||||||
|
|
||||||
Status = new Dictionary<NetUserId, LobbyPlayerStatus>();
|
Status = new Dictionary<NetUserId, LobbyPlayerStatus>();
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
@@ -128,8 +132,21 @@ namespace Content.Client.GameTicking.Managers
|
|||||||
Get<BackgroundAudioSystem>().StartLobbyMusic();
|
Get<BackgroundAudioSystem>().StartLobbyMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RestartSound = message.RestartSound;
|
||||||
|
|
||||||
//This is not ideal at all, but I don't see an immediately better fit anywhere else.
|
//This is not ideal at all, but I don't see an immediately better fit anywhere else.
|
||||||
var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo);
|
var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(RestartSound))
|
||||||
|
return;
|
||||||
|
|
||||||
|
SoundSystem.Play(Filter.Empty(), RestartSound);
|
||||||
|
|
||||||
|
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
|
||||||
|
RestartSound = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,7 +326,10 @@ namespace Content.Server.GameTicking
|
|||||||
// This ordering mechanism isn't great (no ordering of minds) but functions
|
// This ordering mechanism isn't great (no ordering of minds) but functions
|
||||||
var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray();
|
var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray();
|
||||||
_playersInGame.Clear();
|
_playersInGame.Clear();
|
||||||
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong));
|
|
||||||
|
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId,
|
||||||
|
listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong,
|
||||||
|
new SoundCollectionSpecifier("RoundEnd").GetSound()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestartRound()
|
public void RestartRound()
|
||||||
@@ -349,7 +352,6 @@ namespace Content.Server.GameTicking
|
|||||||
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
|
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
|
||||||
RandomizeLobbyBackground();
|
RandomizeLobbyBackground();
|
||||||
ResettingCleanup();
|
ResettingCleanup();
|
||||||
SoundSystem.Play(Filter.Broadcast(), new SoundCollectionSpecifier("RoundEnd").GetSound());
|
|
||||||
|
|
||||||
if (!LobbyEnabled)
|
if (!LobbyEnabled)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ namespace Content.Shared.GameTicking
|
|||||||
public int PlayerCount { get; }
|
public int PlayerCount { get; }
|
||||||
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
|
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
|
||||||
public string? LobbySong;
|
public string? LobbySong;
|
||||||
|
public string? RestartSound;
|
||||||
|
|
||||||
public RoundEndMessageEvent(
|
public RoundEndMessageEvent(
|
||||||
string gamemodeTitle,
|
string gamemodeTitle,
|
||||||
@@ -147,7 +148,8 @@ namespace Content.Shared.GameTicking
|
|||||||
int roundId,
|
int roundId,
|
||||||
int playerCount,
|
int playerCount,
|
||||||
RoundEndPlayerInfo[] allPlayersEndInfo,
|
RoundEndPlayerInfo[] allPlayersEndInfo,
|
||||||
string? lobbySong)
|
string? lobbySong,
|
||||||
|
string? restartSound)
|
||||||
{
|
{
|
||||||
GamemodeTitle = gamemodeTitle;
|
GamemodeTitle = gamemodeTitle;
|
||||||
RoundEndText = roundEndText;
|
RoundEndText = roundEndText;
|
||||||
@@ -156,6 +158,7 @@ namespace Content.Shared.GameTicking
|
|||||||
PlayerCount = playerCount;
|
PlayerCount = playerCount;
|
||||||
AllPlayersEndInfo = allPlayersEndInfo;
|
AllPlayersEndInfo = allPlayersEndInfo;
|
||||||
LobbySong = lobbySong;
|
LobbySong = lobbySong;
|
||||||
|
RestartSound = restartSound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user