Visualizer systems update (#8203)
* optimize appearance updating for subfloor entities * sprite event args * a * stop double appearance update.
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user