Пример #1
0
        // Function from file: oxygen_generator.dm
        public override int?process_atmos(  )
        {
            GasMixture air_contents          = null;
            double     total_moles           = 0;
            double     current_heat_capacity = 0;
            double     added_oxygen          = 0;

            base.process_atmos();

            if (!this.on)
            {
                return(0);
            }
            air_contents = this.airs[1];
            total_moles  = air_contents.total_moles();

            if (total_moles < this.oxygen_content)
            {
                current_heat_capacity    = air_contents.heat_capacity();
                added_oxygen             = this.oxygen_content - total_moles;
                air_contents.temperature = (current_heat_capacity * Convert.ToDouble(air_contents.temperature) + added_oxygen * 5463) / (current_heat_capacity + added_oxygen * 20);
                air_contents.assert_gas("o2");
                air_contents.gases["o2"][1] += added_oxygen;
                this.update_parents();
            }
            return(1);
        }
        // Function from file: other_tools.dm
        public override void critfail(  )
        {
            dynamic    T  = null;
            GasMixture GM = null;

            base.critfail();
            T = GlobalFuncs.get_turf(this);

            if (!Lang13.Bool(T))
            {
                return;
            }
            GM = new GasMixture();
            GM.assert_gas("plasma");

            if (Rand13.PercentChance(10))
            {
                GM.gases["plasma"][1] += 100;
                GM.temperature         = 1773.1500244140625;
                ((Ent_Static)T).visible_message("The " + this + " suddenly disgorges a cloud of heated plasma.");
                GlobalFuncs.qdel(this);
            }
            else
            {
                GM.gases["plasma"][1] += 5;
                GM.temperature         = (T is Tile_Simulated ? T.air.return_temperature() : ((dynamic)(293.41)));
                ((Ent_Static)T).visible_message("The " + this + " suddenly disgorges a cloud of plasma.");
            }
            ((Ent_Static)T).assume_air(GM);
            return;
        }
Пример #3
0
        // Function from file: plating.dm
        public Tile_Simulated_Floor_Engine_N2o(dynamic loc = null) : base((object)(loc))
        {
            GasMixture adding = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            adding = new GasMixture();
            adding.assert_gas("n2o");
            adding.gases["n2o"][1] = 6000;
            adding.temperature     = 293.41;
            this.assume_air(adding);
            return;
        }
Пример #4
0
        // Function from file: tank.dm
        public Obj_Machinery_Atmospherics_Components_Unary_Tank(dynamic loc = null, int?process = null) : base((object)(loc), process)
        {
            GasMixture air_contents = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;
            air_contents             = this.airs[1];
            air_contents.volume      = this.volume;
            air_contents.temperature = 293.41;

            if (Lang13.Bool(this.gas_type))
            {
                air_contents.assert_gas(this.gas_type);
                air_contents.gases[this.gas_type][1] = (air_contents.volume ?? 0) * 2533.125 / Convert.ToDouble(air_contents.temperature * 8.31);
                this.name = "" + this.name + " (" + air_contents.gases[this.gas_type][3][2] + ")";
            }
            return;
        }
Пример #5
0
        // Function from file: turf.dm
        public void Assimilate_Air(  )
        {
            GasMixture total       = null;
            ByTable    total_gases = null;
            int        turf_count  = 0;
            dynamic    direction   = null;
            Tile       T           = null;
            Tile       S           = null;
            ByTable    S_gases     = null;
            dynamic    id          = null;
            ByTable    air_gases   = null;
            dynamic    id2         = null;


            if (this.air != null)
            {
                total       = new GasMixture();
                total_gases = total.gases;
                turf_count  = 0;

                foreach (dynamic _b in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    direction = _b;

                    T = Map13.GetStep(this, Convert.ToInt32(direction));

                    if (T is Tile_Space)
                    {
                        turf_count++;
                        continue;
                    }

                    if (T is Tile_Simulated_Floor)
                    {
                        S = T;

                        if (Lang13.Bool(((dynamic)S).air))
                        {
                            S_gases = ((dynamic)S).air.gases;

                            foreach (dynamic _a in Lang13.Enumerate(S_gases))
                            {
                                id = _a;

                                total.assert_gas(id);
                                total_gases[id][1] += S_gases[id][1];
                            }
                            total.temperature += ((dynamic)S).air.temperature;
                        }
                        turf_count++;
                    }
                }
                this.air.copy_from(total);

                if (turf_count != 0)
                {
                    air_gases = this.air.gases;

                    foreach (dynamic _c in Lang13.Enumerate(air_gases))
                    {
                        id2 = _c;

                        air_gases[id2][1] /= turf_count;
                    }
                    this.air.temperature /= turf_count;
                }
                GlobalVars.SSair.add_to_active(this);
            }
            return;
        }
Пример #6
0
        // Function from file: LINDA_system.dm
        public void atmos_spawn_air(int flag = 0, double?amount = null)
        {
            GasMixture G         = null;
            ByTable    new_gases = null;


            if (!Lang13.Bool(this.text) || !Lang13.Bool(amount) || !(this.air != null))
            {
                return;
            }
            G         = new GasMixture();
            new_gases = G.gases;

            if ((flag & 2) != 0)
            {
                G.temperature = 293.41;
            }

            if ((flag & 1) != 0)
            {
                G.temperature += 1000;
            }

            if ((flag & 4) != 0)
            {
                G.assert_gas("plasma");
                new_gases["plasma"][1] += amount;
            }

            if ((flag & 8) != 0)
            {
                G.assert_gas("o2");
                new_gases["o2"][1] += amount;
            }

            if ((flag & 16) != 0)
            {
                G.assert_gas("co2");
                new_gases["co2"][1] += amount;
            }

            if ((flag & 32) != 0)
            {
                G.assert_gas("n2");
                new_gases["n2"][1] += amount;
            }

            if ((flag & 64) != 0)
            {
                G.assert_gas("n2o");
                new_gases["n2o"][1] += amount;
            }

            if ((flag & 256) != 0)
            {
                G.assert_gases("o2", "n2");
                new_gases["o2"][1] += (amount ?? 0) * 21.83659553527832;
                new_gases["n2"][1] += (amount ?? 0) * 82.14720153808594;
            }
            this.air.merge(G);
            GlobalVars.SSair.add_to_active(this, false);
            return;
        }
Пример #7
0
        // Function from file: effects_smoke.dm
        public void Chilled(dynamic A = null)
        {
            dynamic            T       = null;
            GasMixture         G       = null;
            Obj_Effect_Hotspot H       = null;
            ByTable            G_gases = null;
            Obj_Machinery_Atmospherics_Components_Unary U = null;
            Mob_Living L    = null;
            Obj_Item   Item = null;


            if (A is Tile_Simulated)
            {
                T = A;

                if (Lang13.Bool(T.air))
                {
                    G = T.air;

                    if (Map13.GetDistance(T, this.location) < 2)
                    {
                        G.temperature = 2;
                    }
                    ((Tile)T).air_update_turf();

                    foreach (dynamic _a in Lang13.Enumerate(T, typeof(Obj_Effect_Hotspot)))
                    {
                        H = _a;

                        GlobalFuncs.qdel(H);
                        G_gases = G.gases;

                        if (Lang13.Bool(G_gases["plasma"]))
                        {
                            G.assert_gas("n2");
                            G_gases["n2"][1]    += G_gases["plasma"][1];
                            G_gases["plasma"][1] = 0;
                            G.garbage_collect();
                        }
                    }
                }

                foreach (dynamic _b in Lang13.Enumerate(T, typeof(Obj_Machinery_Atmospherics_Components_Unary)))
                {
                    U = _b;


                    if (!(U.welded == null) && !(U.welded == true))
                    {
                        U.welded = true;
                        U.update_icon();
                        U.visible_message("<span class='danger'>" + U + " was frozen shut!</span>");
                    }
                }

                foreach (dynamic _c in Lang13.Enumerate(T, typeof(Mob_Living)))
                {
                    L = _c;

                    L.ExtinguishMob();
                }

                foreach (dynamic _d in Lang13.Enumerate(T, typeof(Obj_Item)))
                {
                    Item = _d;

                    Item.extinguish();
                }
            }
            return;
        }
        // Function from file: filter.dm
        public override int?process_atmos(  )
        {
            dynamic    air1 = null;
            dynamic    air2 = null;
            dynamic    air3 = null;
            dynamic    output_starting_pressure = null;
            double     pressure_delta           = 0;
            double     transfer_moles           = 0;
            dynamic    removed      = null;
            GasMixture filtered_out = null;

            base.process_atmos();

            if (!this.on)
            {
                return(0);
            }

            if (!(Lang13.Bool(this.nodes[1]) && Lang13.Bool(this.nodes[2]) && Lang13.Bool(this.nodes[3])))
            {
                return(0);
            }
            air1 = this.airs[1];
            air2 = this.airs[2];
            air3 = this.airs[3];
            output_starting_pressure = air3.return_pressure();

            if (Convert.ToDouble(output_starting_pressure) >= this.target_pressure)
            {
                return(1);
            }
            pressure_delta = this.target_pressure - Convert.ToDouble(output_starting_pressure);

            if (Convert.ToDouble(air1.temperature) > 0)
            {
                transfer_moles = pressure_delta * Convert.ToDouble(air3.volume) / Convert.ToDouble(air1.temperature * 8.31);
            }

            if (transfer_moles > 0)
            {
                removed = air1.remove(transfer_moles);

                if (!Lang13.Bool(removed))
                {
                    return(null);
                }
                filtered_out             = new GasMixture();
                filtered_out.temperature = removed.temperature;

                if (Lang13.Bool(this.filter_type) && Lang13.Bool(removed.gases[this.filter_type]))
                {
                    filtered_out.assert_gas(this.filter_type);
                    filtered_out.gases[this.filter_type][1] = removed.gases[this.filter_type][1];
                    removed.gases[this.filter_type][1]      = 0;
                    removed.garbage_collect();
                }
                else
                {
                    filtered_out = null;
                }
                air2.merge(filtered_out);
                air3.merge(removed);
            }
            this.update_parents();
            return(1);
        }
        // Function from file: vent_scrubber.dm
        public bool scrub(Ent_Static tile = null)
        {
            GasMixture environment     = null;
            dynamic    air_contents    = null;
            ByTable    env_gases       = null;
            int?       should_we_scrub = null;
            dynamic    id              = null;
            double     transfer_moles  = 0;
            dynamic    removed         = null;
            ByTable    removed_gases   = null;
            GasMixture filtered_out    = null;
            ByTable    filtered_gases  = null;
            double     transfer_moles2 = 0;
            dynamic    removed2        = null;


            if (!(tile is Tile_Simulated))
            {
                return(false);
            }
            environment  = tile.return_air();
            air_contents = this.airs[1];
            env_gases    = environment.gases;

            if ((((int)(this.scrubbing ?? 0)) & 1) != 0)
            {
                should_we_scrub = GlobalVars.FALSE;

                foreach (dynamic _a in Lang13.Enumerate(env_gases))
                {
                    id = _a;


                    if (id == "n2" || id == "o2")
                    {
                        continue;
                    }

                    if (Lang13.Bool(env_gases[id][1]))
                    {
                        should_we_scrub = GlobalVars.TRUE;
                        break;
                    }
                }

                if (Lang13.Bool(should_we_scrub))
                {
                    transfer_moles = Num13.MinInt(1, ((int)(this.volume_rate / (environment.volume ?? 0)))) * environment.total_moles();
                    removed        = tile.remove_air(transfer_moles);
                    removed_gases  = removed.gases;

                    if (removed == null)
                    {
                        return(false);
                    }
                    filtered_out             = new GasMixture();
                    filtered_gases           = filtered_out.gases;
                    filtered_out.temperature = removed.temperature;

                    if (Lang13.Bool(this.scrub_Toxins) && Lang13.Bool(removed_gases["plasma"]))
                    {
                        filtered_out.assert_gas("plasma");
                        filtered_gases["plasma"][1] = removed_gases["plasma"][1];
                        removed.gases["plasma"][1]  = 0;
                    }

                    if (Lang13.Bool(this.scrub_CO2) && Lang13.Bool(removed_gases["co2"]))
                    {
                        filtered_out.assert_gas("co2");
                        filtered_out.gases["co2"][1] = removed_gases["co2"][1];
                        removed.gases["co2"][1]      = 0;
                    }

                    if (Lang13.Bool(removed_gases["agent_b"]))
                    {
                        filtered_out.assert_gas("agent_b");
                        filtered_out.gases["agent_b"][1] = removed_gases["agent_b"][1];
                        removed.gases["agent_b"][1]      = 0;
                    }

                    if (Lang13.Bool(this.scrub_N2O) && Lang13.Bool(removed_gases["n2o"]))
                    {
                        filtered_out.assert_gas("n2o");
                        filtered_out.gases["n2o"][1] = removed_gases["n2o"][1];
                        removed.gases["n2o"][1]      = 0;
                    }
                    removed.garbage_collect();
                    air_contents.merge(filtered_out);
                    tile.assume_air(removed);
                    ((Tile)tile).air_update_turf();
                }
            }
            else
            {
                if (Convert.ToDouble(air_contents.return_pressure()) >= 5066.25)
                {
                    return(false);
                }
                transfer_moles2 = environment.total_moles() * (this.volume_rate / (environment.volume ?? 0));
                removed2        = tile.remove_air(transfer_moles2);
                air_contents.merge(removed2);
                ((Tile)tile).air_update_turf();
            }
            this.update_parents();
            return(true);
        }