From d7eb3b1c5c3faf2f9cf363407790bd383feb0070 Mon Sep 17 00:00:00 2001 From: themias <89101928+themias@users.noreply.github.com> Date: Fri, 16 Feb 2024 18:37:56 -0500 Subject: [PATCH] Allow t-ray to penetrate carpets and puddles (#25276) * Allow t-ray to penetrate carpets and puddles * handle edge cases --- Content.Client/SubFloor/SubFloorHideSystem.cs | 13 +++++++++++++ Content.Shared/SubFloor/SubFloorHideComponent.cs | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/Content.Client/SubFloor/SubFloorHideSystem.cs b/Content.Client/SubFloor/SubFloorHideSystem.cs index 482ab94a00..64d3afc640 100644 --- a/Content.Client/SubFloor/SubFloorHideSystem.cs +++ b/Content.Client/SubFloor/SubFloorHideSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.DrawDepth; using Content.Shared.SubFloor; using Robust.Client.GameObjects; @@ -62,6 +63,18 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem } args.Sprite.Visible = hasVisibleLayer || revealed; + + // allows a t-ray to show wires/pipes above carpets/puddles + if (scannerRevealed) + { + component.OriginalDrawDepth ??= args.Sprite.DrawDepth; + args.Sprite.DrawDepth = (int) Shared.DrawDepth.DrawDepth.FloorObjects + 1; + } + else if (component.OriginalDrawDepth.HasValue) + { + args.Sprite.DrawDepth = component.OriginalDrawDepth.Value; + component.OriginalDrawDepth = null; + } } private void UpdateAll() diff --git a/Content.Shared/SubFloor/SubFloorHideComponent.cs b/Content.Shared/SubFloor/SubFloorHideComponent.cs index 284a4b871f..3b29388fa8 100644 --- a/Content.Shared/SubFloor/SubFloorHideComponent.cs +++ b/Content.Shared/SubFloor/SubFloorHideComponent.cs @@ -45,5 +45,12 @@ namespace Content.Shared.SubFloor /// [DataField("visibleLayers")] public HashSet VisibleLayers = new() { SubfloorLayers.FirstLayer }; + + /// + /// This is used for storing the original draw depth of a t-ray revealed entity. + /// e.g. when a t-ray revealed cable is drawn above a carpet. + /// + [DataField] + public int? OriginalDrawDepth; } } -- 2.52.0