Files
tbd-station-14/Content.Shared/Construction/Conditions/NoUnstackableInTile.cs
Tom Leys ccd503f8bb Cannot stack binary and trinary Atmos pumps and devices. 5x Filter rate boost (#16331)
* Cannot stack binary and trinary Atmos pumps and devices

- Filters now have a 5x max volume to compensate for no more stacking
- Add flipped versions of mixers and filters to the list of constructables

* Oi! No anchoring unstackables together!

* Use EntityLookupSystem in Unstackable and Window lookup

- Use static method for AnyUnstackableTiles
2023-05-19 02:59:20 -06:00

45 lines
1.4 KiB
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 NoUnstackableInTile : IConstructionCondition
{
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var tagSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TagSystem>();
if (AnyUnstackableTiles(location, tagSystem))
return false;
return true;
}
public static bool AnyUnstackableTiles(EntityCoordinates location, TagSystem tagSystem)
{
var lookup = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<EntityLookupSystem>();
foreach (var entity in lookup.GetEntitiesIntersecting(location, LookupFlags.Approximate | LookupFlags.Static |
LookupFlags.Sundries))
{
if (tagSystem.HasTag(entity, "Unstackable"))
return true;
}
return false;
}
public ConstructionGuideEntry GenerateGuideEntry()
{
return new ConstructionGuideEntry
{
Localization = "construction-step-condition-no-unstackable-in-tile"
};
}
}
}