Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow t-ray to penetrate carpets and puddles #25276

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Content.Client/SubFloor/SubFloorHideSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.DrawDepth;
using Content.Shared.SubFloor;
using Robust.Client.GameObjects;

Expand Down Expand Up @@ -62,6 +63,18 @@ private void OnAppearanceChanged(EntityUid uid, SubFloorHideComponent component,
}

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()
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/SubFloor/SubFloorHideComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,12 @@ public sealed partial class SubFloorHideComponent : Component
/// </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;
}
}
Loading