// 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;
+ if (component.OriginalDrawDepth is not null)
+ return;
+ component.OriginalDrawDepth = args.Sprite.DrawDepth;
+ var drawDepthDifference = Shared.DrawDepth.DrawDepth.ThickPipe - Shared.DrawDepth.DrawDepth.Puddles;
+ args.Sprite.DrawDepth -= drawDepthDifference - 1;
}
else if (component.OriginalDrawDepth.HasValue)
{
--- /dev/null
+using System.Linq;
+using Content.Shared.SubFloor;
+using Robust.Shared.Map.Components;
+
+namespace Content.Client.SubFloor;
+
+public sealed class TrayScanRevealSystem : EntitySystem
+{
+ [Dependency] private readonly SharedTransformSystem _transform = default!;
+ [Dependency] private readonly SharedMapSystem _map = default!;
+
+ public bool IsUnderRevealingEntity(EntityUid uid)
+ {
+ var gridUid = _transform.GetGrid(uid);
+ if (gridUid is null)
+ return false;
+
+ var gridComp = Comp<MapGridComponent>(gridUid.Value);
+ var position = _transform.GetGridOrMapTilePosition(uid);
+
+ return HasTrayScanReveal(((EntityUid)gridUid, gridComp), position);
+ }
+
+ private bool HasTrayScanReveal(Entity<MapGridComponent> ent, Vector2i position)
+ {
+ var anchoredEnum = _map.GetAnchoredEntities(ent, position);
+ return anchoredEnum.Any(HasComp<TrayScanRevealComponent>);
+ }
+}
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
+ [Dependency] private readonly TrayScanRevealSystem _trayScanReveal = default!;
private const string TRayAnimationKey = "trays";
private const double AnimationLength = 0.3;
foreach (var (uid, comp) in inRange)
{
- if (comp.IsUnderCover)
+ if (comp.IsUnderCover || _trayScanReveal.IsUnderRevealingEntity(uid))
EnsureComp<TrayRevealedComponent>(uid);
}
}
/// <summary>
/// This is for sub-floors, the floors you see after prying off a tile.
/// </summary>
- LowFloors = DrawDepthTag.Default - 14,
+ LowFloors = DrawDepthTag.Default - 18,
// various entity types that require different
// draw depths, as to avoid hiding
#region SubfloorEntities
- ThickPipe = DrawDepthTag.Default - 13,
- ThickWire = DrawDepthTag.Default - 12,
- ThinPipe = DrawDepthTag.Default - 11,
- ThinWire = DrawDepthTag.Default - 10,
+ ThickPipe = DrawDepthTag.Default - 17,
+ ThickWire = DrawDepthTag.Default - 16,
+ ThinPipe = DrawDepthTag.Default - 15,
+ ThinWire = DrawDepthTag.Default - 14,
#endregion
/// <summary>
/// Things that are beneath regular floors.
/// </summary>
- BelowFloor = DrawDepthTag.Default - 9,
+ BelowFloor = DrawDepthTag.Default - 13,
/// <summary>
/// Used for entities like carpets.
/// </summary>
- FloorTiles = DrawDepthTag.Default - 8,
+ FloorTiles = DrawDepthTag.Default - 12,
/// <summary>
/// Things that are actually right on the floor, like ice crust or atmos devices. This does not mean objects like
/// tables, even though they are technically "on the floor".
/// </summary>
- FloorObjects = DrawDepthTag.Default - 7,
+ FloorObjects = DrawDepthTag.Default - 11,
/// <summary>
// Discrete drawdepth to avoid z-fighting with other FloorObjects but also above floor entities.
/// </summary>
- Puddles = DrawDepthTag.Default - 6,
+ Puddles = DrawDepthTag.Default - 10,
+ // There's a gap for subfloor entities to retain relative draw depth when revealed by a t-ray scanner.
/// <summary>
// Objects that are on the floor, but should render above puddles. This includes kudzu, holopads, telepads and levers.
/// </summary>
--- /dev/null
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.SubFloor;
+
+/// <summary>
+/// For tile-like entities, such as catwalk and carpets, to reveal subfloor entities when on the same tile and when
+/// using a t-ray scanner.
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class TrayScanRevealComponent : Component;