Make T-ray entity query use lookup flags (#21793)

This commit is contained in:
Leon Friedrich
2023-11-20 18:09:06 +13:00
committed by GitHub
parent 1cc97e1bb6
commit 4c09e645f3

View File

@@ -23,6 +23,8 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem
private const string TRayAnimationKey = "trays";
private const double AnimationLength = 0.3;
public const LookupFlags Flags = LookupFlags.Static | LookupFlags.Sundries | LookupFlags.Approximate;
public override void Update(float frameTime)
{
base.Update(frameTime);
@@ -76,28 +78,23 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem
if (canSee)
{
_lookup.GetEntitiesInRange(playerMap, playerPos, range, inRange);
_lookup.GetEntitiesInRange(playerMap, playerPos, range, inRange, flags: Flags);
foreach (var (uid, comp) in inRange)
{
if (!comp.IsUnderCover || !comp.BlockAmbience | !comp.BlockInteractions)
continue;
EnsureComp<TrayRevealedComponent>(uid);
if (comp.IsUnderCover)
EnsureComp<TrayRevealedComponent>(uid);
}
}
var revealedQuery = AllEntityQuery<TrayRevealedComponent, SpriteComponent, TransformComponent>();
var revealedQuery = AllEntityQuery<TrayRevealedComponent, SpriteComponent>();
var subfloorQuery = GetEntityQuery<SubFloorHideComponent>();
while (revealedQuery.MoveNext(out var uid, out _, out var sprite, out var xform))
while (revealedQuery.MoveNext(out var uid, out _, out var sprite))
{
// Revealing
// Add buffer range to avoid flickers.
if (subfloorQuery.TryGetComponent(uid, out var subfloor) &&
xform.MapID != MapId.Nullspace &&
xform.MapID == playerMap &&
xform.Anchored &&
inRange.Contains((uid, subfloor)))
{
// Due to the fact client is predicting this server states will reset it constantly