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:
53
Content.Client/SprayPainter/SprayPainterSystem.cs
Normal file
53
Content.Client/SprayPainter/SprayPainterSystem.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user