diff --git a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs index 38076ef5a6..44323d2af7 100644 --- a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -37,8 +37,9 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem sprite.LayerMapReserveBlank(layerKey); var layer = sprite.LayerMapGet(layerKey); sprite.LayerSetRSI(layer, rsi.RSI); - var layerState = component.BaseState + (PipeDirection) layerKey; + var layerState = component.State; sprite.LayerSetState(layer, layerState); + sprite.LayerSetDirOffset(layer, ToOffset(layerKey)); } } @@ -50,11 +51,12 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem if (!args.Component.TryGetData(PipeColorVisuals.Color, out Color color)) color = Color.White; - if (!args.Component.TryGetData(PipeVisuals.VisualState, out PipeDirection connectedDirections)) + if (!args.Component.TryGetData(PipeVisuals.VisualState, out PipeDirection worldConnectedDirections)) return; - var rotation = Transform(uid).LocalRotation; - + // transform connected directions to local-coordinates + var connectedDirections = worldConnectedDirections.RotatePipeDirection(-Transform(uid).LocalRotation); + foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer))) { if (!sprite.LayerMapTryGet(layerKey, out var key)) @@ -68,11 +70,21 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem if (!visible) continue; - layer.Rotation = -rotation; layer.Color = color; } } + private SpriteComponent.DirectionOffset ToOffset(PipeConnectionLayer layer) + { + return layer switch + { + PipeConnectionLayer.NorthConnection => SpriteComponent.DirectionOffset.Flip, + PipeConnectionLayer.EastConnection => SpriteComponent.DirectionOffset.CounterClockwise, + PipeConnectionLayer.WestConnection => SpriteComponent.DirectionOffset.Clockwise, + _ => SpriteComponent.DirectionOffset.None, + }; + } + private enum PipeConnectionLayer : byte { NorthConnection = PipeDirection.North, diff --git a/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs index b7e4ac477c..f36ede3dfb 100644 --- a/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs +++ b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs @@ -7,5 +7,5 @@ public sealed class PipeAppearanceComponent : Component public string RsiPath = "Structures/Piping/Atmospherics/pipe.rsi"; [DataField("baseState")] - public string BaseState = "pipeConnector"; + public string State = "pipeConnector"; } diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/meta.json b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/meta.json index 727ffdb390..b4968add2a 100644 --- a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/meta.json +++ b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/meta.json @@ -20,23 +20,16 @@ "directions":4 }, { - "name":"pipeFourway", + "name": "pipeFourway", + "directions":4 }, { "name":"pipeStraight", "directions":4 }, { - "name":"pipeConnectorSouth", - }, - { - "name":"pipeConnectorNorth", - }, - { - "name":"pipeConnectorEast", - }, - { - "name":"pipeConnectorWest", + "name":"pipeConnector", + "directions":4 } ] -} \ No newline at end of file +} diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnector.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnector.png new file mode 100644 index 0000000000..9f5ad1cbd9 Binary files /dev/null and b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnector.png differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorEast.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorEast.png deleted file mode 100644 index c26ad0b9ca..0000000000 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorEast.png and /dev/null differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorNorth.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorNorth.png deleted file mode 100644 index 30c6e83d71..0000000000 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorNorth.png and /dev/null differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorSouth.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorSouth.png deleted file mode 100644 index ac6744d246..0000000000 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorSouth.png and /dev/null differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorWest.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorWest.png deleted file mode 100644 index 53747379bc..0000000000 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeConnectorWest.png and /dev/null differ diff --git a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeFourway.png b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeFourway.png index 2acc665ac9..00579eb135 100644 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeFourway.png and b/Resources/Textures/Structures/Piping/Atmospherics/pipe.rsi/pipeFourway.png differ