diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs
index 80db076522..4588d7d555 100644
--- a/Content.Server/NodeContainer/Nodes/PipeNode.cs
+++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs
@@ -25,11 +25,16 @@ namespace Content.Server.NodeContainer.Nodes
///
/// The directions in which this pipe can connect to other pipes around it.
- /// Used to check if this pipe can connect to another pipe in a given direction.
///
[ViewVariables]
[DataField("pipeDirection")]
- public PipeDirection PipeDirection { get; private set; }
+ private PipeDirection _originalPipeDirection;
+
+ ///
+ /// The *current* pipe directions (accounting for rotation)
+ /// Used to check if this pipe can connect to another pipe in a given direction.
+ ///
+ public PipeDirection CurrentPipeDirection { get; private set; }
///
/// The directions in which this node is connected to other nodes.
@@ -103,8 +108,6 @@ namespace Content.Server.NodeContainer.Nodes
public override void OnContainerStartup()
{
base.OnContainerStartup();
- //HACK: THIS LINE RIGHT HERE IS A FILTHY HACK AND I HATE IT --moony
- PipeDirection = PipeDirection.RotatePipeDirection(Owner.Transform.LocalRotation);
OnConnectedDirectionsNeedsUpdating();
}
@@ -124,9 +127,6 @@ namespace Content.Server.NodeContainer.Nodes
///
void IRotatableNode.RotateEvent(ref RotateEvent ev)
{
- if (!RotationsEnabled) return;
- var diff = ev.NewRotation - ev.OldRotation;
- PipeDirection = PipeDirection.RotatePipeDirection(diff);
OnConnectedDirectionsNeedsUpdating();
UpdateAppearance();
}
@@ -137,7 +137,7 @@ namespace Content.Server.NodeContainer.Nodes
{
var pipeDir = (PipeDirection) (1 << i);
- if (!PipeDirection.HasDirection(pipeDir))
+ if (!CurrentPipeDirection.HasDirection(pipeDir))
continue;
foreach (var pipe in LinkableNodesInDirection(pipeDir))
@@ -157,7 +157,7 @@ namespace Content.Server.NodeContainer.Nodes
foreach (var pipe in PipesInDirection(pipeDir))
{
- if (pipe.ConnectionsEnabled && pipe.PipeDirection.HasDirection(pipeDir.GetOpposite()))
+ if (pipe.ConnectionsEnabled && pipe.CurrentPipeDirection.HasDirection(pipeDir.GetOpposite()))
yield return pipe;
}
}
@@ -210,9 +210,18 @@ namespace Content.Server.NodeContainer.Nodes
///
/// Updates the of this and all sorrounding pipes.
+ /// Also updates CurrentPipeDirection.
///
private void OnConnectedDirectionsNeedsUpdating()
{
+ if (RotationsEnabled)
+ {
+ CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(Owner.Transform.LocalRotation);
+ }
+ else
+ {
+ CurrentPipeDirection = _originalPipeDirection;
+ }
UpdateConnectedDirections();
UpdateAdjacentConnectedDirections();
UpdateAppearance();
@@ -229,7 +238,7 @@ namespace Content.Server.NodeContainer.Nodes
{
var pipeDir = (PipeDirection) (1 << i);
- if (!PipeDirection.HasDirection(pipeDir))
+ if (!CurrentPipeDirection.HasDirection(pipeDir))
continue;
foreach (var pipe in LinkableNodesInDirection(pipeDir))