示例#1
0
        // Function from file: disposal-unit.dm
        public override void initialize(  )
        {
            Ent_Static L       = null;
            GasMixture env     = null;
            GasMixture removed = null;

            L   = this.loc;
            env = new GasMixture();
            env.copy_from(L.return_air());
            removed = env.remove(6.066249847412109);
            this.air_contents.merge(removed);
            this.trunk_check();
            return;
        }
示例#2
0
        // Function from file: he_pipes.dm
        public override int?process_atmos(  )
        {
            dynamic    environment_temperature = null;
            GasMixture pipe_air    = null;
            Ent_Static T           = null;
            GasMixture environment = null;
            double     hc          = 0;
            dynamic    avg_temp    = null;

            environment_temperature = 0;
            pipe_air = this.return_air();
            T        = this.loc;

            if (T is Tile_Simulated)
            {
                if (Lang13.Bool(((dynamic)T).blocks_air))
                {
                    environment_temperature = ((dynamic)T).temperature;
                }
                else
                {
                    environment             = T.return_air();
                    environment_temperature = environment.temperature;
                }
            }
            else
            {
                environment_temperature = ((dynamic)T).temperature;
            }

            if (Math.Abs(Convert.ToDouble(environment_temperature - pipe_air.temperature)) > this.minimum_temperature_difference)
            {
                this.parent.temperature_interact(T, this.volume, this.thermal_conductivity);
            }

            if (Lang13.Bool(this.buckled_mob))
            {
                hc                               = pipe_air.heat_capacity();
                avg_temp                         = (pipe_air.temperature * hc + this.buckled_mob.bodytemperature * 3500) / (hc + 3500);
                pipe_air.temperature             = avg_temp;
                this.buckled_mob.bodytemperature = avg_temp;
            }
            return(null);
        }
示例#3
0
        // Function from file: server.dm
        public void produce_heat(double heat_amt = 0)
        {
            Ent_Static L              = null;
            GasMixture env            = null;
            double     transfer_moles = 0;
            GasMixture removed        = null;
            double?    heat_capacity  = null;


            if (!((this.stat & 3) != 0))
            {
                L = this.loc;

                if (L is Tile_Simulated)
                {
                    env = L.return_air();

                    if (Convert.ToDouble(env.temperature) < heat_amt + 273.41)
                    {
                        transfer_moles = env.total_moles() * 0.25;
                        removed        = env.remove(transfer_moles);

                        if (removed != null)
                        {
                            heat_capacity = removed.heat_capacity();

                            if (heat_capacity == 0 || heat_capacity == null)
                            {
                                heat_capacity = 1;
                            }
                            removed.temperature = Num13.MinInt(Convert.ToInt32((removed.temperature * heat_capacity + this.heating_power) / heat_capacity), 1000);
                        }
                        env.merge(removed);
                        this.air_update_turf();
                    }
                }
            }
            return;
        }
示例#4
0
        // Function from file: supermatter.dm
        public override int?process(dynamic seconds = null)
        {
            Ent_Static L                = null;
            string     stability        = null;
            Mob_Living mob              = null;
            Mob_Living H                = null;
            double     rads             = 0;
            GasMixture env              = null;
            GasMixture removed          = null;
            bool       removed_nitrogen = false;
            int        temp_factor      = 0;
            double     device_energy    = 0;
            Mob_Living_Carbon_Human l   = null;
            Mob_Living l2               = null;
            double     rads2            = 0;

            L = this.loc;

            if (L == null)
            {
                return(26);
            }

            if (!(L is Tile))
            {
                return(null);
            }

            if (L is Tile_Space)
            {
                return(null);
            }

            if (this.damage > this.warning_point)
            {
                if ((Game13.timeofday - this.lastwarning) / 10 >= 30)
                {
                    stability = String13.NumberToString(Num13.Floor(this.damage / this.explosion_point * 100));

                    if (this.damage > this.emergency_point)
                    {
                        this.radio.talk_into(this, "" + this.emergency_alert + " Instability: " + stability + "%");
                        this.lastwarning = Game13.timeofday;

                        if (!this.has_reached_emergency)
                        {
                            this.investigate_log("has reached the emergency point for the first time.", "supermatter");
                            GlobalFuncs.message_admins("" + this + " has reached the emergency point <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=" + this.x + ";Y=" + this.y + ";Z=" + this.z + "'>(JMP)</a>.");
                            this.has_reached_emergency = true;
                        }
                    }
                    else if (this.damage >= this.damage_archived)
                    {
                        this.radio.talk_into(this, "" + this.warning_alert + " Instability: " + stability + "%");
                        this.lastwarning = Game13.timeofday - 150;
                    }
                    else
                    {
                        this.radio.talk_into(this, "" + this.safe_alert);
                        this.lastwarning = Game13.timeofday;
                    }
                }

                if (this.damage > this.explosion_point)
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.living_mob_list, typeof(Mob_Living)))
                    {
                        mob = _a;


                        if (mob is Mob_Living_Carbon_Human)
                        {
                            H = mob;
                            H.hallucination += Num13.MaxInt(50, Num13.MinInt(300, ((int)(Math.Sqrt(1 / (Map13.GetDistance(mob, this) + 1)) * 600))));
                        }
                        rads = Math.Sqrt(1 / (Map13.GetDistance(mob, this) + 1)) * 200;
                        mob.rad_act(rads);
                    }
                    this.explode();
                }
            }
            env     = L.return_air();
            removed = env.remove(this.gasefficency * env.total_moles());

            if (!(removed != null) || !(removed.total_moles() != 0))
            {
                this.damage += Num13.MaxInt(((int)((this.power - 1600) / 10)), 0);
                this.power   = Num13.MinInt(((int)(this.power)), 1600);
                return(1);
            }
            this.damage_archived = this.damage;
            this.damage          = Num13.MaxInt(((int)(this.damage + Convert.ToDouble((removed.temperature - 800) / 150))), 0);
            removed_nitrogen     = false;

            if (Lang13.Bool(removed.gases["n2"]))
            {
                removed_nitrogen = Lang13.Bool(removed.gases["n2"][1] * 2);
            }
            removed.assert_gases("o2", "plasma");
            this.oxygen = Num13.MaxInt(Num13.MinInt(Convert.ToInt32((removed.gases["o2"][1] - removed_nitrogen) / 103.98379516601562), 1), 0);
            temp_factor = 50;

            if (this.oxygen > 0.8)
            {
                this.icon_state = "" + this.base_icon_state + "_glow";
            }
            else
            {
                temp_factor     = 30;
                this.icon_state = this.base_icon_state;
            }
            this.power = Num13.MaxInt(Convert.ToInt32(removed.temperature * temp_factor / 273.41 * this.oxygen + this.power), 0);
            this.transfer_energy();
            device_energy               = this.power * 0.55;
            removed.temperature        += device_energy / 5;
            removed.temperature         = Num13.MaxInt(0, Num13.MinInt(Convert.ToInt32(removed.temperature), 2500));
            removed.gases["plasma"][1] += Num13.MaxInt(((int)(device_energy / 750)), 0);
            removed.gases["o2"][1]     += Num13.MaxInt(((int)((device_energy + Convert.ToDouble(removed.temperature) - 273.41) / 325)), 0);
            env.merge(removed);

            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInView(Num13.MinInt(7, Num13.Floor(Math.Pow(this.power, 0.25))), this), typeof(Mob_Living_Carbon_Human)))
            {
                l = _b;


                if (!(l.glasses is Obj_Item_Clothing_Glasses_Meson))
                {
                    l.hallucination = Num13.MaxInt(0, Num13.MinInt(200, ((int)(l.hallucination + this.power * this.config_hallucination_power * Math.Sqrt(1 / Num13.MaxInt(1, Map13.GetDistance(l, this)))))));
                }
            }

            foreach (dynamic _c in Lang13.Enumerate(Map13.FetchInRange(Num13.Floor(Math.Pow(this.power / 100, 0.25)), this), typeof(Mob_Living)))
            {
                l2 = _c;

                rads2 = this.power / 10 * Math.Sqrt(1 / Num13.MaxInt(Map13.GetDistance(l2, this), 1));
                l2.rad_act(rads2);
            }
            this.power -= Math.Pow(this.power / 500, 3);
            return(1);
        }
        // Function from file: disposal-unit.dm
        public override int?process(dynamic seconds = null)
        {
            Ent_Static L              = null;
            GasMixture env            = null;
            double     pressure_delta = 0;
            double     transfer_moles = 0;
            GasMixture removed        = null;


            if ((this.stat & 1) != 0)
            {
                return(null);
            }
            this.flush_count++;

            if (this.flush_count >= this.flush_every_ticks)
            {
                if (this.contents.len != 0)
                {
                    if (this.mode == 2)
                    {
                        Task13.Schedule(0, (Task13.Closure)(() => {
                            GlobalFuncs.feedback_inc("disposal_auto_flush", 1);
                            this.f_flush();
                            return;
                        }));
                    }
                }
                this.flush_count = 0;
            }
            this.updateDialog();

            if (Lang13.Bool(this.flush) && this.air_contents.return_pressure() >= 5.066249847412109)
            {
                Task13.Schedule(0, (Task13.Closure)(() => {
                    this.f_flush();
                    return;
                }));
            }

            if ((this.stat & 2) != 0)
            {
                return(null);
            }
            this.f_use_power(100);

            if (this.mode != 1)
            {
                return(null);
            }
            this.f_use_power(500);
            L              = this.loc;
            env            = L.return_air();
            pressure_delta = 5.116912364959717 - this.air_contents.return_pressure();

            if (Convert.ToDouble(env.temperature) > 0)
            {
                transfer_moles = pressure_delta * (this.air_contents.volume ?? 0) * 0.1 / Convert.ToDouble(env.temperature * 8.31);
                removed        = env.remove(transfer_moles);
                this.air_contents.merge(removed);
                this.air_update_turf();
            }

            if (this.air_contents.return_pressure() >= 5.066249847412109)
            {
                this.mode = 2;
                this.update();
            }
            return(null);
        }
示例#6
0
        // Function from file: spaceheater.dm
        public override int?process(dynamic seconds = null)
        {
            Ent_Static L                = null;
            GasMixture env              = null;
            string     newMode          = null;
            double     heat_capacity    = 0;
            double     requiredPower    = 0;
            double     deltaTemperature = 0;


            if (!Lang13.Bool(this.on) || !this.is_operational())
            {
                return(null);
            }

            if (Lang13.Bool(this.cell) && Convert.ToDouble(this.cell.charge) > 0)
            {
                L = this.loc;

                if (!(L is Tile_Simulated))
                {
                    if (this.mode != "standby")
                    {
                        this.mode = "standby";
                        this.update_icon();
                    }
                    return(null);
                }
                env     = L.return_air();
                newMode = "standby";

                if (this.setMode != "cool" && Convert.ToDouble(env.temperature) < this.targetTemperature - (this.temperatureTolerance ?1:0))
                {
                    newMode = "heat";
                }
                else if (this.setMode != "heat" && Convert.ToDouble(env.temperature) > this.targetTemperature + (this.temperatureTolerance ?1:0))
                {
                    newMode = "cool";
                }

                if (this.mode != newMode)
                {
                    this.mode = newMode;
                    this.update_icon();
                }

                if (this.mode == "standby")
                {
                    return(null);
                }
                heat_capacity = env.heat_capacity();
                requiredPower = Math.Abs(Convert.ToDouble(env.temperature - this.targetTemperature)) * heat_capacity;
                requiredPower = Num13.MinInt(((int)(requiredPower)), ((int)(this.heatingPower)));

                if (requiredPower < 1)
                {
                    return(null);
                }
                deltaTemperature = requiredPower / heat_capacity;

                if (this.mode == "cool")
                {
                    deltaTemperature *= -1;
                }

                if (deltaTemperature != 0)
                {
                    env.temperature += deltaTemperature;
                    this.air_update_turf();
                }
                this.cell.use(requiredPower / this.efficiency);
            }
            else
            {
                this.on = GlobalVars.FALSE;
                this.update_icon();
            }
            return(null);
        }
        // Function from file: scanners.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            Ent_Static location             = null;
            GasMixture environment          = null;
            double     pressure             = 0;
            double     total_moles          = 0;
            ByTable    env_gases            = null;
            dynamic    o2_concentration     = null;
            dynamic    n2_concentration     = null;
            double     co2_concentration    = 0;
            double     plasma_concentration = 0;
            dynamic    id = null;
            dynamic    gas_concentration = null;

            this.add_fingerprint(user);

            if (Lang13.Bool(user.stat) || user.eye_blind != 0)
            {
                return(null);
            }
            location = user.loc;

            if (!(location is Tile))
            {
                return(null);
            }
            environment = location.return_air();
            pressure    = environment.return_pressure();
            total_moles = environment.total_moles();
            user.WriteMsg("<span class='info'><B>Results:</B></span>");

            if (Math.Abs(pressure - 101.32499694824219) < 10)
            {
                user.WriteMsg("<span class='info'>Pressure: " + Num13.Round(pressure, 0.1) + " kPa</span>");
            }
            else
            {
                user.WriteMsg("<span class='alert'>Pressure: " + Num13.Round(pressure, 0.1) + " kPa</span>");
            }

            if (total_moles != 0)
            {
                env_gases = environment.gases;
                GlobalVars.hardcoded_gases.Apply(Lang13.BindFunc(environment, "assert_gases"));
                o2_concentration     = env_gases["o2"][1] / total_moles;
                n2_concentration     = env_gases["n2"][1] / total_moles;
                co2_concentration    = Convert.ToDouble(env_gases["co2"][1] / total_moles);
                plasma_concentration = Convert.ToDouble(env_gases["plasma"][1] / total_moles);
                environment.garbage_collect();

                if (Math.Abs(Convert.ToDouble(n2_concentration - 0.79)) < 20)
                {
                    user.WriteMsg("<span class='info'>Nitrogen: " + Num13.Floor(Convert.ToDouble(n2_concentration * 100)) + " %</span>");
                }
                else
                {
                    user.WriteMsg("<span class='alert'>Nitrogen: " + Num13.Floor(Convert.ToDouble(n2_concentration * 100)) + " %</span>");
                }

                if (Math.Abs(Convert.ToDouble(o2_concentration - 0.01)) < 2)
                {
                    user.WriteMsg("<span class='info'>Oxygen: " + Num13.Floor(Convert.ToDouble(o2_concentration * 100)) + " %</span>");
                }
                else
                {
                    user.WriteMsg("<span class='alert'>Oxygen: " + Num13.Floor(Convert.ToDouble(o2_concentration * 100)) + " %</span>");
                }

                if (co2_concentration > 0.01)
                {
                    user.WriteMsg("<span class='alert'>CO2: " + Num13.Floor(co2_concentration * 100) + " %</span>");
                }
                else
                {
                    user.WriteMsg("<span class='info'>CO2: " + Num13.Floor(co2_concentration * 100) + " %</span>");
                }

                if (plasma_concentration > 0.01)
                {
                    user.WriteMsg("<span class='info'>Plasma: " + Num13.Floor(plasma_concentration * 100) + " %</span>");
                }

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


                    if (GlobalVars.hardcoded_gases.Contains(id))
                    {
                        continue;
                    }
                    gas_concentration = env_gases[id][1] / total_moles;
                    user.WriteMsg("<span class='alert'>" + env_gases[id][3][2] + ": " + Num13.Floor(Convert.ToDouble(gas_concentration * 100)) + " %</span>");
                }
                user.WriteMsg("<span class='info'>Temperature: " + Num13.Floor(Convert.ToDouble(environment.temperature - 273.41)) + " &deg;C</span>");
            }
            return(null);
        }
        // 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);
        }