No atmos stacking (attempt 2) (#16687)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Tom Leys
2023-06-30 00:04:36 +12:00
committed by GitHub
parent ccf58fa657
commit 67df47f553
12 changed files with 165 additions and 14 deletions

View File

@@ -0,0 +1,31 @@
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<SharedAnchorableSystem>();
return !anchorable.AnyUnstackablesAnchoredAt(location);
}
public ConstructionGuideEntry GenerateGuideEntry()
{
return new ConstructionGuideEntry
{
Localization = GuidebookString
};
}
}