2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Shared.Maps;
|
2022-02-13 21:20:47 -06:00
|
|
|
|
using Content.Shared.Tag;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Construction.Conditions
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class NoWindowsInTile : IConstructionCondition
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2021-12-04 12:47:09 +01:00
|
|
|
|
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2022-10-04 14:24:19 +11:00
|
|
|
|
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
|
|
|
|
|
|
|
2022-12-15 17:29:46 +13:00
|
|
|
|
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.Static))
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2022-02-13 21:20:47 -06:00
|
|
|
|
if (tagSystem.HasTag(entity, "Window"))
|
2020-10-08 17:41:23 +02:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2021-11-02 11:24:32 +01:00
|
|
|
|
|
2022-10-30 02:48:53 -04:00
|
|
|
|
public ConstructionGuideEntry GenerateGuideEntry()
|
2021-11-02 11:24:32 +01:00
|
|
|
|
{
|
2022-10-30 02:48:53 -04:00
|
|
|
|
return new ConstructionGuideEntry
|
2021-11-02 11:24:32 +01:00
|
|
|
|
{
|
|
|
|
|
|
Localization = "construction-step-condition-no-windows-in-tile"
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2020-10-08 17:41:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|