From 485fee30f0eabad36d916e190a8e9c14a3dab188 Mon Sep 17 00:00:00 2001 From: 08A Date: Sat, 22 Apr 2023 11:37:19 +0200 Subject: [PATCH] Used SharedTransformSytem in AnchorableSystem (#14332) --- Content.Server/Construction/AnchorableSystem.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Content.Server/Construction/AnchorableSystem.cs b/Content.Server/Construction/AnchorableSystem.cs index 4d22fa5fb1..a6583f9fc4 100644 --- a/Content.Server/Construction/AnchorableSystem.cs +++ b/Content.Server/Construction/AnchorableSystem.cs @@ -23,6 +23,7 @@ namespace Content.Server.Construction [Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly SharedToolSystem _tool = default!; [Dependency] private readonly PullingSystem _pulling = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; public override void Initialize() { @@ -47,7 +48,7 @@ namespace Content.Server.Construction var xform = Transform(uid); RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used)); - xform.Anchored = false; + _transform.Unanchor(uid, xform); RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used)); _popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid); @@ -83,10 +84,15 @@ namespace Content.Server.Construction // TODO: Anchoring snaps rn anyway! if (component.Snap) - xform.Coordinates = xform.Coordinates.SnapToGrid(EntityManager, _mapManager); + { + _transform.SetCoordinates(uid, xform.Coordinates.SnapToGrid(EntityManager, _mapManager)); + } RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used)); - xform.Anchored = true; + + if (!xform.Anchored) + _transform.AnchorEntity(uid, xform); + RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used)); _popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid); -- 2.51.2