Files
tbd-station-14/Content.Shared/Construction/Conditions/NoUnstackableInTile.cs
Ben c858c76341 Anchorable shared (#17422)
Co-authored-by: BenOwnby <ownbyb@appstate.edu>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2023-06-29 22:35:54 +10:00

32 lines
1010 B
C#

using Content.Shared.Construction.EntitySystems;
using JetBrains.Annotations;
using Robust.Shared.Map;
namespace Content.Shared.Construction.Conditions;
/// <summary>
/// Check for "Unstackable" condition commonly used by atmos devices and others which otherwise don't check on
/// collisions with other items.
/// </summary>
[UsedImplicitly]
[DataDefinition]
public sealed class NoUnstackableInTile : IConstructionCondition
{
public const string GuidebookString = "construction-step-condition-no-unstackable-in-tile";
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var sysMan = IoCManager.Resolve<IEntitySystemManager>();
var anchorable = sysMan.GetEntitySystem<AnchorableSystem>();
return !anchorable.AnyUnstackablesAnchoredAt(location);
}
public ConstructionGuideEntry GenerateGuideEntry()
{
return new ConstructionGuideEntry
{
Localization = GuidebookString
};
}
}