Fix pipe net null error (#9508)

This commit is contained in:
Leon Friedrich
2022-07-07 15:36:07 +12:00
committed by GitHub
parent 731e9cbd9f
commit d9c247b310
6 changed files with 32 additions and 28 deletions

View File

@@ -3,7 +3,7 @@ using Content.Shared.Atmos;
namespace Content.Server.Atmos.Piping.Unary.Components
{
[RegisterComponent]
public sealed class GasCanisterComponent : Component
public sealed class GasCanisterComponent : Component, IGasMixtureHolder
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("port")]
@@ -18,7 +18,7 @@ namespace Content.Server.Atmos.Piping.Unary.Components
[ViewVariables(VVAccess.ReadWrite)]
[DataField("gasMixture")]
public GasMixture Air { get; } = new();
public GasMixture Air { get; set; } = new();
/// <summary>
/// Last recorded pressure, for appearance-updating purposes.

View File

@@ -139,6 +139,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnCanisterUpdated(EntityUid uid, GasCanisterComponent canister, AtmosDeviceUpdateEvent args)
{
_atmosphereSystem.React(canister.Air, canister);
if (!EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|| !EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return;
@@ -146,8 +148,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!nodeContainer.TryGetNode(canister.PortName, out PortablePipeNode? portNode))
return;
_atmosphereSystem.React(canister.Air, portNode);
if (portNode.NodeGroup is PipeNet {NodeCount: > 1} net)
{
var buffer = new GasMixture(net.Air.Volume + canister.Air.Volume);