diff --git a/Content.Client/SubFloor/SubFloorHideSystem.cs b/Content.Client/SubFloor/SubFloorHideSystem.cs index 81e476b0c4..8f1f505cee 100644 --- a/Content.Client/SubFloor/SubFloorHideSystem.cs +++ b/Content.Client/SubFloor/SubFloorHideSystem.cs @@ -53,16 +53,19 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem } // Is there some layer that is always visible? - if (args.Sprite.LayerMapTryGet(SubfloorLayers.FirstLayer, out var firstLayer)) + var hasVisibleLayer = false; + foreach (var layerKey in component.VisibleLayers) { - var layer = args.Sprite[firstLayer]; + if (!args.Sprite.LayerMapTryGet(layerKey, out var layerIndex)) + continue; + + var layer = args.Sprite[layerIndex]; layer.Visible = true; layer.Color = layer.Color.WithAlpha(1f); - args.Sprite.Visible = true; - return; + hasVisibleLayer = true; } - args.Sprite.Visible = revealed; + args.Sprite.Visible = hasVisibleLayer || revealed; } private void UpdateAll() @@ -73,8 +76,3 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem } } } - -public enum SubfloorLayers : byte -{ - FirstLayer, // always visible. E.g. vent part of a vent.. -} diff --git a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs index 527e7b8ad4..77c76bec88 100644 --- a/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs @@ -184,4 +184,9 @@ namespace Content.Shared.SubFloor Covered, // is there a floor tile over this entity ScannerRevealed, // is this entity revealed by a scanner or some other entity? } + + public enum SubfloorLayers : byte + { + FirstLayer + } } diff --git a/Content.Shared/SubFloor/SubFloorHideComponent.cs b/Content.Shared/SubFloor/SubFloorHideComponent.cs index 585c998a98..b9c581d4e4 100644 --- a/Content.Shared/SubFloor/SubFloorHideComponent.cs +++ b/Content.Shared/SubFloor/SubFloorHideComponent.cs @@ -1,4 +1,6 @@ using Robust.Shared.GameStates; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic; namespace Content.Shared.SubFloor { @@ -43,6 +45,13 @@ namespace Content.Shared.SubFloor [DataField("scannerTransparency")] public float ScannerTransparency = 0.8f; + /// + /// Sprite layer keys for the layers that are always visible, even if the entity is below a floor tile. E.g., + /// the vent part of a vent is always visible, even though the piping is hidden. + /// + [DataField("visibleLayers", customTypeSerializer:typeof(CustomHashSetSerializer))] + public HashSet VisibleLayers = new() { SubfloorLayers.FirstLayer }; + /// /// The entities this subfloor is revealed by. /// diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index b12ba516f0..f408df273b 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -158,8 +158,9 @@ layers: - state: pipeHalf sprite: Structures/Piping/Atmospherics/pipe.rsi - map: [ "enum.PipeVisualLayers.Pipe", "enum.SubfloorLayers.FirstLayer" ] + map: [ "enum.PipeVisualLayers.Pipe" ] - state: injector + map: [ "enum.SubfloorLayers.FirstLayer" ] - state: injector-unshaded shader: unshaded map: [ "unshaded" ] @@ -177,6 +178,10 @@ - type: Construction graph: GasUnary node: outletinjector + - type: SubFloorHide + visibleLayers: + - enum.SubfloorLayers.FirstLayer + - unshaded - type: entity parent: BaseMachinePowered diff --git a/Resources/Textures/Structures/Piping/Atmospherics/outletinjector.rsi/injector.png b/Resources/Textures/Structures/Piping/Atmospherics/outletinjector.rsi/injector.png index c2bd54b1df..0f79b218fd 100644 Binary files a/Resources/Textures/Structures/Piping/Atmospherics/outletinjector.rsi/injector.png and b/Resources/Textures/Structures/Piping/Atmospherics/outletinjector.rsi/injector.png differ