34 lines
988 B
C#
34 lines
988 B
C#
using Content.Shared.Maps;
|
|
using Content.Shared.Tag;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.Shared.Construction.Conditions
|
|
{
|
|
[UsedImplicitly]
|
|
[DataDefinition]
|
|
public sealed class NoWindowsInTile : IConstructionCondition
|
|
{
|
|
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
|
{
|
|
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
|
|
|
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.Static))
|
|
{
|
|
if (tagSystem.HasTag(entity, "Window"))
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public ConstructionGuideEntry GenerateGuideEntry()
|
|
{
|
|
return new ConstructionGuideEntry
|
|
{
|
|
Localization = "construction-step-condition-no-windows-in-tile"
|
|
};
|
|
}
|
|
}
|
|
}
|