public void ToBloodstream(GasMixture mixture) { if (!Owner.TryGetComponent(out BloodstreamComponent bloodstream)) { return; } var to = bloodstream.Air; to.Merge(mixture); mixture.Clear(); }
private void ExcitedGroupSelfBreakdown(GridAtmosphereComponent gridAtmosphere, ExcitedGroup excitedGroup) { DebugTools.Assert(!excitedGroup.Disposed, "Excited group is disposed!"); DebugTools.Assert(gridAtmosphere.ExcitedGroups.Contains(excitedGroup), "Grid Atmosphere does not contain Excited Group!"); var combined = new GasMixture(Atmospherics.CellVolume); var tileSize = excitedGroup.Tiles.Count; if (excitedGroup.Disposed) { return; } if (tileSize == 0) { ExcitedGroupDispose(gridAtmosphere, excitedGroup); return; } foreach (var tile in excitedGroup.Tiles) { if (tile?.Air == null) { continue; } Merge(combined, tile.Air); if (!ExcitedGroupsSpaceIsAllConsuming || !tile.Air.Immutable) { continue; } combined.Clear(); break; } combined.Multiply(1 / (float)tileSize); foreach (var tile in excitedGroup.Tiles) { if (tile?.Air == null) { continue; } tile.Air.CopyFromMutable(combined); InvalidateVisuals(tile.GridIndex, tile.GridIndices); } excitedGroup.BreakdownCooldown = 0; }
/// <summary> /// Mix air from a gas container into a pipe net. /// Useful for anything that uses connector ports. /// </summary> public void MixContainerWithPipeNet(GasMixture containerAir, GasMixture pipeNetAir) { var buffer = new GasMixture(pipeNetAir.Volume + containerAir.Volume); _atmosphereSystem.Merge(buffer, pipeNetAir); _atmosphereSystem.Merge(buffer, containerAir); pipeNetAir.Clear(); _atmosphereSystem.Merge(pipeNetAir, buffer); pipeNetAir.Multiply(pipeNetAir.Volume / buffer.Volume); containerAir.Clear(); _atmosphereSystem.Merge(containerAir, buffer); containerAir.Multiply(containerAir.Volume / buffer.Volume); }
protected override void VentGas(GasMixture inletGas, GasMixture outletGas) { outletGas.Merge(inletGas); inletGas.Clear(); }