CatStation/Content.Client/Sticky/Visualizers/StickyVisualizerSystem.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

30 lines
994 B
C#

using Content.Shared.Sticky.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Sticky.Visualizers;
public sealed partial class StickyVisualizerSystem : VisualizerSystem<StickyVisualizerComponent>
{
[Dependency] private EntityQuery<SpriteComponent> _spriteQuery = default!;
[SubscribeLocalEvent]
private void OnInit(Entity<StickyVisualizerComponent> ent, ref ComponentInit args)
{
if (!_spriteQuery.TryComp(ent, out var sprite))
return;
ent.Comp.OriginalDrawDepth = sprite.DrawDepth;
}
protected override void OnAppearanceChange(EntityUid uid, StickyVisualizerComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (!args.TryGetData<bool>(StickyVisuals.IsStuck, out var isStuck))
return;
var drawDepth = isStuck ? comp.StuckDrawDepth : comp.OriginalDrawDepth;
SpriteSystem.SetDrawDepth((uid, args.Sprite), drawDepth);
}
}