Fix pipe net null error (#9508)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user