lobby update (#554)
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Content.Server.Audio;
|
||||
public sealed class ContentAudioSystem : SharedContentAudioSystem
|
||||
{
|
||||
[ValidatePrototypeId<SoundCollectionPrototype>]
|
||||
private const string LobbyMusicCollection = "LobbyMusicSongs";
|
||||
private const string LobbyMusicCollection = "LobbyMusicWhitePack";
|
||||
|
||||
[Dependency] private readonly AudioSystem _serverAudio = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.GameTicking.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using Content.Shared._White;
|
||||
|
||||
namespace Content.Server.GameTicking;
|
||||
|
||||
@@ -11,21 +10,19 @@ public sealed partial class GameTicker
|
||||
public string? LobbyBackground { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
private List<ResPath>? _lobbyBackgrounds;
|
||||
|
||||
private static readonly string[] WhitelistedBackgroundExtensions = new string[] {"png", "jpg", "jpeg", "webp"};
|
||||
private List<string>? _lobbyBackgrounds;
|
||||
|
||||
private void InitializeLobbyBackground()
|
||||
{
|
||||
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>()
|
||||
.Select(x => x.Background)
|
||||
.Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension))
|
||||
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<AnimatedLobbyScreenPrototype>()
|
||||
.Select(x => x.Path)
|
||||
.ToList();
|
||||
|
||||
RandomizeLobbyBackground();
|
||||
}
|
||||
|
||||
private void RandomizeLobbyBackground() {
|
||||
LobbyBackground = _lobbyBackgrounds!.Any() ? _robustRandom.Pick(_lobbyBackgrounds!).ToString() : null;
|
||||
private void RandomizeLobbyBackground()
|
||||
{
|
||||
LobbyBackground = _lobbyBackgrounds!.Any() ? _robustRandom.Pick(_lobbyBackgrounds!) : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user