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;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 12:23:18 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
using Robust.Shared.Maths;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
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-02-13 21:20:47 -06:00
|
|
|
|
var tagSystem = EntitySystem.Get<TagSystem>();
|
2021-08-29 14:23:11 +10:00
|
|
|
|
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
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
|
|
|
|
|
|
|
|
|
|
public ConstructionGuideEntry? GenerateGuideEntry()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ConstructionGuideEntry()
|
|
|
|
|
|
{
|
|
|
|
|
|
Localization = "construction-step-condition-no-windows-in-tile"
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2020-10-08 17:41:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|