Allow t-ray to penetrate carpets and puddles (#25276)
* Allow t-ray to penetrate carpets and puddles * handle edge cases (cherry picked from commit d7eb3b1c5c3faf2f9cf363407790bd383feb0070)
This commit is contained in:
parent
3889a3a14d
commit
c459072d8a
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue