Canister fixes and rework (#4266)
* Kills PipeNode ConnectToContainedEntities and EnvironmentalAir with fire. * Reaction IGasMixtureHolder is nullable. * Reworks canisters * Adds PortablePipeNode and PortPipeNode, which connect to each other.
This commit is contained in:
committed by
GitHub
parent
077f158dda
commit
d8e353742c
@@ -34,10 +34,6 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
[DataField("pipeDirection")]
|
||||
public PipeDirection PipeDirection { get; private set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("connectToContainedEntities")]
|
||||
public bool ConnectToContainedEntities { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The directions in which this node is connected to other nodes.
|
||||
/// Used by <see cref="PipeVisualState"/>.
|
||||
@@ -81,20 +77,13 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
[ViewVariables]
|
||||
private IPipeNet? PipeNet => (IPipeNet?) NodeGroup;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to ignore the pipenet and return the environment's air.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("environmentalAir")]
|
||||
public bool EnvironmentalAir { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The gases in this pipe.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public GasMixture Air
|
||||
{
|
||||
get => (!EnvironmentalAir ? PipeNet?.Air : Owner.Transform.Coordinates.GetTileAir()) ?? GasMixture.SpaceGas;
|
||||
get => PipeNet?.Air ?? GasMixture.SpaceGas;
|
||||
set
|
||||
{
|
||||
DebugTools.Assert(PipeNet != null);
|
||||
@@ -104,14 +93,8 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
|
||||
public void AssumeAir(GasMixture giver)
|
||||
{
|
||||
if (EnvironmentalAir)
|
||||
{
|
||||
var tileAtmosphere = Owner.Transform.Coordinates.GetTileAtmosphere();
|
||||
tileAtmosphere?.AssumeAir(giver);
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AtmosphereSystem>().Merge(PipeNet!.Air, giver);
|
||||
if(PipeNet != null)
|
||||
EntitySystem.Get<AtmosphereSystem>().Merge(PipeNet.Air, giver);
|
||||
}
|
||||
|
||||
[ViewVariables]
|
||||
@@ -163,24 +146,6 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
yield return pipe;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ConnectionsEnabled || !ConnectToContainedEntities || !Owner.TryGetComponent(out ContainerManagerComponent? containerManager))
|
||||
yield break;
|
||||
|
||||
// TODO ATMOS Kill it with fire.
|
||||
foreach (var container in containerManager.GetAllContainers())
|
||||
{
|
||||
foreach (var entity in container.ContainedEntities)
|
||||
{
|
||||
if (!entity.TryGetComponent(out NodeContainerComponent? nodeContainer))
|
||||
continue;
|
||||
|
||||
foreach (var node in nodeContainer.Nodes.Values)
|
||||
{
|
||||
yield return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -191,17 +156,6 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
if (!Anchored)
|
||||
yield break;
|
||||
|
||||
if (pipeDir is PipeDirection.Port or PipeDirection.Connector)
|
||||
{
|
||||
foreach (var pipe in PipesInTile())
|
||||
{
|
||||
if (pipe.Anchored && pipe.ConnectionsEnabled && pipe.PipeDirection.HasDirection(pipeDir.GetOpposite()))
|
||||
yield return pipe;
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var pipe in PipesInDirection(pipeDir))
|
||||
{
|
||||
if (pipe.ConnectionsEnabled && pipe.PipeDirection.HasDirection(pipeDir.GetOpposite()))
|
||||
@@ -212,7 +166,7 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
/// <summary>
|
||||
/// Gets the pipes from entities on the tile adjacent in a direction.
|
||||
/// </summary>
|
||||
private IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir)
|
||||
protected IEnumerable<PipeNode> PipesInDirection(PipeDirection pipeDir)
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
yield break;
|
||||
@@ -233,9 +187,9 @@ namespace Content.Server.NodeContainer.Nodes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the pipes from entities on the tile adjacent in a direction.
|
||||
/// Gets the pipes from entities on the same tile.
|
||||
/// </summary>
|
||||
private IEnumerable<PipeNode> PipesInTile()
|
||||
protected IEnumerable<PipeNode> PipesInTile()
|
||||
{
|
||||
if (!Owner.Transform.Anchored)
|
||||
yield break;
|
||||
|
||||
Reference in New Issue
Block a user