The construction system can now prevent recipes from being rotated.
This commit is contained in:
@@ -8,15 +8,18 @@ using Robust.Shared.Map;
|
|||||||
|
|
||||||
namespace Content.Client.Construction
|
namespace Content.Client.Construction
|
||||||
{
|
{
|
||||||
public class ConstructionPlacementHijack : PlacementHijack
|
public sealed class ConstructionPlacementHijack : PlacementHijack
|
||||||
{
|
{
|
||||||
private readonly ConstructionSystem _constructionSystem;
|
private readonly ConstructionSystem _constructionSystem;
|
||||||
private readonly ConstructionPrototype _prototype;
|
private readonly ConstructionPrototype _prototype;
|
||||||
|
|
||||||
|
public override bool CanRotate { get; }
|
||||||
|
|
||||||
public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype prototype)
|
public ConstructionPlacementHijack(ConstructionSystem constructionSystem, ConstructionPrototype prototype)
|
||||||
{
|
{
|
||||||
_constructionSystem = constructionSystem;
|
_constructionSystem = constructionSystem;
|
||||||
_prototype = prototype;
|
_prototype = prototype;
|
||||||
|
CanRotate = prototype.CanRotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -448,7 +448,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
structure.Transform.Coordinates = ev.Location;
|
structure.Transform.Coordinates = ev.Location;
|
||||||
structure.Transform.LocalRotation = ev.Angle;
|
structure.Transform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.South;
|
||||||
|
|
||||||
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack));
|
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack));
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ namespace Content.Shared.Construction
|
|||||||
|
|
||||||
public string PlacementMode { get; private set; }
|
public string PlacementMode { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this construction can be constructed rotated or not.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanRotate { get; private set; }
|
||||||
|
|
||||||
public IReadOnlyList<IConstructionCondition> Conditions => _conditions;
|
public IReadOnlyList<IConstructionCondition> Conditions => _conditions;
|
||||||
|
|
||||||
public void LoadFrom(YamlMappingNode mapping)
|
public void LoadFrom(YamlMappingNode mapping)
|
||||||
@@ -71,6 +76,7 @@ namespace Content.Shared.Construction
|
|||||||
ser.DataField(this, x => x.PlacementMode, "placementMode", "PlaceFree");
|
ser.DataField(this, x => x.PlacementMode, "placementMode", "PlaceFree");
|
||||||
ser.DataField(this, x => x.CanBuildInImpassable, "canBuildInImpassable", false);
|
ser.DataField(this, x => x.CanBuildInImpassable, "canBuildInImpassable", false);
|
||||||
ser.DataField(this, x => x.Category, "category", string.Empty);
|
ser.DataField(this, x => x.Category, "category", string.Empty);
|
||||||
|
ser.DataField(this, x => x.CanRotate, "canRotate", true);
|
||||||
ser.DataField(ref _conditions, "conditions", new List<IConstructionCondition>());
|
ser.DataField(ref _conditions, "conditions", new List<IConstructionCondition>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
state: wall_girder
|
state: wall_girder
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: wall
|
name: wall
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
state: full
|
state: full
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: reinforced wall
|
name: reinforced wall
|
||||||
@@ -39,6 +41,7 @@
|
|||||||
state: rgeneric
|
state: rgeneric
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: low wall
|
name: low wall
|
||||||
@@ -55,6 +58,7 @@
|
|||||||
state: metal
|
state: metal
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: window
|
name: window
|
||||||
@@ -71,6 +75,7 @@
|
|||||||
state: full
|
state: full
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: reinforced window
|
name: reinforced window
|
||||||
@@ -87,6 +92,7 @@
|
|||||||
state: full
|
state: full
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|
||||||
- type: construction
|
- type: construction
|
||||||
name: phoron window
|
name: phoron window
|
||||||
@@ -103,3 +109,4 @@
|
|||||||
state: full
|
state: full
|
||||||
objectType: Structure
|
objectType: Structure
|
||||||
placementMode: SnapgridCenter
|
placementMode: SnapgridCenter
|
||||||
|
canRotate: false
|
||||||
|
|||||||
Reference in New Issue
Block a user