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

@@ -0,0 +1,53 @@
using Content.Shared.SprayPainter;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Utility;
using System.Linq;
namespace Content.Client.SprayPainter;
public sealed class SprayPainterSystem : SharedSprayPainterSystem
{
[Dependency] private readonly IResourceCache _resourceCache = default!;
public List<SprayPainterEntry> Entries { get; private set; } = new();
public override void Initialize()
{
base.Initialize();
foreach (string style in Styles)
{
string? iconPath = Groups
.FindAll(x => x.StylePaths.ContainsKey(style))?
.MaxBy(x => x.IconPriority)?.StylePaths[style];
if (iconPath == null)
{
Entries.Add(new SprayPainterEntry(style, null));
continue;
}
RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath));
if (!doorRsi.RSI.TryGetState("closed", out var icon))
{
Entries.Add(new SprayPainterEntry(style, null));
continue;
}
Entries.Add(new SprayPainterEntry(style, icon.Frame0));
}
}
}
public sealed class SprayPainterEntry
{
public string Name;
public Texture? Icon;
public SprayPainterEntry(string name, Texture? icon)
{
Name = name;
Icon = icon;
}
}