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

@@ -1,13 +1,16 @@
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;
@@ -85,7 +88,15 @@ namespace Content.Server.Construction
// TODO: Anchoring snaps rn anyway!
if (component.Snap)
{
_transform.SetCoordinates(uid, xform.Coordinates.SnapToGrid(EntityManager, _mapManager));
var coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager);
if (AnyUnstackable(uid, coordinates))
{
_popup.PopupEntity(Loc.GetString("construction-step-condition-no-unstackable-in-tile"), uid, args.User);
return;
}
_transform.SetCoordinates(uid, coordinates);
}
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));
@@ -195,6 +206,12 @@ namespace Content.Server.Construction
return;
}
if (AnyUnstackable(uid, transform.Coordinates))
{
_popup.PopupEntity(Loc.GetString("construction-step-condition-no-unstackable-in-tile"), uid, userUid);
return;
}
_tool.UseTool(usingUid, userUid, uid, anchorable.Delay, usingTool.Qualities, new TryAnchorCompletedEvent());
}