mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +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
31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using Content.Client.SubFloor;
|
|
using Content.Shared.Wires;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Power.Visualizers;
|
|
|
|
public sealed partial class CableVisualizerSystem : EntitySystem
|
|
{
|
|
[Dependency] private SpriteSystem _sprite = default!;
|
|
|
|
[SubscribeLocalEvent(after: [typeof(SubFloorHideSystem)])]
|
|
private void OnAppearanceChange(Entity<CableVisualizerComponent> ent, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
if (!args.Sprite.Visible)
|
|
{
|
|
// This entity is probably below a floor and is not even visible to the user -> don't bother updating sprite data.
|
|
// Note that if the subfloor visuals change, then another AppearanceChangeEvent will get triggered.
|
|
return;
|
|
}
|
|
|
|
if (!args.TryGetData<WireVisDirFlags>(WireVisVisuals.ConnectedMask, out var mask))
|
|
mask = WireVisDirFlags.None;
|
|
|
|
_sprite.LayerSetRsiState((ent, args.Sprite), 0, $"{ent.Comp.StatePrefix}{(int)mask}");
|
|
if (ent.Comp.ExtraLayerPrefix != null)
|
|
_sprite.LayerSetRsiState((ent, args.Sprite), 1, $"{ent.Comp.ExtraLayerPrefix}{(int)mask}");
|
|
}
|
|
}
|