CatStation/Content.Client/BarSign/BarSignVisualizerSystem.cs
Whatstone d9ffbf1d03
Cleanup: AppearanceSystem.TryGetData to AppearanceChangeEvent.TryGetData (#45373)
* First impl. of appearance TryGetData cleanup

* Handful of fixes

* DamageVisuals: fix HandleDamage call, inheritdoc

* bunch of unused AppearanceSystem instances

* Handful more unused appearance systems, inheritdoc

* JetpackSystem: Ent<T>

* cleanup roundup, more Ent<T>

* a few lingering AppearanceSystem.TryGetData calls

* more lingering AppearanceData access

* Remove unnecessary inheritdoc

* once again, with feeling
2026-10-05 00:45:37 +00:00

27 lines
968 B
C#

using Content.Shared.BarSign;
using Content.Shared.Power;
using Robust.Client.GameObjects;
namespace Content.Client.BarSign;
public sealed partial class BarSignVisualizerSystem : VisualizerSystem<BarSignComponent>
{
protected override void OnAppearanceChange(EntityUid uid, BarSignComponent component, ref AppearanceChangeEvent args)
{
args.TryGetData<bool>(PowerDeviceVisuals.Powered, out var powered);
args.TryGetData<string>(BarSignVisuals.BarSignPrototype, out var currentSign);
if (powered
&& currentSign != null
&& ProtoMan.Resolve<BarSignPrototype>(currentSign, out var proto))
{
SpriteSystem.LayerSetSprite((uid, args.Sprite), 0, proto.Icon);
args.Sprite?.LayerSetShader(0, "unshaded");
}
else
{
SpriteSystem.LayerSetRsiState((uid, args.Sprite), 0, "empty");
args.Sprite?.LayerSetShader(0, null, null);
}
}
}