Files
tbd-station-14/Content.Shared/Construction/Conditions/NoWindowsInTile.cs
J af9526197a Extracts magic strings from Tag calls (#36305)
* Extracts magic strings from Tag calls

When #36281 gets merged, the `TagSystem` methods will all give warnings. Let's fix those warnings before they even happen!

* Adds missing libraries

* Remove not yet implemented TagSystem changes

* Fix tag spelling error

Genuinely surprised there was only 1!

* Styling and proper type changes

* Styling

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>

---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
2025-04-04 20:20:19 -04:00

39 lines
1.1 KiB
C#

using Content.Shared.Maps;
using Content.Shared.Tag;
using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Shared.Construction.Conditions
{
[UsedImplicitly]
[DataDefinition]
public sealed partial class NoWindowsInTile : IConstructionCondition
{
private static readonly ProtoId<TagPrototype> WindowTag = "Window";
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var entManager = IoCManager.Resolve<IEntityManager>();
var sysMan = entManager.EntitySysManager;
var tagSystem = sysMan.GetEntitySystem<TagSystem>();
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Static))
{
if (tagSystem.HasTag(entity, WindowTag))
return false;
}
return true;
}
public ConstructionGuideEntry GenerateGuideEntry()
{
return new ConstructionGuideEntry
{
Localization = "construction-step-condition-no-windows-in-tile"
};
}
}
}