private void JoinGridAtmos()
        {
            var gridAtmos = EntitySystem.Get <AtmosphereSystem>()
                            .GetGridAtmosphere(Owner.Transform.GridID);

            JoinedGridAtmos = gridAtmos;
            JoinedGridAtmos.AddPipeNetDevice(this);
        }
        private void JoinGridAtmos()
        {
            var gridAtmos = EntitySystem.Get <AtmosphereSystem>()
                            .GetGridAtmosphere(Owner.Transform.GridID);

            if (gridAtmos == null)
            {
                Logger.Error($"{nameof(PipeNetDeviceComponent)} on entity {Owner.Uid} could not find an {nameof(IGridAtmosphereComponent)}.");
                return;
            }
            JoinedGridAtmos = gridAtmos;
            JoinedGridAtmos.AddPipeNetDevice(this);
        }
        private bool CheckMinerOperation(IGridAtmosphereComponent atmosphere, GasMinerComponent miner, [NotNullWhen(true)] out TileAtmosphere?tile)
        {
            tile = atmosphere.GetTile(miner.Owner.Transform.Coordinates) !;

            // Space.
            if (atmosphere.IsSpace(tile.GridIndices))
            {
                miner.Broken = true;
                return(false);
            }

            // Airblocked location.
            if (tile.Air == null)
            {
                miner.Broken = true;
                return(false);
            }

            // External pressure above threshold.
            if (!float.IsInfinity(miner.MaxExternalPressure) &&
                tile.Air.Pressure > miner.MaxExternalPressure - miner.SpawnAmount * miner.SpawnTemperature * Atmospherics.R / tile.Air.Volume)
            {
                miner.Broken = true;
                return(false);
            }

            // External gas amount above threshold.
            if (!float.IsInfinity(miner.MaxExternalAmount) && tile.Air.TotalMoles > miner.MaxExternalAmount)
            {
                miner.Broken = true;
                return(false);
            }

            miner.Broken = false;
            return(true);
        }
 public AtmosDeviceDisabledEvent(IGridAtmosphereComponent atmosphere) : base(atmosphere)
 {
 }
 public AtmosDeviceUpdateEvent(IGridAtmosphereComponent atmosphere) : base(atmosphere)
 {
 }
 public BaseAtmosDeviceEvent(IGridAtmosphereComponent atmosphere)
 {
     Atmosphere = atmosphere;
 }
 private void LeaveGridAtmos()
 {
     JoinedGridAtmos?.RemovePipeNetDevice(this);
     JoinedGridAtmos = null;
 }