Fixes lobby backgrounds. (#7557)
This commit is contained in:
@@ -95,6 +95,7 @@ namespace Content.Client.Entry
|
|||||||
prototypes.RegisterIgnore("aiFaction");
|
prototypes.RegisterIgnore("aiFaction");
|
||||||
prototypes.RegisterIgnore("gameMap");
|
prototypes.RegisterIgnore("gameMap");
|
||||||
prototypes.RegisterIgnore("behaviorSet");
|
prototypes.RegisterIgnore("behaviorSet");
|
||||||
|
prototypes.RegisterIgnore("lobbyBackground");
|
||||||
prototypes.RegisterIgnore("advertisementsPack");
|
prototypes.RegisterIgnore("advertisementsPack");
|
||||||
prototypes.RegisterIgnore("metabolizerType");
|
prototypes.RegisterIgnore("metabolizerType");
|
||||||
prototypes.RegisterIgnore("metabolismGroup");
|
prototypes.RegisterIgnore("metabolismGroup");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Server.GameTicking.Prototypes;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
@@ -25,8 +26,11 @@ public sealed partial class GameTicker
|
|||||||
|
|
||||||
private void InitializeLobbyBackground()
|
private void InitializeLobbyBackground()
|
||||||
{
|
{
|
||||||
_lobbyBackgrounds = _resourceManager.ContentFindFiles(new ResourcePath(LobbyScreenPath)).ToList();
|
_lobbyBackgrounds = _prototypeManager.EnumeratePrototypes<LobbyBackgroundPrototype>()
|
||||||
_lobbyBackgrounds = _lobbyBackgrounds.FindAll(path => WhitelistedBackgroundExtensions.Contains((path.Extension)));
|
.Select(x => x.Background)
|
||||||
|
.Where(x => WhitelistedBackgroundExtensions.Contains(x.Extension))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
LobbyBackground = _lobbyBackgrounds.Any() ? _robustRandom.Pick(_lobbyBackgrounds).ToString() : null;
|
LobbyBackground = _lobbyBackgrounds.Any() ? _robustRandom.Pick(_lobbyBackgrounds).ToString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Server.GameTicking.Prototypes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prototype for a lobby background the game can choose.
|
||||||
|
/// </summary>
|
||||||
|
[Prototype("lobbyBackground")]
|
||||||
|
public sealed class LobbyBackgroundPrototype : IPrototype
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
[IdDataField]
|
||||||
|
public string ID { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sprite to use as the background. This should ideally be 1920x1080.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("background", required: true)]
|
||||||
|
public ResourcePath Background = default!;
|
||||||
|
}
|
||||||
7
Resources/Prototypes/lobbyscreens.yml
Normal file
7
Resources/Prototypes/lobbyscreens.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
- type: lobbyBackground
|
||||||
|
id: Robotics
|
||||||
|
background: /Textures/LobbyScreens/robotics.png
|
||||||
|
|
||||||
|
- type: lobbyBackground
|
||||||
|
id: Supermatter
|
||||||
|
background: /Textures/LobbyScreens/supermatter.png
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
Note:
|
Note:
|
||||||
Only png and jpgs files are supported
|
Only png and jpgs files are supported, and you need a prototype in Resources/Prototypes/lobbyscreens.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user