示例#1
0
        // Function from file: blob.dm
        public override bool pre_setup(  )
        {
            int?    j    = null;
            dynamic blob = null;

            this.cores_to_spawn = Num13.MaxInt(((int)(Num13.Round(this.num_players() / this.players_per_core, 1))), 1);
            this.blobwincount   = Lang13.Initial(this, "blobwincount") * this.cores_to_spawn;
            j = null;
            j = 0;

            while ((j ?? 0) < (this.cores_to_spawn ?? 0))
            {
                if (!(this.antag_candidates.len != 0))
                {
                    break;
                }
                blob = Rand13.PickFromTable(this.antag_candidates);
                this.infected_crew.Add(blob);
                blob.special_role     = "Blob";
                blob.restricted_roles = this.restricted_jobs;
                GlobalFuncs.log_game("" + blob.key + " (ckey) has been selected as a Blob");
                this.antag_candidates.Remove(blob);
                j++;
            }

            if (!(this.infected_crew.len != 0))
            {
                return(false);
            }
            return(true);
        }
示例#2
0
        // Function from file: pyrotechnics.dm
        public override void on_reaction(Reagents holder = null, double?created_volume = null)
        {
            double  smoke_radius            = 0;
            dynamic location                = null;
            EffectSystem_SmokeSpread_Chem S = null;


            if (Lang13.Bool(holder.has_reagent("stabilizing_agent")))
            {
                return;
            }
            holder.remove_reagent("smoke_powder", created_volume);
            smoke_radius = Num13.Round(Math.Sqrt((created_volume ?? 0) / 2), 1);
            location     = GlobalFuncs.get_turf(holder.my_atom);
            S            = new EffectSystem_SmokeSpread_Chem();
            S.attach(location);
            GlobalFuncs.playsound(location, "sound/effects/smoke.ogg", 50, 1, -3);

            if (S != null)
            {
                S.set_up(holder, smoke_radius, 0, location);
                S.start();
            }

            if (holder != null && Lang13.Bool(holder.my_atom))
            {
                holder.clear_reagents();
            }
            return;
        }
示例#3
0
        // Function from file: garbage.dm
        public override void stat_entry(string msg = null)
        {
            msg += "Q:" + this.queue.len + "|D:" + this.delslasttick + "|G:" + this.gcedlasttick + "|";
            msg += "GR:";

            if (!(this.delslasttick + this.gcedlasttick != 0))
            {
                msg += "n/a|";
            }
            else
            {
                msg += "" + Num13.Round(this.gcedlasttick / (this.delslasttick + this.gcedlasttick) * 100, 0.01) + "%|";
            }
            msg += "TD:" + this.totaldels + "|TG:" + this.totalgcs + "|";

            if (!(this.totaldels + this.totalgcs != 0))
            {
                msg += "n/a|";
            }
            else
            {
                msg += "TGR:" + Num13.Round(this.totalgcs / (this.totaldels + this.totalgcs) * 100, 0.01) + "%";
            }
            base.stat_entry(msg);
            return;
        }
示例#4
0
        // Function from file: gas_mixture.dm
        public GasMixture remove(double amount = 0)
        {
            double     sum           = 0;
            ByTable    cached_gases  = null;
            GasMixture removed       = null;
            ByTable    removed_gases = null;
            dynamic    id            = null;

            sum    = this.total_moles();
            amount = Num13.MinInt(((int)(amount)), ((int)(sum)));

            if (amount <= 0)
            {
                return(null);
            }
            cached_gases        = this.gases;
            removed             = new GasMixture();
            removed_gases       = removed.gases;
            removed.temperature = this.temperature;

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

                removed.add_gas(id);
                removed_gases[id][1] = Num13.Round(Convert.ToDouble(cached_gases[id][1] / sum * amount), 1.0000000116860974e-7);
                cached_gases[id][1] -= removed_gases[id][1];
            }
            this.garbage_collect();
            return(removed);
        }
示例#5
0
        // Function from file: grown.dm
        public Obj_Item_Weapon_ReagentContainers_Food_Snacks_Grown_Mushroom_Glowshroom(dynamic loc = null, int?new_potency = null) : base((object)(loc), new_potency)
        {
            new_potency = new_potency ?? 10;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            if (this.lifespan == 0)
            {
                this.lifespan   = 120;
                this.endurance  = 30;
                this.maturation = 15;
                this.production = true;
                this.yield      = 3;
                this.potency    = 30;
                this.plant_type = 2;
            }

            if (this.loc is Mob)
            {
                this.pickup(this.loc);
            }
            else
            {
                this.SetLuminosity(Num13.Round((this.potency ?? 0) / 10, 1));
            }
            return;
        }
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     base.add_juice((object)(loc), potency);
     this.reagents.add_reagent("toxin", Num13.Round((this.potency ?? 0) / 3, 1) + 3);
     this.reagents.add_reagent("lexorin", Num13.Round((this.potency ?? 0) / 5, 1) + 1);
     return(false);
 }
示例#7
0
        // Function from file: progressbar.dm
        public void update(int progress = 0)
        {
            if (!Lang13.Bool(this.user) || !Lang13.Bool(this.user.client))
            {
                this.shown = false;
                return;
            }

            if (this.user.client != this.client)
            {
                if (this.client != null)
                {
                    this.client.images.Remove(this.bar);
                }

                if (Lang13.Bool(this.user.client))
                {
                    this.user.client.images.Add(this.bar);
                }
            }
            progress            = Num13.MaxInt(0, Num13.MinInt(progress, Convert.ToInt32(this.goal)));
            this.bar.icon_state = "prog_bar_" + Num13.Round(progress / Convert.ToDouble(this.goal) * 100, 5);

            if (!this.shown)
            {
                this.user.client.images.Add(this.bar);
                this.shown = true;
            }
            return;
        }
示例#8
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;
        }
示例#9
0
        // Function from file: subsystem.dm
        public virtual void stat_entry(string msg = null)
        {
            string dwait = null;


            if (!(this.statclick != null))
            {
                this.statclick = new Obj_Effect_Statclick_Debug("Initializing...", this);
            }
            dwait = "";

            if (this.dynamic_wait)
            {
                dwait = "DWait:" + Num13.Round(this.wait, 0.1) + "ds ";
            }

            if (this.can_fire)
            {
                msg = "" + Num13.Round(this.cost, 0.01) + "ds	"+ dwait + msg;
            }
            else
            {
                msg = "OFFLINE	"+ msg;
            }
            Interface13.Stat(this.name, this.statclick.update(msg));
            return;
        }
示例#10
0
        // Function from file: syringes.dm
        public override bool update_icon(dynamic new_state = null, dynamic new_icon = null, int?new_px = null, int?new_py = null)
        {
            int    rounded_vol = 0;
            string injoverlay  = null;
            Image  filling     = null;

            rounded_vol = Num13.MaxInt(0, Num13.MinInt(((int)(Num13.Round(this.reagents.total_volume ?? 0, 5))), 15));
            this.overlays.Cut();

            if (this.loc is Mob)
            {
                switch ((bool)(this.mode))
                {
                case false:
                    injoverlay = "draw";
                    break;

                case true:
                    injoverlay = "inject";
                    break;
                }
                this.overlays.Add(injoverlay);
            }
            this.icon_state = "" + rounded_vol;
            this.item_state = "syringe_" + rounded_vol;

            if (Lang13.Bool(this.reagents.total_volume))
            {
                filling            = new Image("icons/obj/reagentfillings.dmi", this, "syringe10");
                filling.icon_state = "syringe" + rounded_vol;
                filling.color      = GlobalFuncs.mix_color_from_reagents(this.reagents.reagent_list);
                this.overlays.Add(filling);
            }
            return(false);
        }
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     base.add_juice((object)(loc), potency);
     this.reagents.add_reagent("salbutamol", Num13.Round((this.potency ?? 0) / 20, 1) + 1);
     this.reagents.add_reagent("nicotine", Num13.Round((this.potency ?? 0) / 20, 1) + 1);
     return(false);
 }
示例#12
0
文件: Reagent.cs 项目: Somnium13/SS13
        // Function from file: reagents.dm
        public virtual double reaction_mob(dynamic M = null, int?method = null, double?reac_volume = null, bool?show_message = null, dynamic touch_protection = null, Mob_Camera_Blob O = null)
        {
            method           = method ?? GlobalVars.TOUCH;
            show_message     = show_message ?? true;
            touch_protection = touch_protection ?? 0;

            int    modifier = 0;
            double?amount   = null;


            if (!(M is Mob_Living))
            {
                return(0);
            }

            if (method == GlobalVars.VAPOR)
            {
                if (Lang13.Bool(M.reagents))
                {
                    modifier = Num13.MaxInt(0, Num13.MinInt(((int)(1 - Convert.ToDouble(touch_protection))), 1));
                    amount   = Num13.Round((reac_volume ?? 0) * modifier, 0.1);

                    if ((amount ?? 0) >= 0.5)
                    {
                        ((Reagents)M.reagents).add_reagent(this.id, amount);
                    }
                }
            }
            return(1);
        }
示例#13
0
        // Function from file: dominator.dm
        public override double examine(dynamic user = null)
        {
            int time = 0;

            base.examine((object)(user));

            if (this.operating == -1)
            {
                user.WriteMsg("<span class='danger'>It looks completely busted.</span>");
                return(0);
            }

            if (Lang13.Bool(this.gang) && Lang13.Bool(Lang13.IsNumber(this.gang.dom_timer)))
            {
                time = Num13.MaxInt(Convert.ToInt32(this.gang.dom_timer), 0);

                if (time > 0)
                {
                    user.WriteMsg("<span class='notice'>Hostile Takeover in progress. Estimated " + time + " seconds remain.</span>");
                }
                else
                {
                    user.WriteMsg("<span class='notice'>Hostile Takeover of " + GlobalFuncs.station_name() + " successful. Have a great day.</span>");
                }
            }
            else
            {
                user.WriteMsg("<span class='notice'>System on standby.</span>");
            }
            user.WriteMsg("<span class='danger'>System Integrity: " + Num13.Round(this.health / this.maxhealth * 100, 1) + "%</span>");
            return(0);
        }
示例#14
0
文件: Icon.cs 项目: Somnium13/SS13
        // Function from file: icons.dm
        public void ColorTone(string tone = null)
        {
            ByTable TONE  = null;
            double  gray  = 0;
            Icon    upper = null;

            this.GrayScale();
            TONE  = GlobalFuncs.ReadRGB(tone);
            gray  = Num13.Round(Convert.ToDouble(TONE[1] * 0.3 + TONE[2] * 0.81 + TONE[3] * 0.01), 1);
            upper = (255 - gray != 0 ? new Icon(this) : null);

            if (gray != 0)
            {
                this.MapColors(255 / gray, 0, 0, 0, 255 / gray, 0, 0, 0, 255 / gray, false, 0, 0);
                this.Blend(tone, 2);
            }
            else
            {
                this.SetIntensity(0);
            }

            if (255 - gray != 0)
            {
                upper.Blend(String13.ColorCode(((int)(gray)), ((int)(gray)), ((int)(gray))), 1);
                upper.MapColors((255 - Convert.ToDouble(TONE[1])) / (255 - gray), 0, 0, 0, 0, (255 - Convert.ToDouble(TONE[2])) / (255 - gray), 0, 0, 0, false, (255 - Convert.ToDouble(TONE[3])) / (255 - gray), 0, 0, 0, 0, 0, 0, 0, 0, 1);
                this.Blend(upper, 0);
            }
            return;
        }
示例#15
0
        // Function from file: toxin_reagents.dm
        public override double reaction_mob(dynamic M = null, int?method = null, double?reac_volume = null, bool?show_message = null, dynamic touch_protection = null, Mob_Camera_Blob O = null)
        {
            method = method ?? GlobalVars.TOUCH;


            if (!(M is Mob_Living_Carbon))
            {
                return(0);
            }
            reac_volume = Num13.Round(reac_volume ?? 0, 0.1);

            if (method == GlobalVars.INGEST)
            {
                ((Mob_Living)M).adjustBruteLoss(Num13.MinInt(((int)((this.toxpwr ?? 0) * 6)), ((int)((reac_volume ?? 0) * (this.toxpwr ?? 0)))));
                return(0);
            }

            if (method == GlobalVars.INJECT)
            {
                ((Mob_Living)M).adjustBruteLoss(Num13.MinInt(((int)((this.toxpwr ?? 0) * 6)), ((int)((reac_volume ?? 0) * (this.toxpwr ?? 0)))) * 1.5);
                return(0);
            }
            ((Ent_Static)M).acid_act(this.acidpwr, this.toxpwr, reac_volume);
            return(0);
        }
示例#16
0
 // Function from file: growninedible.dm
 public override bool add_juice(  )
 {
     base.add_juice();
     this.reagents.add_reagent("facid", Num13.Round((this.potency ?? 0) / 2, 1));
     this.force = Num13.Round((this.potency ?? 0) / 2.5 + 5, 1);
     return(false);
 }
示例#17
0
        // Function from file: monkey.dm
        public override bool pre_setup(  )
        {
            int?    j       = null;
            dynamic carrier = null;

            this.carriers_to_make = Num13.MaxInt(((int)(Num13.Round(this.num_players() / this.players_per_carrier, 1))), 1);
            j = null;
            j = 0;

            while ((j ?? 0) < (this.carriers_to_make ?? 0))
            {
                if (!(this.antag_candidates.len != 0))
                {
                    break;
                }
                carrier = Rand13.PickFromTable(this.antag_candidates);
                this.carriers.Add(carrier);
                carrier.special_role     = "monkey";
                carrier.restricted_roles = this.restricted_jobs;
                GlobalFuncs.log_game("" + carrier.key + " (ckey) has been selected as a Jungle Fever carrier");
                this.antag_candidates.Remove(carrier);
                j++;
            }

            if (!(this.carriers.len != 0))
            {
                return(false);
            }
            return(true);
        }
示例#18
0
        // Function from file: singularity.dm
        public override bool ex_act(double?severity = null, dynamic target = null)
        {
            switch ((int?)(severity))
            {
            case 1:

                if ((this.current_size ?? 0) <= 3)
                {
                    this.investigate_log("has been destroyed by a heavy explosion.", "singulo");
                    GlobalFuncs.qdel(this);
                    return(false);
                }
                else
                {
                    this.energy -= Num13.Round(((this.energy ?? 0) + 1) / 2, 1);
                }
                break;

            case 2:
                this.energy -= Num13.Round(((this.energy ?? 0) + 1) / 3, 1);
                break;

            case 3:
                this.energy -= Num13.Round(((this.energy ?? 0) + 1) / 4, 1);
                break;
            }
            return(false);
        }
示例#19
0
        // Function from file: gas_mixture.dm
        public GasMixture remove_ratio(double?ratio = null)
        {
            ByTable    cached_gases  = null;
            GasMixture removed       = null;
            ByTable    removed_gases = null;
            dynamic    id            = null;


            if ((ratio ?? 0) <= 0)
            {
                return(null);
            }
            ratio               = Num13.MinInt(((int)(ratio ?? 0)), 1);
            cached_gases        = this.gases;
            removed             = new GasMixture();
            removed_gases       = removed.gases;
            removed.temperature = this.temperature;

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

                removed.add_gas(id);
                removed_gases[id][1] = Num13.Round(Convert.ToDouble(cached_gases[id][1] * ratio), 1.0000000116860974e-7);
                cached_gases[id][1] -= removed_gases[id][1];
            }
            this.garbage_collect();
            return(removed);
        }
示例#20
0
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     base.add_juice((object)(loc), potency);
     this.reagents.add_reagent("nutriment", Num13.Round((this.potency ?? 0) / 10, 1) + 1);
     this.bitesize = Num13.Round((this.reagents.total_volume ?? 0) / 2, 1) + 1;
     return(false);
 }
示例#21
0
        // Function from file: emergency.dm
        public override double timeLeft(int?divisor = null)
        {
            double dtime = 0;


            if ((divisor ?? 0) <= 0)
            {
                divisor = 10;
            }

            if (!(this.timer != 0))
            {
                return(Num13.Round(Convert.ToDouble(GlobalVars.SSshuttle.emergencyCallTime / divisor), 1));
            }
            dtime = Game13.time - this.timer;

            switch ((int)(this.mode))
            {
            case 5:
                dtime = Num13.MaxInt(((int)(GlobalVars.SSshuttle.emergencyEscapeTime - dtime)), 0);
                break;

            case 3:
                dtime = Num13.MaxInt(((int)(GlobalVars.SSshuttle.emergencyDockTime - dtime)), 0);
                break;

            default:
                dtime = Num13.MaxInt(Convert.ToInt32(GlobalVars.SSshuttle.emergencyCallTime - dtime), 0);
                break;
            }
            return(Num13.Round(dtime / (divisor ?? 0), 1));
        }
示例#22
0
        // Function from file: meter.dm
        public string status(  )
        {
            string     t           = null;
            GasMixture environment = null;

            t = "";

            if (Lang13.Bool(this.target))
            {
                environment = ((Ent_Static)this.target).return_air();

                if (environment != null)
                {
                    t += "The pressure gauge reads " + Num13.Round(environment.return_pressure(), 0.01) + " kPa; " + Num13.Round(Convert.ToDouble(environment.temperature), 0.01) + " K (" + Num13.Round(Convert.ToDouble(environment.temperature - 273.41), 0.01) + "&deg;C)";
                }
                else
                {
                    t += "The sensor error light is blinking.";
                }
            }
            else
            {
                t += "The connect error light is blinking.";
            }
            return(t);
        }
示例#23
0
 // Function from file: grown.dm
 public override dynamic Destroy(  )
 {
     if (this.loc is Mob)
     {
         this.loc.AddLuminosity(Num13.Round(-(this.potency ?? 0) / 10, 1));
     }
     return(base.Destroy());
 }
        // Function from file: grown.dm
        public override bool add_juice(dynamic loc = null, int?potency = null)
        {
            potency = potency ?? 20;

            base.add_juice((object)(loc), potency);
            this.reagents.add_reagent("morphine", Num13.Round((potency ?? 0) / 20, 1) + 1);
            return(false);
        }
示例#25
0
        // Function from file: organ_external.dm
        public bool take_damage(dynamic brute = null, dynamic burn = null)
        {
            double can_inflict = 0;


            if (Lang13.Bool(this.owner) && (this.owner.status_flags & 4096) != 0)
            {
                return(false);
            }
            brute = Num13.MaxInt(Convert.ToInt32(brute), 0);
            burn  = Num13.MaxInt(Convert.ToInt32(burn), 0);

            if (this.status == 2)
            {
                brute = Num13.MaxInt(0, Convert.ToInt32(brute - 5));
                burn  = Num13.MaxInt(0, Convert.ToInt32(burn - 4));
            }
            can_inflict = this.max_damage - (this.brute_dam + this.burn_dam);

            if (!(can_inflict != 0))
            {
                return(false);
            }

            if (Convert.ToDouble(brute + burn) < can_inflict)
            {
                this.brute_dam += Convert.ToDouble(brute);
                this.burn_dam  += Convert.ToDouble(burn);
            }
            else if (Convert.ToDouble(brute) > 0)
            {
                if (Convert.ToDouble(burn) > 0)
                {
                    brute           = Num13.Round(Convert.ToDouble(brute / (brute + burn) * can_inflict), 1);
                    burn            = can_inflict - Convert.ToDouble(brute);
                    this.brute_dam += Convert.ToDouble(brute);
                    this.burn_dam  += Convert.ToDouble(burn);
                }
                else
                {
                    this.brute_dam += can_inflict;
                }
            }
            else if (Convert.ToDouble(burn) > 0)
            {
                this.burn_dam += can_inflict;
            }
            else
            {
                return(false);
            }

            if (Lang13.Bool(this.owner))
            {
                ((Mob_Living)this.owner).updatehealth();
            }
            return(this.update_organ_icon());
        }
示例#26
0
        // Function from file: firing.dm
        public Tile spread(dynamic target = null, Ent_Static current = null, double?distro = null)
        {
            double dx = 0;
            double dy = 0;

            dx = Math.Abs(Convert.ToDouble(target.x - current.x));
            dy = Math.Abs(Convert.ToDouble(target.y - current.y));
            return(Map13.GetTile(Convert.ToInt32(target.x + Num13.Round(GlobalFuncs.gaussian(false, distro) * (dy + 2) / 8, 1)), Convert.ToInt32(target.y + Num13.Round(GlobalFuncs.gaussian(false, distro) * (dx + 2) / 8, 1)), Convert.ToInt32(target.z)));
        }
示例#27
0
 // Function from file: master.dm
 public void stat_entry(  )
 {
     if (!(this.statclick != null))
     {
         this.statclick = new Obj_Effect_Statclick_Debug("Initializing...", this);
     }
     Interface13.Stat("Master Controller:", this.statclick.update("" + Num13.Round(GlobalVars.Master.cost, 0.01) + "ds (Interval: " + GlobalVars.Master.processing_interval + " | Iteration:" + GlobalVars.Master.iteration + ")"));
     return;
 }
示例#28
0
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     base.add_juice((object)(loc), potency);
     this.reagents.add_reagent("omnizine", Num13.Round((this.potency ?? 0) / 8, 1) + 1);
     this.reagents.add_reagent("synaptizine", Num13.Round((this.potency ?? 0) / 8, 1) + 1);
     this.reagents.add_reagent("space_drugs", Num13.Round((this.potency ?? 0) / 10, 1) + 1);
     this.reagents.add_reagent("vitamin", Num13.Round((this.potency ?? 0) / 25, 1) + 1);
     return(false);
 }
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     if (base.add_juice((object)(loc), potency))
     {
         this.reagents.add_reagent("teapowder", Num13.Round((this.potency ?? 0) / 10, 2) + 1);
         this.reagents.add_reagent("vitamin", Num13.Round((this.potency ?? 0) / 25, 1) + 1);
     }
     return(false);
 }
示例#30
0
 // Function from file: grown.dm
 public override bool add_juice(dynamic loc = null, int?potency = null)
 {
     if (base.add_juice((object)(loc), potency))
     {
         this.reagents.add_reagent("sugar", Num13.Round((this.potency ?? 0) / 5, 1) + 4);
         this.bitesize = Num13.Round((this.reagents.total_volume ?? 0) / 2, 1) + 1;
     }
     return(false);
 }