From: 08A Date: Mon, 6 Mar 2023 17:01:35 +0000 (+0100) Subject: Fix appearance system (#14425) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=dbc9baf2e5ea995349e48c0cfccbfe0d69afbe9b;p=space-station-14.git Fix appearance system (#14425) --- diff --git a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs index 1d38e24db9..a9c5b53192 100644 --- a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -44,6 +44,18 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem } } + private void HideAllPipeConnection(SpriteComponent sprite) + { + foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer))) + { + if (!sprite.LayerMapTryGet(layerKey, out var key)) + continue; + + var layer = sprite[key]; + layer.Visible = false; + } + } + private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent component, ref AppearanceChangeEvent args) { if (args.Sprite == null) @@ -56,11 +68,14 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem return; } - if (!_appearance.TryGetData(uid, PipeColorVisuals.Color, out var color, args.Component)) - color = Color.White; - if (!_appearance.TryGetData(uid, PipeVisuals.VisualState, out var worldConnectedDirections, args.Component)) + { + HideAllPipeConnection(args.Sprite); return; + } + + if (!_appearance.TryGetData(uid, PipeColorVisuals.Color, out var color, args.Component)) + color = Color.White; // transform connected directions to local-coordinates var connectedDirections = worldConnectedDirections.RotatePipeDirection(-Transform(uid).LocalRotation);