Files
tbd-station-14/Content.Shared/Construction/Conditions/LowWallInTile.cs
metalgearsloth 4e46cf7d27 Make content use EntityLookupFlags (#4531)
* Use lookup flags

* Woops
2021-08-29 14:23:11 +10:00

33 lines
970 B
C#

using Content.Shared.Maps;
using Content.Shared.Window;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Construction.Conditions
{
[UsedImplicitly]
[DataDefinition]
public class LowWallInTile : IConstructionCondition
{
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{
var lowWall = false;
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored))
{
if (entity.HasComponent<SharedCanBuildWindowOnTopComponent>())
lowWall = true;
// Already has a window.
if (entity.HasComponent<SharedWindowComponent>())
return false;
}
return lowWall;
}
}
}