Visualizer systems update (#8203)

* optimize appearance updating for subfloor entities

* sprite event args

* a

* stop double appearance update.
This commit is contained in:
Leon Friedrich
2022-05-16 14:41:23 +10:00
committed by GitHub
parent 920b4e5689
commit 25b9e048e5
22 changed files with 135 additions and 112 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Sticky.Components;
using Content.Shared.Sticky.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Sticky.Visualizers;
@@ -21,16 +21,14 @@ public sealed class StickyVisualizerSystem : VisualizerSystem<StickyVisualizerCo
protected override void OnAppearanceChange(EntityUid uid, StickyVisualizerComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);
if (!TryComp(uid, out SpriteComponent? sprite))
if (args.Sprite == null)
return;
if (!args.Component.TryGetData(StickyVisuals.IsStuck, out bool isStuck))
return;
var drawDepth = isStuck ? component.StuckDrawDepth : component.DefaultDrawDepth;
sprite.DrawDepth = drawDepth;
args.Sprite.DrawDepth = drawDepth;
}
}