* refactor and add Department to PaintableAirlock, move it to server dir since its in namespace * add departments to doors, cleanup * add style -> departments mapping * AirlockDepartmentsPrototype * update shared spray stuff to have department * name file the same as the class name * department optional * refactor spray painter system + send department * fixy * client * no need to rewrite ActivateableUi * pro ops * the reckoning * hiss * . * :trollface: * add standard atmos colors to palette * Update Content.Shared/SprayPainter/SharedSprayPainterSystem.cs --------- Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
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;
|
|
using Robust.Shared.Graphics;
|
|
|
|
namespace Content.Client.SprayPainter;
|
|
|
|
public sealed class SprayPainterSystem : SharedSprayPainterSystem
|
|
{
|
|
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
|
|
|
public List<SprayPainterEntry> Entries { get; private set; } = new();
|
|
|
|
protected override void CacheStyles()
|
|
{
|
|
base.CacheStyles();
|
|
|
|
Entries.Clear();
|
|
foreach (var style in Styles)
|
|
{
|
|
var name = style.Name;
|
|
string? iconPath = Groups
|
|
.FindAll(x => x.StylePaths.ContainsKey(name))?
|
|
.MaxBy(x => x.IconPriority)?.StylePaths[name];
|
|
if (iconPath == null)
|
|
{
|
|
Entries.Add(new SprayPainterEntry(name, null));
|
|
continue;
|
|
}
|
|
|
|
RSIResource doorRsi = _resourceCache.GetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath));
|
|
if (!doorRsi.RSI.TryGetState("closed", out var icon))
|
|
{
|
|
Entries.Add(new SprayPainterEntry(name, null));
|
|
continue;
|
|
}
|
|
|
|
Entries.Add(new SprayPainterEntry(name, icon.Frame0));
|
|
}
|
|
}
|
|
}
|
|
|
|
public sealed class SprayPainterEntry
|
|
{
|
|
public string Name;
|
|
public Texture? Icon;
|
|
|
|
public SprayPainterEntry(string name, Texture? icon)
|
|
{
|
|
Name = name;
|
|
Icon = icon;
|
|
}
|
|
}
|