Revert no device stacking (#16608)

This commit is contained in:
deltanedas
2023-05-19 14:39:37 +00:00
committed by GitHub
parent 36cd2046a8
commit 04b2dab4e9
11 changed files with 12 additions and 159 deletions

View File

@@ -1,16 +1,13 @@
using Content.Server.Administration.Logs;
using Content.Server.Construction.Components;
using Content.Server.Coordinates.Helpers;
using Content.Server.Popups;
using Content.Server.Pulling;
using Content.Shared.Construction.Components;
using Content.Shared.Construction.Conditions;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Pulling.Components;
using Content.Shared.Tag;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Robust.Shared.Map;
@@ -27,7 +24,6 @@ namespace Content.Server.Construction
[Dependency] private readonly SharedToolSystem _tool = default!;
[Dependency] private readonly PullingSystem _pulling = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
public override void Initialize()
{
@@ -89,26 +85,7 @@ namespace Content.Server.Construction
// TODO: Anchoring snaps rn anyway!
if (component.Snap)
{
var coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager);
if (_tagSystem.HasTag(uid, "Unstackable"))
{
// Need to enforce the unstackable rules on anchoring also.
var condition = new NoUnstackableInTile();
if (NoUnstackableInTile.AnyUnstackableTiles(coordinates, _tagSystem))
{
var message = condition.GenerateGuideEntry()?.Localization;
if (message != null)
{
// Show the reason to the user:
_popup.PopupEntity(Loc.GetString(message), uid, args.User);
}
return;
}
}
_transform.SetCoordinates(uid, coordinates);
_transform.SetCoordinates(uid, xform.Coordinates.SnapToGrid(EntityManager, _mapManager));
}
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));