This commit is contained in:
Moony
2022-04-16 17:23:22 -05:00
committed by GitHub
parent 5c5f9efbc8
commit 88549da309
2 changed files with 6 additions and 3 deletions

View File

@@ -22,8 +22,6 @@ public sealed partial class GameTicker
private static readonly string[] WhitelistedBackgroundExtensions = new string[] {"png", "jpg", "jpeg"}; private static readonly string[] WhitelistedBackgroundExtensions = new string[] {"png", "jpg", "jpeg"};
private const string LobbyScreenPath = "/Textures/LobbyScreens";
private void InitializeLobbyBackground() private void InitializeLobbyBackground()
{ {
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>() _lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>()
@@ -31,7 +29,11 @@ public sealed partial class GameTicker
.Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension)) .Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension))
.ToList(); .ToList();
LobbyBackground = _lobbyBackgrounds.Any() ? _robustRandom.Pick(_lobbyBackgrounds).ToString() : null; RandomizeLobbyBackground();
} }
private void RandomizeLobbyBackground() {
LobbyBackground = _lobbyBackgrounds!.Any() ? _robustRandom.Pick(_lobbyBackgrounds!).ToString() : null;
}
} }

View File

@@ -348,6 +348,7 @@ namespace Content.Server.GameTicking
RunLevel = GameRunLevel.PreRoundLobby; RunLevel = GameRunLevel.PreRoundLobby;
LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString(); LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString();
RandomizeLobbyBackground();
ResettingCleanup(); ResettingCleanup();
if (!LobbyEnabled) if (!LobbyEnabled)