Used SharedTransformSytem in AnchorableSystem (#14332)
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Content.Server.Construction
|
|||||||
[Dependency] private readonly PopupSystem _popup = default!;
|
[Dependency] private readonly PopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedToolSystem _tool = default!;
|
[Dependency] private readonly SharedToolSystem _tool = default!;
|
||||||
[Dependency] private readonly PullingSystem _pulling = default!;
|
[Dependency] private readonly PullingSystem _pulling = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -47,7 +48,7 @@ namespace Content.Server.Construction
|
|||||||
var xform = Transform(uid);
|
var xform = Transform(uid);
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used));
|
RaiseLocalEvent(uid, new BeforeUnanchoredEvent(args.User, used));
|
||||||
xform.Anchored = false;
|
_transform.Unanchor(uid, xform);
|
||||||
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used));
|
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, used));
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid);
|
_popup.PopupEntity(Loc.GetString("anchorable-unanchored"), uid);
|
||||||
@@ -83,10 +84,15 @@ namespace Content.Server.Construction
|
|||||||
|
|
||||||
// TODO: Anchoring snaps rn anyway!
|
// TODO: Anchoring snaps rn anyway!
|
||||||
if (component.Snap)
|
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));
|
RaiseLocalEvent(uid, new BeforeAnchoredEvent(args.User, used));
|
||||||
xform.Anchored = true;
|
|
||||||
|
if (!xform.Anchored)
|
||||||
|
_transform.AnchorEntity(uid, xform);
|
||||||
|
|
||||||
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used));
|
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, used));
|
||||||
|
|
||||||
_popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid);
|
_popup.PopupEntity(Loc.GetString("anchorable-anchored"), uid);
|
||||||
|
|||||||
Reference in New Issue
Block a user