Piping Unit test fixes (#3471)

* PipeNetDevice on piping prototypes

* client component ignore

* NodeContainer OnRemove bugfix

* Moves some NodeContainer code from OnRemove to Shutdown

* yaml indentation fix
This commit is contained in:
collinlunn
2021-03-02 11:58:19 -07:00
committed by GitHub
parent 91cea56a5a
commit 06f549d282
12 changed files with 25 additions and 12 deletions

View File

@@ -152,6 +152,7 @@ namespace Content.Client
"VolumePump", "VolumePump",
"PressureSiphon", "PressureSiphon",
"PipeHeater", "PipeHeater",
"PipeNetDevice",
"SignalReceiver", "SignalReceiver",
"SignalSwitch", "SignalSwitch",
"SignalTransmitter", "SignalTransmitter",

View File

@@ -60,13 +60,14 @@ namespace Content.Server.GameObjects.Components.NodeContainer
} }
} }
public override void OnRemove() protected override void Shutdown()
{ {
base.Shutdown();
foreach (var node in _nodes) foreach (var node in _nodes)
{ {
node.OnContainerRemove(); node.OnContainerShutdown();
} }
base.OnRemove();
} }
private void AnchorUpdate() private void AnchorUpdate()

View File

@@ -11,8 +11,10 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
{ {
protected override IEnumerable<Node> GetReachableNodes() protected override IEnumerable<Node> GetReachableNodes()
{ {
var cells = Owner.GetComponent<SnapGridComponent>() if (!Owner.TryGetComponent(out SnapGridComponent? grid))
.GetCardinalNeighborCells(); yield break;
var cells = grid.GetCardinalNeighborCells();
foreach (var cell in cells) foreach (var cell in cells)
{ {

View File

@@ -74,7 +74,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
} }
} }
public virtual void OnContainerRemove() public virtual void OnContainerShutdown()
{ {
_deleting = true; _deleting = true;
NodeGroup.RemoveNode(this); NodeGroup.RemoveNode(this);

View File

@@ -109,9 +109,9 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
UpdateAppearance(); UpdateAppearance();
} }
public override void OnContainerRemove() public override void OnContainerShutdown()
{ {
base.OnContainerRemove(); base.OnContainerShutdown();
UpdateAdjacentConnectedDirections(); UpdateAdjacentConnectedDirections();
} }
@@ -173,8 +173,10 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
/// </summary> /// </summary>
private IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir) private IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir)
{ {
var entities = Owner.GetComponent<SnapGridComponent>() if (!Owner.TryGetComponent(out SnapGridComponent? grid))
.GetInDir(pipeDir.ToDirection()); yield break;
var entities = grid.GetInDir(pipeDir.ToDirection());
foreach (var entity in entities) foreach (var entity in entities)
{ {

View File

@@ -29,6 +29,7 @@
- !type:DoActsBehavior - !type:DoActsBehavior
acts: ["Destruction"] acts: ["Destruction"]
- type: GasCanisterPort - type: GasCanisterPort
- type: PipeNetDevice
- type: entity - type: entity
parent: GasCanisterPortBase parent: GasCanisterPortBase

View File

@@ -30,6 +30,7 @@
visuals: visuals:
- type: PipeConnectorVisualizer - type: PipeConnectorVisualizer
- type: GasFilterVisualizer - type: GasFilterVisualizer
- type: PipeNetDevice
- type: entity - type: entity
parent: GasFilterBase parent: GasFilterBase

View File

@@ -23,6 +23,7 @@
- type: SnapGrid - type: SnapGrid
offset: Center offset: Center
- type: GasGenerator - type: GasGenerator
- type: PipeNetDevice
- type: entity - type: entity
parent: GasGeneratorBase parent: GasGeneratorBase

View File

@@ -30,4 +30,5 @@
- !type:PipeNode - !type:PipeNode
nodeGroupID: Pipe nodeGroupID: Pipe
pipeDirection: East pipeDirection: East
- type: PipeHeater - type: PipeHeater
- type: PipeNetDevice

View File

@@ -30,7 +30,8 @@
visuals: visuals:
- type: PipeConnectorVisualizer - type: PipeConnectorVisualizer
- type: PumpVisualizer - type: PumpVisualizer
- type: PipeNetDevice
- type: entity - type: entity
parent: PumpBase parent: PumpBase
id: DebugPressurePump id: DebugPressurePump

View File

@@ -30,6 +30,7 @@
visuals: visuals:
- type: PipeConnectorVisualizer - type: PipeConnectorVisualizer
- type: SiphonVisualizer - type: SiphonVisualizer
- type: PipeNetDevice
- type: entity - type: entity
parent: ScrubberBase parent: ScrubberBase

View File

@@ -30,6 +30,7 @@
visuals: visuals:
- type: PipeConnectorVisualizer - type: PipeConnectorVisualizer
- type: VentVisualizer - type: VentVisualizer
- type: PipeNetDevice
- type: entity - type: entity
parent: VentBase parent: VentBase