Adds lobby music (#3620)
* Adds lobby music * Add UI toggle for lobby music * Pick the song serverside so everyone gets the same song * Add more songs * Fixes * Catch-all end lobby music * Rename it * Catchall ambience cvar change * Wait until we receive the lobby song to start playing one * Fix toggling ready status resetting the song * Comment * Expend the last of my sanity fixing latejoin lobby music * Update Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Update Content.Client/GameObjects/EntitySystems/BackgroundAudioSystem.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Move the var Co-authored-by: ike709 <sparebytes@protonmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ using Content.Server.Mobs;
|
||||
using Content.Server.Mobs.Roles;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Network.NetMessages;
|
||||
@@ -133,6 +134,9 @@ namespace Content.Server.GameTicking
|
||||
private TimeSpan LobbyDuration =>
|
||||
TimeSpan.FromSeconds(_configurationManager.GetCVar(CCVars.GameLobbyDuration));
|
||||
|
||||
private SoundCollectionPrototype _lobbyCollection = default!;
|
||||
[ViewVariables] public string LobbySong { get; private set; }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -155,6 +159,9 @@ namespace Content.Server.GameTicking
|
||||
|
||||
Presets = presets.ToImmutableDictionary();
|
||||
|
||||
_lobbyCollection = _prototypeManager.Index<SoundCollectionPrototype>("LobbyMusic");
|
||||
LobbySong = _robustRandom.Pick(_lobbyCollection.PickFiles);
|
||||
|
||||
_netManager.RegisterNetMessage<MsgTickerJoinLobby>(nameof(MsgTickerJoinLobby));
|
||||
_netManager.RegisterNetMessage<MsgTickerJoinGame>(nameof(MsgTickerJoinGame));
|
||||
_netManager.RegisterNetMessage<MsgTickerLobbyStatus>(nameof(MsgTickerLobbyStatus));
|
||||
@@ -219,6 +226,7 @@ namespace Content.Server.GameTicking
|
||||
RoundNumberMetric.Inc();
|
||||
|
||||
RunLevel = GameRunLevel.PreRoundLobby;
|
||||
LobbySong = _robustRandom.Pick(_lobbyCollection.PickFiles);
|
||||
_resettingCleanup();
|
||||
_preRoundSetup();
|
||||
|
||||
@@ -1042,6 +1050,7 @@ namespace Content.Server.GameTicking
|
||||
msg.StartTime = _roundStartTime;
|
||||
msg.YouAreReady = status == PlayerStatus.Ready;
|
||||
msg.Paused = Paused;
|
||||
msg.LobbySong = LobbySong;
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user