Files
tbd-station-14/Content.Shared/Construction/ConstructionConditions/LowWallInTile.cs
Víctor Aguilera Puerto 745401a41e Data-oriented Construction System (#2152)
- Powerful
- Data-oriented
- Approved by PJB
- Powered by node graphs and AI pathfinding
- Coded by the same nerd who brought you atmos

Co-authored-by: Exp <theexp111@gmail.com>
2020-10-08 17:41:23 +02:00

35 lines
999 B
C#

using System;
using Content.Shared.GameObjects.Components;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Construction.ConstructionConditions
{
[UsedImplicitly]
public class LowWallInTile : IConstructionCondition
{
public void ExposeData(ObjectSerializer serializer) { }
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{
var lowWall = false;
foreach (var entity in location.GetEntitiesInTile(true))
{
if (entity.HasComponent<SharedCanBuildWindowOnTopComponent>())
lowWall = true;
// Already has a window.
if (entity.HasComponent<SharedWindowComponent>())
return false;
}
return lowWall;
}
}
}