From 507a1b9f844e738b08be55f57dd02bd07ce988ff Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 25 Oct 2021 14:24:54 +1100 Subject: [PATCH] Fix gas pipe rotation rendering (#5015) --- .../Atmos/Visualizers/PipeConnectorVisualizer.cs | 11 ++++++++++- .../Entities/Structures/Piping/Atmospherics/pipes.yml | 1 - .../Entities/Structures/Piping/Atmospherics/unary.yml | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs b/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs index f85e3b7bf4..228446516b 100644 --- a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs @@ -63,6 +63,7 @@ namespace Content.Client.Atmos.Visualizers if (!component.Owner.TryGetComponent(out var xform)) return; + if (!component.Owner.TryGetComponent(out var sprite)) return; @@ -75,10 +76,18 @@ namespace Content.Client.Atmos.Visualizers if(!component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor)) subfloor = true; + var rotation = xform.LocalRotation; + foreach (Layer layerKey in Enum.GetValues(typeof(Layer))) { var layer = sprite.LayerMapGet(layerKey); - sprite.LayerSetVisible(layer, state.ConnectedDirections.HasDirection(((PipeDirection)layerKey)) && subfloor); + var dir = (PipeDirection) layerKey; + var visible = subfloor && state.ConnectedDirections.HasDirection(dir); + sprite.LayerSetVisible(layer, visible); + + if (!visible) continue; + + sprite.LayerSetRotation(layer, -rotation); sprite.LayerSetColor(layer, color); } } diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml index 10ca2e8ae9..088cc4d0d0 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml @@ -53,7 +53,6 @@ sprite: Structures/Piping/Atmospherics/pipe.rsi drawdepth: BelowFloor netsync: false - noRot: true # TODO: This is a hack so pipe connectors don't look wrong. Also see BaseGasThermoMachine. - type: Appearance visuals: - type: PipeConnectorVisualizer diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 7082154d40..9bf87c3d26 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -124,7 +124,6 @@ - type: Sprite netsync: false sprite: Structures/Piping/Atmospherics/thermomachine.rsi - noRot: true # TODO: This is a hack so pipe connectors don't look wrong. Also see GasPipeBase. - type: Appearance visuals: - type: PipeConnectorVisualizer