Fix pipe connection bug (#6753)
This commit is contained in:
@@ -61,6 +61,8 @@ namespace Content.Server.NodeContainer.EntitySystems
|
|||||||
if (!node.NeedAnchored)
|
if (!node.NeedAnchored)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
node.OnAnchorStateChanged(EntityManager, args.Anchored);
|
||||||
|
|
||||||
if (args.Anchored)
|
if (args.Anchored)
|
||||||
_nodeGroupSystem.QueueReflood(node);
|
_nodeGroupSystem.QueueReflood(node);
|
||||||
else
|
else
|
||||||
@@ -75,14 +77,15 @@ namespace Content.Server.NodeContainer.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var anchored = Transform(uid).Anchored;
|
var xform = Transform(uid);
|
||||||
|
|
||||||
foreach (var node in container.Nodes.Values)
|
foreach (var node in container.Nodes.Values)
|
||||||
{
|
{
|
||||||
if (node.NeedAnchored && !anchored)
|
if (node is not IRotatableNode rotatableNode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (node is not IRotatableNode rotatableNode)
|
// Don't bother updating nodes that can't even be connected to anything atm.
|
||||||
|
if (!node.Connectable(EntityManager, xform))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rotatableNode.RotateEvent(ref ev))
|
if (rotatableNode.RotateEvent(ref ev))
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
return xform.Anchored;
|
return xform.Anchored;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool Anchored => !NeedAnchored || IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored;
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("needAnchored")]
|
[DataField("needAnchored")]
|
||||||
public bool NeedAnchored { get; } = true;
|
public bool NeedAnchored { get; } = true;
|
||||||
|
|
||||||
|
public virtual void OnAnchorStateChanged(IEntityManager entityManager, bool anchored) { }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents a node from being used by other nodes while midway through removal.
|
/// Prevents a node from being used by other nodes while midway through removal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -133,14 +133,29 @@ namespace Content.Server.NodeContainer.Nodes
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
CurrentPipeDirection = _originalPipeDirection;
|
CurrentPipeDirection = _originalPipeDirection;
|
||||||
}
|
return true;
|
||||||
else
|
|
||||||
{
|
|
||||||
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(ev.NewRotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// node connections need to be updated
|
var oldDirection = CurrentPipeDirection;
|
||||||
return true;
|
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(ev.NewRotation);
|
||||||
|
return oldDirection != CurrentPipeDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnAnchorStateChanged(IEntityManager entityManager, bool anchored)
|
||||||
|
{
|
||||||
|
if (!anchored)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// update valid pipe directions
|
||||||
|
|
||||||
|
if (!RotationsEnabled)
|
||||||
|
{
|
||||||
|
CurrentPipeDirection = _originalPipeDirection;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var xform = entityManager.GetComponent<TransformComponent>(Owner);
|
||||||
|
CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(xform.LocalRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
public override IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||||
|
|||||||
Reference in New Issue
Block a user