Fix Round Restarted Announcements not playing (#23387)

* Fix Round Restarted Announcements not playing

Just make the RoundFlow manager play the funny
announcement sound effect, rather than pass it
through to players in an event that doesn't work.

Only three round end announcements probably
isn't enough. Maybe it is time for fresh memes.

* Remove the handling in ClientGameTicker.

* Pass in a specific filepass to broadcast.

* you make one line change in vscode and the linter
goes AH-HAH I CAN HELP YOU LET ME CLEAN
THIS UP and I'm like 😔 and have to revert
This commit is contained in:
Hannah Giovanna Dawson
2024-01-06 03:15:28 +00:00
committed by GitHub
parent a2fdad31ed
commit a9075e5d24
3 changed files with 7 additions and 28 deletions

View File

@@ -35,7 +35,6 @@ 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; }
@@ -68,7 +67,6 @@ namespace Content.Client.GameTicking.Managers
}); });
SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus); SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus);
SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable); SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable);
SubscribeNetworkEvent<RoundRestartCleanupEvent>(RoundRestartCleanup);
_initialized = true; _initialized = true;
} }
@@ -147,7 +145,6 @@ namespace Content.Client.GameTicking.Managers
{ {
// Force an update in the event of this song being the same as the last. // Force an update in the event of this song being the same as the last.
SetLobbySong(message.LobbySong, true); SetLobbySong(message.LobbySong, true);
RestartSound = message.RestartSound;
// Don't open duplicate windows (mainly for replays). // Don't open duplicate windows (mainly for replays).
if (_window?.RoundId == message.RoundId) if (_window?.RoundId == message.RoundId)
@@ -156,22 +153,5 @@ namespace Content.Client.GameTicking.Managers
//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.
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager); _window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
} }
private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
{
if (string.IsNullOrEmpty(RestartSound))
return;
if (!_configManager.GetCVar(CCVars.RestartSoundsEnabled))
{
RestartSound = null;
return;
}
_audio.PlayGlobal(RestartSound, Filter.Local(), false);
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
RestartSound = null;
}
} }
} }

View File

@@ -387,8 +387,7 @@ namespace Content.Server.GameTicking
var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray(); var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray();
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId,
listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong));
new SoundCollectionSpecifier("RoundEnd").GetSound()));
} }
private async void SendRoundEndDiscordMessage() private async void SendRoundEndDiscordMessage()
@@ -523,8 +522,11 @@ namespace Content.Server.GameTicking
_playerGameStatuses.Clear(); _playerGameStatuses.Clear();
foreach (var session in _playerManager.Sessions) foreach (var session in _playerManager.Sessions)
{ {
_playerGameStatuses[session.UserId] = LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay; _playerGameStatuses[session.UserId] = LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay;
} }
// Put a bangin' donk on it.
_audio.PlayGlobal(_audio.GetSound(new SoundCollectionSpecifier("RoundEnd")), Filter.Broadcast(), true);
} }
public bool DelayStart(TimeSpan time) public bool DelayStart(TimeSpan time)
@@ -538,7 +540,7 @@ namespace Content.Server.GameTicking
RaiseNetworkEvent(new TickerLobbyCountdownEvent(_roundStartTime, Paused)); RaiseNetworkEvent(new TickerLobbyCountdownEvent(_roundStartTime, Paused));
_chatManager.DispatchServerAnnouncement(Loc.GetString("game-ticker-delay-start", ("seconds",time.TotalSeconds))); _chatManager.DispatchServerAnnouncement(Loc.GetString("game-ticker-delay-start", ("seconds", time.TotalSeconds)));
return true; return true;
} }

View File

@@ -166,8 +166,7 @@ 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;
@@ -176,11 +175,9 @@ namespace Content.Shared.GameTicking
PlayerCount = playerCount; PlayerCount = playerCount;
AllPlayersEndInfo = allPlayersEndInfo; AllPlayersEndInfo = allPlayersEndInfo;
LobbySong = lobbySong; LobbySong = lobbySong;
RestartSound = restartSound;
} }
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]
public enum PlayerGameStatus : sbyte public enum PlayerGameStatus : sbyte
{ {