Airlock visuals (#7261)

This commit is contained in:
Joosep Jääger
2022-04-16 05:31:12 +00:00
committed by GitHub
parent 636dc9c26a
commit 0cdb34741e
23 changed files with 528 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
using Robust.Shared.Serialization;
namespace Content.Shared.AirlockPainter
{
[Serializable, NetSerializable]
public enum AirlockPainterUiKey
{
Key,
}
[Serializable, NetSerializable]
public sealed class AirlockPainterSpritePickedMessage : BoundUserInterfaceMessage
{
public int Index { get; }
public AirlockPainterSpritePickedMessage(int index)
{
Index = index;
}
}
[Serializable, NetSerializable]
public sealed class AirlockPainterBoundUserInterfaceState : BoundUserInterfaceState
{
public int SelectedStyle { get; }
public AirlockPainterBoundUserInterfaceState(int selectedStyle)
{
SelectedStyle = selectedStyle;
}
}
}

View File

@@ -0,0 +1,12 @@
using Content.Shared.AirlockPainter.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.AirlockPainter
{
[RegisterComponent]
public sealed class PaintableAirlockComponent : Component
{
[DataField("group", customTypeSerializer:typeof(PrototypeIdSerializer<AirlockGroupPrototype>))]
public string Group = default!;
}
}

View File

@@ -0,0 +1,20 @@
using Robust.Shared.Prototypes;
namespace Content.Shared.AirlockPainter.Prototypes
{
[Prototype("AirlockGroup")]
public sealed class AirlockGroupPrototype : IPrototype
{
[IdDataField]
public string ID { get; } = default!;
[DataField("stylePaths")]
public Dictionary<string, string> StylePaths = default!;
// The priority determines, which sprite is used when showing
// the icon for a style in the airlock painter UI. The highest priority
// gets shown.
[DataField("iconPriority")]
public int IconPriority = 0;
}
}

View File

@@ -0,0 +1,30 @@
using System.Linq;
using Content.Shared.AirlockPainter.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.AirlockPainter
{
public abstract class SharedAirlockPainterSystem : EntitySystem
{
[Dependency] protected readonly IPrototypeManager _prototypeManager = default!;
public List<string> Styles { get; private set; } = new();
public List<AirlockGroupPrototype> Groups { get; private set; } = new();
public override void Initialize()
{
base.Initialize();
HashSet<string> styles = new();
foreach (AirlockGroupPrototype grp in _prototypeManager.EnumeratePrototypes<AirlockGroupPrototype>())
{
Groups.Add(grp);
foreach (string style in grp.StylePaths.Keys)
{
styles.Add(style);
}
}
Styles = styles.ToList();
}
}
}

View File

@@ -249,6 +249,7 @@ public enum DoorVisuals
Powered,
BoltLights,
EmergencyLights,
BaseRSI,
}
[Serializable, NetSerializable]