mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* 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
30 lines
994 B
C#
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);
|
|
}
|
|
}
|