Esempio n. 1
0
 private GasMix(float[] gases, float pressure, float volume = AtmosConstants.TileVolume)
 {
     Gases       = gases;
     Pressure    = pressure;
     Volume      = volume;
     Temperature = AtmosUtils.CalcTemperature(Pressure, Volume, Gases.Sum());
 }
Esempio n. 2
0
        private void Update(MetaDataNode node)
        {
            //Gases are frozen within closed airlocks or walls
            if (node.IsOccupied || node.IsClosedAirlock)
            {
                return;
            }

            nodes.Clear();
            nodes.Add(node);

            node.AddNeighborsToList(ref nodes);

            bool isPressureChanged = AtmosUtils.IsPressureChanged(node, out var windDirection, out var windForce);

            if (isPressureChanged)
            {
                node.ReactionManager.AddWindEvent(node, windDirection, windForce);
                Equalize();

                for (int i = 1; i < nodes.Count; i++)
                {
                    updateList.Enqueue(nodes[i]);
                }
            }

            //Check to see if any reactions are needed
            DoReactions(node);

            //Check to see if node needs vfx applied
            GasVisualEffects(node);
        }
Esempio n. 3
0
        public static GasMix FromTemperature(float[] gases, float temperature, float volume = AtmosConstants.TileVolume)
        {
            float pressure = 0;

            if (temperature >= 0)
            {
                pressure = AtmosUtils.CalcPressure(volume, gases.Sum(), temperature);
            }

            return(FromPressure(gases, pressure, volume));
        }
Esempio n. 4
0
        private void Update(MetaDataNode node)
        {
            nodes.Clear();
            nodes.Add(node);

            node.AddNeighborsToList(ref nodes);

            //Conduct heat from this nodes gas mix to this nodes tile
            if (node.IsOccupied == false || node.IsIsolatedNode)
            {
                ConductFromOpenToSolid(node, meanGasMix);
            }

            //Gases are frozen within walls and isolated tiles (closed airlocks) so dont do gas equalising
            if (node.IsOccupied == false && node.IsIsolatedNode == false)
            {
                bool isPressureChanged = AtmosUtils.IsPressureChanged(node, out var windDirection, out var windForce);

                if (isPressureChanged)
                {
                    node.ReactionManager.AddWindEvent(node, windDirection, windForce);
                    Equalize();

                    for (int i = 1; i < nodes.Count; i++)
                    {
                        updateList.Enqueue(nodes[i]);
                    }
                }
            }

            //Check to see if we need to do conductivity to other adjacent tiles
            Conductivity(node);

            //Only allow open tiles or isolated tiles to do reactions
            if (node.IsOccupied && node.IsIsolatedNode == false)
            {
                return;
            }

            //Check to see if any reactions are needed
            DoReactions(node);

            //Check to see if node needs vfx applied
            GasVisualEffects(node);
        }
Esempio n. 5
0
        public static GasValuesList CopyGasArray(GasData GasData)
        {
            var List = GetGasValuesList();

            lock (GasData.GasesArray)             //no Double lock
            {
                foreach (var gv in GasData.GasesArray)
                {
                    var Newgas = AtmosUtils.GetGasValues();
                    Newgas.Moles = gv.Moles;
                    Newgas.GasSO = gv.GasSO;
                    List.List.Add(Newgas);
                }
            }


            return(List);
        }
Esempio n. 6
0
 private void Recalculate()
 {
     Pressure = AtmosUtils.CalcPressure(Volume, Moles, Temperature);
 }
Esempio n. 7
0
 public void SetPressure(float newPressure)
 {
     Pressure    = newPressure;
     Temperature = AtmosUtils.CalcTemperature(Pressure, Volume, Moles);
 }
Esempio n. 8
0
 public void SetTemperature(float newTemperature)
 {
     Temperature = newTemperature;
     Pressure    = AtmosUtils.CalcPressure(Volume, Moles, Temperature);
 }