Fixes lobby backgrounds. (#7557)

This commit is contained in:
Moony
2022-04-14 23:00:59 -05:00
committed by GitHub
parent 1334ed6311
commit 148bde13c2
5 changed files with 37 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
using System.IO;
using System.Linq;
using Content.Server.GameTicking.Prototypes;
using Content.Shared.Audio;
using Robust.Shared.ContentPack;
using Robust.Shared.Random;
@@ -25,8 +26,11 @@ public sealed partial class GameTicker
private void InitializeLobbyBackground()
{
_lobbyBackgrounds = _resourceManager.ContentFindFiles(new ResourcePath(LobbyScreenPath)).ToList();
_lobbyBackgrounds = _lobbyBackgrounds.FindAll(path => WhitelistedBackgroundExtensions.Contains((path.Extension)));
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>()
.Select(x => x.Background)
.Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension))
.ToList();
LobbyBackground = _lobbyBackgrounds.Any() ? _robustRandom.Pick(_lobbyBackgrounds).ToString() : null;
}