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
This commit is contained in:
20kdc
2021-02-01 20:58:47 +00:00
committed by GitHub
parent 6b6ddd0a73
commit 633a6b3ab9
4 changed files with 21 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ using JetBrains.Annotations;
using Robust.Shared.GameObjects.Components.Transform; using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Maths;
namespace Content.Server.Construction.Completions namespace Content.Server.Construction.Completions
{ {
@@ -13,10 +14,12 @@ namespace Content.Server.Construction.Completions
public class SnapToGrid : IGraphAction public class SnapToGrid : IGraphAction
{ {
public SnapGridOffset Offset { get; private set; } = SnapGridOffset.Center; public SnapGridOffset Offset { get; private set; } = SnapGridOffset.Center;
public bool SouthRotation { get; private set; } = false;
public void ExposeData(ObjectSerializer serializer) public void ExposeData(ObjectSerializer serializer)
{ {
serializer.DataField(this, x => x.Offset, "offset", SnapGridOffset.Center); 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) public async Task PerformAction(IEntity entity, IEntity? user)
@@ -24,6 +27,10 @@ namespace Content.Server.Construction.Completions
if (entity.Deleted) return; if (entity.Deleted) return;
entity.SnapToGrid(Offset); entity.SnapToGrid(Offset);
if (SouthRotation)
{
entity.Transform.LocalRotation = Angle.South;
}
} }
} }
} }

View File

@@ -6,7 +6,8 @@
edges: edges:
- to: Catwalk - to: Catwalk
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
steps: steps:
- material: MetalRod - material: MetalRod
amount: 2 amount: 2

View File

@@ -6,7 +6,8 @@
edges: edges:
- to: girder - to: girder
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
steps: steps:
- material: Metal - material: Metal
amount: 2 amount: 2
@@ -35,7 +36,8 @@
- to: wall - to: wall
completed: completed:
- !type:SnapToGrid {} - !type:SnapToGrid
southRotation: true
conditions: conditions:
- !type:EntityAnchored {} - !type:EntityAnchored {}
steps: steps:
@@ -44,7 +46,8 @@
- to: reinforcedGirder - to: reinforcedGirder
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
conditions: conditions:
- !type:EntityAnchored {} - !type:EntityAnchored {}
steps: steps:
@@ -72,7 +75,8 @@
edges: edges:
- to: reinforcedWall - to: reinforcedWall
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
conditions: conditions:
- !type:EntityAnchored { } - !type:EntityAnchored { }
steps: steps:
@@ -82,7 +86,8 @@
- to: girder - to: girder
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
conditions: conditions:
- !type:EntityAnchored { } - !type:EntityAnchored { }
steps: steps:

View File

@@ -6,7 +6,8 @@
edges: edges:
- to: TableFrame - to: TableFrame
completed: completed:
- !type:SnapToGrid { } - !type:SnapToGrid
southRotation: true
steps: steps:
- material: MetalRod - material: MetalRod
amount: 2 amount: 2