lobby update (#554)

This commit is contained in:
ThereDrD0
2024-08-04 11:43:00 +03:00
committed by GitHub
parent 1fbb613f8a
commit 0ce44fbe64
28 changed files with 794 additions and 131 deletions

View File

@@ -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!;

View File

@@ -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;
}
}