ECS visibility (#5769)

This commit is contained in:
metalgearsloth
2021-12-29 05:12:28 +11:00
committed by GitHub
parent 28df88ef21
commit 404accb18f
2 changed files with 12 additions and 7 deletions

View File

@@ -33,6 +33,7 @@ namespace Content.Server.Pointing.EntitySystems
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!;
[Dependency] private readonly VisibilitySystem _visibilitySystem = default!;
private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f);
@@ -127,8 +128,9 @@ namespace Content.Server.Pointing.EntitySystems
var layer = (int) VisibilityFlags.Normal;
if (TryComp(player, out VisibilityComponent? playerVisibility))
{
var arrowVisibility = arrow.EnsureComponent<VisibilityComponent>();
layer = arrowVisibility.Layer = playerVisibility.Layer;
var arrowVisibility = EntityManager.EnsureComponent<VisibilityComponent>(arrow);
layer = playerVisibility.Layer;
_visibilitySystem.SetLayer(arrowVisibility, layer);
}
// Get players that are in range and whose visibility layer matches the arrow's.