t-ray reveal for entities and draw depth fix (#33012)
* t-rays show above catwalk * a * RevealSubfloorComponent * revealSubfloorOnScan, add it to catwalk * TrayScanReveal sys and comp * Rr * handle anchoring * use tile indices for vector2i * fix IsUnderRevealingEntity reset on pvs pop in reanchor * fix exception on TrayScanRevealComponent remove * fix IsUnderRevealingEntity not updating on pvs enter * update to ent * make subfloor retain respect for their relative draw depth * fix carpets not revealing subfloor on plating * chapel carpet * ?? * draw depth gap for subfloor entities. * revert alpha change * remove abs from draw depth difference * move TrayScanReveal to client * delete old refactor * let's show them above puddles too * Remove superfluous component classes --------- Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
This commit is contained in:
@@ -67,8 +67,11 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
|
||||
// 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)
|
||||
{
|
||||
|
||||
29
Content.Client/SubFloor/TrayScanRevealSystem.cs
Normal file
29
Content.Client/SubFloor/TrayScanRevealSystem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
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>);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem
|
||||
[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;
|
||||
@@ -82,7 +83,7 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem
|
||||
|
||||
foreach (var (uid, comp) in inRange)
|
||||
{
|
||||
if (comp.IsUnderCover)
|
||||
if (comp.IsUnderCover || _trayScanReveal.IsUnderRevealingEntity(uid))
|
||||
EnsureComp<TrayRevealedComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,38 +9,39 @@ namespace Content.Shared.DrawDepth
|
||||
/// <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>
|
||||
|
||||
10
Content.Shared/SubFloor/TrayScanRevealComponent.cs
Normal file
10
Content.Shared/SubFloor/TrayScanRevealComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
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;
|
||||
@@ -36,6 +36,7 @@
|
||||
spawned:
|
||||
- id: MaterialCloth1
|
||||
amount: 1
|
||||
- type: TrayScanReveal
|
||||
|
||||
- type: entity
|
||||
id: Carpet
|
||||
@@ -364,3 +365,4 @@
|
||||
behaviors:
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
- type: TrayScanReveal
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
max: 1
|
||||
- !type:DoActsBehavior
|
||||
acts: [ "Destruction" ]
|
||||
- type: TrayScanReveal
|
||||
- type: RCDDeconstructable
|
||||
cost: 2
|
||||
delay: 2
|
||||
|
||||
Reference in New Issue
Block a user