From 633a6b3ab9a99c59c969e8b629bc10caf93f5816 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Mon, 1 Feb 2021 20:58:47 +0000 Subject: [PATCH] Walls, catwalks, table frames can no longer be constructed rotated. (#3057) * Walls, catwalks, table frames can no longer be constructed rotated. This should help prevent bugs from unanticipated rotations. * SnapToGrid ZeroRotation (now SouthRotation) - Stuff must face south apparently --- .../Construction/Completions/SnapToGrid.cs | 7 +++++++ .../Recipes/Construction/Graphs/catwalk.yml | 3 ++- .../Recipes/Construction/Graphs/girder.yml | 15 ++++++++++----- .../Recipes/Construction/Graphs/tables.yml | 3 ++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Content.Server/Construction/Completions/SnapToGrid.cs b/Content.Server/Construction/Completions/SnapToGrid.cs index d44e7a1392..ab35e14dd4 100644 --- a/Content.Server/Construction/Completions/SnapToGrid.cs +++ b/Content.Server/Construction/Completions/SnapToGrid.cs @@ -6,6 +6,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects.Components.Transform; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Serialization; +using Robust.Shared.Maths; namespace Content.Server.Construction.Completions { @@ -13,10 +14,12 @@ namespace Content.Server.Construction.Completions public class SnapToGrid : IGraphAction { public SnapGridOffset Offset { get; private set; } = SnapGridOffset.Center; + public bool SouthRotation { get; private set; } = false; public void ExposeData(ObjectSerializer serializer) { serializer.DataField(this, x => x.Offset, "offset", SnapGridOffset.Center); + serializer.DataField(this, x => x.SouthRotation, "southRotation", false); } public async Task PerformAction(IEntity entity, IEntity? user) @@ -24,6 +27,10 @@ namespace Content.Server.Construction.Completions if (entity.Deleted) return; entity.SnapToGrid(Offset); + if (SouthRotation) + { + entity.Transform.LocalRotation = Angle.South; + } } } } diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml b/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml index a218cf8e4c..a43bb1d729 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/catwalk.yml @@ -6,7 +6,8 @@ edges: - to: Catwalk completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true steps: - material: MetalRod amount: 2 diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml b/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml index b1fff3816a..ff840def92 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/girder.yml @@ -6,7 +6,8 @@ edges: - to: girder completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true steps: - material: Metal amount: 2 @@ -35,7 +36,8 @@ - to: wall completed: - - !type:SnapToGrid {} + - !type:SnapToGrid + southRotation: true conditions: - !type:EntityAnchored {} steps: @@ -44,7 +46,8 @@ - to: reinforcedGirder completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true conditions: - !type:EntityAnchored {} steps: @@ -72,7 +75,8 @@ edges: - to: reinforcedWall completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true conditions: - !type:EntityAnchored { } steps: @@ -82,7 +86,8 @@ - to: girder completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true conditions: - !type:EntityAnchored { } steps: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml b/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml index afe3f1753c..f94b12ace6 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/tables.yml @@ -6,7 +6,8 @@ edges: - to: TableFrame completed: - - !type:SnapToGrid { } + - !type:SnapToGrid + southRotation: true steps: - material: MetalRod amount: 2