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]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial 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
|
|
|
|
{
|
2023-06-30 00:04:36 +12:00
|
|
|
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
var sysMan = entManager.EntitySysManager;
|
|
|
|
|
|
var tagSystem = sysMan.GetEntitySystem<TagSystem>();
|
|
|
|
|
|
|
2023-07-18 16:11:28 -05:00
|
|
|
|
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Static))
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2024-06-02 11:11:19 +10: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
|
|
|
|
}
|
|
|
|
|
|
}
|