* 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>
30 lines
935 B
C#
30 lines
935 B
C#
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>);
|
|
}
|
|
}
|