Round end audio (#8048)

This commit is contained in:
metalgearsloth
2022-05-13 10:13:07 +10:00
committed by GitHub
parent 5fe643f900
commit 798af00ad2
8 changed files with 40 additions and 5 deletions

View File

@@ -70,15 +70,18 @@ namespace Content.Client.Audio
private void StateManagerOnStateChanged(StateChangedEventArgs args)
{
EndAmbience();
EndLobbyMusic();
if (args.NewState is LobbyState && _configManager.GetCVar(CCVars.LobbyMusicEnabled))
{
StartLobbyMusic();
return;
}
else if (args.NewState is GameScreen)
{
StartAmbience();
}
EndLobbyMusic();
}
private void OnJoin(object? sender, PlayerEventArgs args)
@@ -156,9 +159,17 @@ namespace Content.Client.Audio
StartLobbyMusic();
}
}
private void StartLobbyMusic()
public void RestartLobbyMusic()
{
EndLobbyMusic();
StartLobbyMusic();
}
public void StartLobbyMusic()
{
if (_lobbyStream != null) return;
var file = _gameTicker.LobbySong;
if (file == null) // We have not received the lobby song yet.
{

View File

@@ -1,3 +1,4 @@
using Content.Client.Audio;
using Content.Client.Lobby;
using Content.Client.RoundEnd;
using Content.Client.Viewport;
@@ -121,6 +122,12 @@ namespace Content.Client.GameTicking.Managers
private void RoundEnd(RoundEndMessageEvent message)
{
if (message.LobbySong != null)
{
LobbySong = message.LobbySong;
Get<BackgroundAudioSystem>().StartLobbyMusic();
}
//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);
}

View File

@@ -326,7 +326,7 @@ namespace Content.Server.GameTicking
// This ordering mechanism isn't great (no ordering of minds) but functions
var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray();
_playersInGame.Clear();
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal));
RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong));
}
public void RestartRound()
@@ -351,6 +351,7 @@ namespace Content.Server.GameTicking
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
RandomizeLobbyBackground();
ResettingCleanup();
SoundSystem.Play(Filter.Broadcast(), new SoundCollectionSpecifier("RoundEnd").GetSound());
if (!LobbyEnabled)
{

View File

@@ -138,9 +138,16 @@ namespace Content.Shared.GameTicking
public int RoundId { get; }
public int PlayerCount { get; }
public RoundEndPlayerInfo[] AllPlayersEndInfo { get; }
public string? LobbySong;
public RoundEndMessageEvent(string gamemodeTitle, string roundEndText, TimeSpan roundDuration, int roundId,
int playerCount, RoundEndPlayerInfo[] allPlayersEndInfo)
public RoundEndMessageEvent(
string gamemodeTitle,
string roundEndText,
TimeSpan roundDuration,
int roundId,
int playerCount,
RoundEndPlayerInfo[] allPlayersEndInfo,
string? lobbySong)
{
GamemodeTitle = gamemodeTitle;
RoundEndText = roundEndText;
@@ -148,6 +155,7 @@ namespace Content.Shared.GameTicking
RoundId = roundId;
PlayerCount = playerCount;
AllPlayersEndInfo = allPlayersEndInfo;
LobbySong = lobbySong;
}
}

Binary file not shown.

View File

@@ -0,0 +1,3 @@
apc_destroyed.ogg taken from https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0
bangin_donk.ogg taken from /tg/station at commit https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0

View File

@@ -0,0 +1,5 @@
- type: soundCollection
id: RoundEnd
files:
- /Audio/Announcements/RoundEnd/apc_destroyed.ogg
- /Audio/Announcements/RoundEnd/bangin_donk.ogg