spray painter rework (#23287)
* 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>
This commit is contained in:
@@ -14,29 +14,31 @@ public sealed class SprayPainterSystem : SharedSprayPainterSystem
|
||||
|
||||
public List<SprayPainterEntry> Entries { get; private set; } = new();
|
||||
|
||||
public override void Initialize()
|
||||
protected override void CacheStyles()
|
||||
{
|
||||
base.Initialize();
|
||||
base.CacheStyles();
|
||||
|
||||
foreach (string style in Styles)
|
||||
Entries.Clear();
|
||||
foreach (var style in Styles)
|
||||
{
|
||||
var name = style.Name;
|
||||
string? iconPath = Groups
|
||||
.FindAll(x => x.StylePaths.ContainsKey(style))?
|
||||
.MaxBy(x => x.IconPriority)?.StylePaths[style];
|
||||
.FindAll(x => x.StylePaths.ContainsKey(name))?
|
||||
.MaxBy(x => x.IconPriority)?.StylePaths[name];
|
||||
if (iconPath == null)
|
||||
{
|
||||
Entries.Add(new SprayPainterEntry(style, 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(style, null));
|
||||
Entries.Add(new SprayPainterEntry(name, null));
|
||||
continue;
|
||||
}
|
||||
|
||||
Entries.Add(new SprayPainterEntry(style, icon.Frame0));
|
||||
Entries.Add(new SprayPainterEntry(name, icon.Frame0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.SprayPainter;
|
||||
using Content.Shared.SprayPainter.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
@@ -20,14 +21,20 @@ public sealed class SprayPainterBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
base.Open();
|
||||
|
||||
if (!EntMan.TryGetComponent<SprayPainterComponent>(Owner, out var comp))
|
||||
return;
|
||||
|
||||
_window = new SprayPainterWindow();
|
||||
|
||||
_painter = EntMan.System<SprayPainterSystem>();
|
||||
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += Close;
|
||||
_window.OnSpritePicked = OnSpritePicked;
|
||||
_window.OnColorPicked = OnColorPicked;
|
||||
|
||||
_window.Populate(_painter.Entries, comp.Index, comp.PickedColor, comp.ColorPalette);
|
||||
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
@@ -37,25 +44,6 @@ public sealed class SprayPainterBoundUserInterface : BoundUserInterface
|
||||
_window?.Dispose();
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
||||
if (_window == null)
|
||||
return;
|
||||
|
||||
if (_painter == null)
|
||||
return;
|
||||
|
||||
if (state is not SprayPainterBoundUserInterfaceState stateCast)
|
||||
return;
|
||||
|
||||
_window.Populate(_painter.Entries,
|
||||
stateCast.SelectedStyle,
|
||||
stateCast.SelectedColorKey,
|
||||
stateCast.Palette);
|
||||
}
|
||||
|
||||
private void OnSpritePicked(ItemList.ItemListSelectedEventArgs args)
|
||||
{
|
||||
SendMessage(new SprayPainterSpritePickedMessage(args.ItemIndex));
|
||||
|
||||
Reference in New Issue
Block a user