Example #1
0
        // Function from file: singularity.dm
        public void toxmob(  )
        {
            int        toxrange     = 0;
            double     radiation    = 0;
            double     radiationmin = 0;
            Mob_Living M            = null;

            toxrange     = 10;
            radiation    = 15;
            radiationmin = 3;

            if ((this.energy ?? 0) > 200)
            {
                radiation   += Num13.Round(((this.energy ?? 0) - 150) / 10, 1);
                radiationmin = Num13.Round(radiation / 5, 1);
            }

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInView(this.loc, toxrange), typeof(Mob_Living)))
            {
                M = _a;

                M.rad_act(Rand13.Int(((int)(radiationmin)), ((int)(radiation))));
            }
            return;
        }
Example #2
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);
        }