35 lines
999 B
C#
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|