]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow t-ray to penetrate carpets and puddles (#25276)
authorthemias <89101928+themias@users.noreply.github.com>
Fri, 16 Feb 2024 23:37:56 +0000 (18:37 -0500)
committerGitHub <noreply@github.com>
Fri, 16 Feb 2024 23:37:56 +0000 (16:37 -0700)
* Allow t-ray to penetrate carpets and puddles

* handle edge cases

Content.Client/SubFloor/SubFloorHideSystem.cs
Content.Shared/SubFloor/SubFloorHideComponent.cs

index 482ab94a0018388f2b465664b59c376797e1289d..64d3afc640ea590184ef694ccf8f2070cf4c3f1e 100644 (file)
@@ -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()
index 284a4b871f58076cb50cf51a4a83dfc0efb3e7f3..3b29388fa8939173b083ad90bb88f0529e4d04ac 100644 (file)
@@ -45,5 +45,12 @@ namespace Content.Shared.SubFloor
         /// </summary>
         [DataField("visibleLayers")]
         public HashSet<Enum> VisibleLayers = new() { SubfloorLayers.FirstLayer };
+
+        /// <summary>
+        /// 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.
+        /// </summary>
+        [DataField]
+        public int? OriginalDrawDepth;
     }
 }