Exemplo n.º 1
0
        private void CheckAtmos()
        {
            if (SelfSufficient == false)
            {
                var pressureDensity = pipeData.mixAndVolume.Density();

                if (pressureDensity.y > MaxInternalPressure || metaNode.GasMix.Pressure < MMinimumPressure)
                {
                    return;
                }
            }
            else
            {
                if (metaNode.GasMix.Pressure < MMinimumPressure)
                {
                    return;
                }
            }

            if (metaNode.GasMix.Pressure == 0)
            {
                return;
            }

            float available = MMinimumPressure / metaNode.GasMix.Pressure * metaNode.GasMix.Moles;

            if (available < 0)
            {
                return;
            }

            if (MaxTransferMoles < available)
            {
                available = MaxTransferMoles;
            }

            var gasOnNode = metaNode.GasMix;

            if (SelfSufficient)
            {
                GasMix.TransferGas(selfSufficientGas, gasOnNode, available);
                selfSufficientGas.Copy(GasMixes.BaseAirMix);
            }
            else
            {
                var pipeMix = pipeData.mixAndVolume.GetGasMix();
                GasMix.TransferGas(pipeMix, gasOnNode, available);
            }

            metaDataLayer.UpdateSystemsAt(registerTile.LocalPositionServer, SystemType.AtmosSystem);
        }
Exemplo n.º 2
0
        public override void TickUpdate()
        {
            pipeData.mixAndVolume.EqualiseWithOutputs(pipeData.Outputs);

            if (IsOperating == false || isWelded)
            {
                return;
            }

            Operate();

            if (selfSufficient)
            {
                pipeMix.Copy(GasMixes.BaseAirMix);
            }
        }
Exemplo n.º 3
0
        private void CheckAtmos()
        {
            //metaNode.GasMix = pipeData.mixAndVolume.EqualiseWithExternal(metaNode.GasMix);
            if (metaNode.GasMix.Pressure > MaxOutletPressure)
            {
                return;
            }

            float molesTransferred;

            if (metaNode.GasMix.Pressure != 0)
            {
                molesTransferred = ((MaxOutletPressure / metaNode.GasMix.Pressure) * metaNode.GasMix.Moles) - metaNode.GasMix.Moles;
                if (MaxTransferMoles < molesTransferred)
                {
                    molesTransferred = MaxTransferMoles;
                }
            }
            else
            {
                molesTransferred = MaxTransferMoles;
            }

            if (SelfSufficient)
            {
                TransferGas(selfSufficientGas, molesTransferred);
                selfSufficientGas.Copy(GasMixes.Air);
            }
            else
            {
                var pipeMix = pipeData.mixAndVolume.GetGasMix();
                TransferGas(pipeMix, molesTransferred);
            }

            metaDataLayer.UpdateSystemsAt(registerTile.LocalPositionServer, SystemType.AtmosSystem);
        }