Files
tbd-station-14/Content.Client/Power/Visualizers/CableVisualizerSystem.cs
Linkbro 0d70d6bfdf New Sprites for cables (#34955)
* initial textures

* Makes it have layers because Milon wanted it

* Makes it have layers because Milon wanted it

* in do NOT understand github

* tested, works

* Update Content.Client/Power/Visualizers/CableVisualizerComponent.cs

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>

* Update Content.Client/Power/Visualizers/CableVisualizerComponent.cs

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>

* remove extra newline

* EmoGarbage Review - Adjust MV cables to use orange stripes

---------

Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com>
Co-authored-by: Milon <milonpl.git@proton.me>
Co-authored-by: EmoGarbage404 <retron404@gmail.com>
2025-04-16 16:26:25 -04:00

38 lines
1.3 KiB
C#

using Content.Client.SubFloor;
using Content.Shared.Wires;
using Robust.Client.GameObjects;
namespace Content.Client.Power.Visualizers;
public sealed class CableVisualizerSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CableVisualizerComponent, AppearanceChangeEvent>(OnAppearanceChange, after: new[] { typeof(SubFloorHideSystem) });
}
private void OnAppearanceChange(EntityUid uid, CableVisualizerComponent component, 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 (!_appearanceSystem.TryGetData<WireVisDirFlags>(uid, WireVisVisuals.ConnectedMask, out var mask, args.Component))
mask = WireVisDirFlags.None;
args.Sprite.LayerSetState(0, $"{component.StatePrefix}{(int) mask}");
if (component.ExtraLayerPrefix != null)
args.Sprite.LayerSetState(1, $"{component.ExtraLayerPrefix}{(int) mask}");
}
}