Pipe painter (now with airlock painter) (#19031)

* Add a pipe painting function to the airlock painter

Signed-off-by: c4llv07e <kseandi@gmail.com>

* Rename engineer painter to omnipainter

Signed-off-by: c4llv07e <kseandi@gmail.com>

* review changes

Signed-off-by: c4llv07e <kseandi@gmail.com>

* fix migration duplicate

Signed-off-by: c4llv07e <kseandi@gmail.com>

---------

Signed-off-by: c4llv07e <kseandi@gmail.com>
This commit is contained in:
c4llv07e
2023-08-14 12:06:21 +00:00
committed by GitHub
parent 3b7a23bde4
commit d7eb3bfb44
36 changed files with 649 additions and 446 deletions

View File

@@ -1,51 +0,0 @@
using Content.Shared.DoAfter;
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;
}
}
[Serializable, NetSerializable]
public sealed class AirlockPainterDoAfterEvent : DoAfterEvent
{
[DataField("sprite", required: true)]
public readonly string Sprite = default!;
private AirlockPainterDoAfterEvent()
{
}
public AirlockPainterDoAfterEvent(string sprite)
{
Sprite = sprite;
}
public override DoAfterEvent Clone() => this;
}
}

View File

@@ -1,12 +0,0 @@
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

@@ -1,20 +0,0 @@
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

@@ -1,30 +0,0 @@
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();
SortedSet<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

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

View File

@@ -0,0 +1,19 @@
using Robust.Shared.Prototypes;
namespace Content.Shared.SprayPainter.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 SprayPainter UI. The highest priority
// gets shown.
[DataField("iconPriority")]
public int IconPriority = 0;
}

View File

@@ -0,0 +1,29 @@
using System.Linq;
using Content.Shared.SprayPainter.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.SprayPainter;
public abstract class SharedSprayPainterSystem : 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();
SortedSet<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

@@ -0,0 +1,69 @@
using Content.Shared.DoAfter;
using Robust.Shared.Serialization;
namespace Content.Shared.SprayPainter;
[Serializable, NetSerializable]
public enum SprayPainterUiKey
{
Key,
}
[Serializable, NetSerializable]
public sealed class SprayPainterSpritePickedMessage : BoundUserInterfaceMessage
{
public int Index { get; }
public SprayPainterSpritePickedMessage(int index)
{
Index = index;
}
}
[Serializable, NetSerializable]
public sealed class SprayPainterColorPickedMessage : BoundUserInterfaceMessage
{
public string? Key { get; }
public SprayPainterColorPickedMessage(string? key)
{
Key = key;
}
}
[Serializable, NetSerializable]
public sealed class SprayPainterBoundUserInterfaceState : BoundUserInterfaceState
{
public int SelectedStyle { get; }
public string? SelectedColorKey { get; }
public Dictionary<string, Color> Palette { get; }
public SprayPainterBoundUserInterfaceState(int selectedStyle, string? selectedColorKey, Dictionary<string, Color> palette)
{
SelectedStyle = selectedStyle;
SelectedColorKey = selectedColorKey;
Palette = palette;
}
}
[Serializable, NetSerializable]
public sealed class SprayPainterDoAfterEvent : DoAfterEvent
{
[DataField("sprite")]
public readonly string? Sprite = null;
[DataField("color")]
public readonly Color? Color = null;
private SprayPainterDoAfterEvent()
{
}
public SprayPainterDoAfterEvent(string? sprite, Color? color)
{
Sprite = sprite;
Color = color;
}
public override DoAfterEvent Clone() => this;
}