Пример #1
0
        // Function from file: humans.dm
        public void streak(ByTable directions = null)
        {
            dynamic direction = null;
            int?    i         = null;
            Obj_Effect_Decal_Cleanable_Blood_Splatter b = null;
            Disease D  = null;
            dynamic ND = null;

            direction = Rand13.PickFromTable(directions);
            i         = null;
            i         = 0;

            while ((i ?? 0) < Convert.ToDouble(Rand13.PickWeighted(new object [] { 13107, 1, 39321, 2, 58981, 3, 65535, 4 })))
            {
                Task13.Sleep(3);

                if ((i ?? 0) > 0)
                {
                    b = new Obj_Effect_Decal_Cleanable_Blood_Splatter(this.loc);

                    foreach (dynamic _a in Lang13.Enumerate(this.viruses, typeof(Disease)))
                    {
                        D = _a;

                        ND = D.Copy(true);
                        b.viruses.Add(ND);
                        ND.holder = b;
                    }
                }
                Map13.StepTowards(this, Map13.GetStep(this, Convert.ToInt32(direction)), 0);

                if ((i ?? 0) > 0)
                {
                    break;
                }
                i++;
            }
            return;
        }
Пример #2
0
        // Function from file: other_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;

            Disease D = null;


            if (this.data is ByTable && (method == GlobalVars.INGEST || method == GlobalVars.INJECT))
            {
                foreach (dynamic _a in Lang13.Enumerate(M.viruses, typeof(Disease)))
                {
                    D = _a;


                    if (Lang13.Bool(this.data.Contains(D.GetDiseaseID())))
                    {
                        D.cure();
                    }
                }
                M.resistances.Or(this.data);
            }
            return(0);
        }
Пример #3
0
        // Function from file: tgstation.dme
        public override bool start(  )
        {
            Mob_Living_Carbon_Human H = null;
            dynamic T            = null;
            bool    foundAlready = false;
            Disease D            = null;
            dynamic D2           = null;
            dynamic DS           = null;


            if (!(this.virus_type != null))
            {
                this.virus_type = Rand13.Pick(new object [] { typeof(Disease_Dnaspread), typeof(Disease_Advance_Flu), typeof(Disease_Advance_Cold), typeof(Disease_Brainrot), typeof(Disease_Magnitis) });
            }

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.shuffle(GlobalVars.living_mob_list), typeof(Mob_Living_Carbon_Human)))
            {
                H = _b;

                T = GlobalFuncs.get_turf(H);

                if (!Lang13.Bool(T))
                {
                    continue;
                }

                if (Lang13.Bool(T.z) != true)
                {
                    continue;
                }
                foundAlready = false;

                foreach (dynamic _a in Lang13.Enumerate(H.viruses, typeof(Disease)))
                {
                    D = _a;

                    foundAlready = true;
                    break;
                }

                if (H.stat == 2 || foundAlready)
                {
                    continue;
                }
                D2 = null;

                if (this.virus_type == typeof(Disease_Dnaspread))
                {
                    if (!(H.dna != null) || Lang13.Bool(H.disabilities & 1))
                    {
                        continue;
                    }
                    D2 = Lang13.Call(this.virus_type);
                    DS = D2;
                    DS.strain_data["name"] = H.real_name;
                    DS.strain_data["UI"]   = H.dna.uni_identity;
                    DS.strain_data["SE"]   = H.dna.struc_enzymes;
                }
                else
                {
                    D2 = Lang13.Call(this.virus_type);
                }
                D2.carrier = true;
                H.AddDisease(D2);
                break;
            }
            return(false);
        }
        // Function from file: pandemic.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string        dat              = null;
            Reagents      R                = null;
            Reagent_Blood Blood            = null;
            Reagent_Blood B                = null;
            ByTable       vir              = null;
            int           i                = 0;
            Disease       D                = null;
            Disease       A                = null;
            Disease       A2               = null;
            ByTable       english_symptoms = null;
            Symptom       S                = null;
            ByTable       res              = null;
            int           i2               = 0;
            dynamic       type             = null;
            string        disease_name     = null;
            dynamic       A3               = null;
            dynamic       D2               = null;


            if (Lang13.Bool(base.attack_hand((object)(a), b, c)))
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "";

            if (Lang13.Bool(this.temp_html))
            {
                dat = new Txt().item(this.temp_html).str("<BR><BR><A href='?src=").Ref(this).str(";clear=1'>Main Menu</A>").ToString();
            }
            else if (!Lang13.Bool(this.beaker))
            {
                dat += "Please insert beaker.<BR>";
                dat += new Txt("<A href='?src=").Ref(a).str(";mach_close=pandemic'>Close</A>").ToString();
            }
            else
            {
                R     = this.beaker.reagents;
                Blood = null;

                foreach (dynamic _a in Lang13.Enumerate(R.reagent_list, typeof(Reagent_Blood)))
                {
                    B = _a;


                    if (B != null)
                    {
                        Blood = B;
                        break;
                    }
                }

                if (!Lang13.Bool(R.total_volume) || !(R.reagent_list.len != 0))
                {
                    dat += "The beaker is empty<BR>";
                }
                else if (!(Blood != null))
                {
                    dat += "No blood sample found in beaker.";
                }
                else if (!Lang13.Bool(Blood.data))
                {
                    dat += "No blood data found in beaker.";
                }
                else
                {
                    dat += "<h3>Blood sample data:</h3>";
                    dat += "<b>Blood DNA:</b> " + (Lang13.Bool(Blood.data["blood_DNA"]) || Lang13.Bool("none")) + "<BR>";
                    dat += "<b>Blood Type:</b> " + (Lang13.Bool(Blood.data["blood_type"]) || Lang13.Bool("none")) + "<BR>";

                    if (Lang13.Bool(Blood.data["viruses"]))
                    {
                        vir = Blood.data["viruses"];

                        if (vir.len != 0)
                        {
                            i = 0;

                            foreach (dynamic _c in Lang13.Enumerate(Blood.data["viruses"], typeof(Disease)))
                            {
                                D = _c;

                                i++;

                                if (!((D.visibility_flags & 2) != 0))
                                {
                                    if (D is Disease_Advance)
                                    {
                                        A = D;
                                        D = GlobalVars.archive_diseases[A.GetDiseaseID()];

                                        if (D != null && D.name == "Unknown")
                                        {
                                            dat += new Txt("<b><a href='?src=").Ref(this).str(";name_disease=").item(i).str("'>Name Disease</a></b><BR>").ToString();
                                        }
                                    }

                                    if (!(D != null))
                                    {
                                        Task13.Crash("We weren't able to get the advance disease from the archive.");
                                    }
                                    dat += "<b>Disease Agent:</b> " + (D != null ? new Txt().item(D.agent).str(" - <A href='?src=").Ref(this).str(";create_virus_culture=").item(i).str("'>Create virus culture bottle</A>").ToString() : "none") + "<BR>";
                                    dat += "<b>Common name:</b> " + (Lang13.Bool(D.name) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Description: </b> " + (Lang13.Bool(D.desc) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Spread:</b> " + (Lang13.Bool(D.spread_text) || Lang13.Bool("none")) + "<BR>";
                                    dat += "<b>Possible cure:</b> " + (Lang13.Bool(D.cure_text) || Lang13.Bool("none")) + "<BR><BR>";

                                    if (D is Disease_Advance)
                                    {
                                        A2   = D;
                                        dat += "<b>Symptoms:</b> ";
                                        english_symptoms = new ByTable();

                                        foreach (dynamic _b in Lang13.Enumerate(((dynamic)A2).symptoms, typeof(Symptom)))
                                        {
                                            S = _b;

                                            english_symptoms.Add(S.name);
                                        }
                                        dat += GlobalFuncs.english_list(english_symptoms);
                                    }
                                }
                                else
                                {
                                    dat += "No detectable virus in the sample.";
                                }
                            }
                        }
                    }
                    else
                    {
                        dat += "No detectable virus in the sample.";
                    }
                    dat += "<BR><b>Contains antibodies to:</b> ";

                    if (Lang13.Bool(Blood.data["resistances"]))
                    {
                        res = Blood.data["resistances"];

                        if (res.len != 0)
                        {
                            dat += "<ul>";
                            i2   = 0;

                            foreach (dynamic _d in Lang13.Enumerate(Blood.data["resistances"]))
                            {
                                type = _d;

                                i2++;
                                disease_name = "Unknown";

                                if (!(type is Type))
                                {
                                    A3 = GlobalVars.archive_diseases[type];

                                    if (Lang13.Bool(A3))
                                    {
                                        disease_name = A3.name;
                                    }
                                }
                                else
                                {
                                    D2           = Lang13.Call(type, 0, null);
                                    disease_name = D2.name;
                                }
                                dat += new Txt("<li>").item(disease_name).str(" - <A href='?src=").Ref(this).str(";create_vaccine=").item(i2).str("'>Create vaccine bottle</A></li>").ToString();
                            }
                            dat += "</ul><BR>";
                        }
                        else
                        {
                            dat += "nothing<BR>";
                        }
                    }
                    else
                    {
                        dat += "nothing<BR>";
                    }
                }
                dat += new Txt("<BR><A href='?src=").Ref(this).str(";eject=1'>Eject beaker</A>").item((Lang13.Bool(R.total_volume) && R.reagent_list.len != 0 ? new Txt("-- <A href='?src=").Ref(this).str(";empty_beaker=1'>Empty beaker</A>").ToString() : "")).str("<BR>").ToString();
                dat += new Txt("<A href='?src=").Ref(a).str(";mach_close=pandemic'>Close</A>").ToString();
            }
            Interface13.Browse(a, "<TITLE>" + this.name + "</TITLE><BR>" + dat, "window=pandemic;size=575x400");
            GlobalFuncs.onclose(a, "pandemic");
            return(null);
        }
Пример #5
0
        // Function from file: medbot.dm
        public bool assess_patient(dynamic C = null)
        {
            Reagent R = null;
            Disease D = null;


            if (Convert.ToInt32(C.stat) == 2)
            {
                return(false);
            }

            if (Lang13.Bool(C.suiciding))
            {
                return(false);
            }

            if (this.emagged == 2)
            {
                return(true);
            }

            if (this.declare_crit && Convert.ToDouble(C.health) <= 0)
            {
                this.declare(C);
            }

            if (Lang13.Bool(this.reagent_glass) && this.use_beaker && (((Mob_Living)C).getBruteLoss() >= this.heal_threshold || Convert.ToDouble(((Mob_Living)C).getToxLoss()) >= this.heal_threshold || Convert.ToDouble(((Mob_Living)C).getToxLoss()) >= this.heal_threshold || Convert.ToDouble(((Mob_Living)C).getOxyLoss()) >= this.heal_threshold + 15))
            {
                foreach (dynamic _a in Lang13.Enumerate(this.reagent_glass.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;


                    if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(R.id)))
                    {
                        return(true);
                    }
                }
            }

            if (((Mob_Living)C).getBruteLoss() >= this.heal_threshold && !Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_brute)))
            {
                return(true);
            }

            if (Convert.ToDouble(((Mob_Living)C).getOxyLoss()) >= this.heal_threshold + 15 && !Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_oxy)))
            {
                return(true);
            }

            if (((Mob_Living)C).getFireLoss() >= this.heal_threshold && !Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_fire)))
            {
                return(true);
            }

            if (Convert.ToDouble(((Mob_Living)C).getToxLoss()) >= this.heal_threshold && !Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_tox)))
            {
                return(true);
            }

            if (this.treat_virus)
            {
                foreach (dynamic _b in Lang13.Enumerate(C.viruses, typeof(Disease)))
                {
                    D = _b;


                    if ((D.visibility_flags & 1) != 0 || (D.visibility_flags & 2) != 0)
                    {
                        return(false);
                    }

                    if (D.severity == "No threat")
                    {
                        return(false);
                    }

                    if ((D.stage ?? 0) > 1 || (D.spread_flags & 64) != 0)
                    {
                        if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_virus)))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Пример #6
0
        // Function from file: medbot.dm
        public void medicate_patient(dynamic C = null)
        {
            string  death_message = null;
            string  reagent_id    = null;
            bool    virus         = false;
            Disease D             = null;
            Reagent R             = null;
            string  message       = null;
            double? fraction      = null;


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

            if (!(C is Mob_Living_Carbon))
            {
                this.oldpatient = this.patient;
                this.soft_reset();
                return;
            }

            if (Convert.ToInt32(C.stat) == 2)
            {
                death_message = Rand13.Pick(new object [] { "No! NO!", "Live, damnit! LIVE!", "I...I've never lost a patient before. Not today, I mean." });
                this.f_speak(death_message);
                this.oldpatient = this.patient;
                this.soft_reset();
                return;
            }
            reagent_id = null;

            if (this.emagged == 2)
            {
                reagent_id = "toxin";
            }
            else
            {
                if (this.treat_virus)
                {
                    virus = false;

                    foreach (dynamic _a in Lang13.Enumerate(C.viruses, typeof(Disease)))
                    {
                        D = _a;


                        if (!((D.visibility_flags & 1) != 0) || !((D.visibility_flags & 2) != 0))
                        {
                            if (D.severity != "No threat")
                            {
                                if ((D.stage ?? 0) > 1 || (D.spread_flags & 64) != 0)
                                {
                                    virus = true;
                                }
                            }
                        }
                    }

                    if (!Lang13.Bool(reagent_id) && virus)
                    {
                        if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_virus)))
                        {
                            reagent_id = this.treatment_virus;
                        }
                    }
                }

                if (!Lang13.Bool(reagent_id) && ((Mob_Living)C).getBruteLoss() >= this.heal_threshold)
                {
                    if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_brute)))
                    {
                        reagent_id = this.treatment_brute;
                    }
                }

                if (!Lang13.Bool(reagent_id) && Convert.ToDouble(((Mob_Living)C).getOxyLoss()) >= this.heal_threshold + 15)
                {
                    if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_oxy)))
                    {
                        reagent_id = this.treatment_oxy;
                    }
                }

                if (!Lang13.Bool(reagent_id) && ((Mob_Living)C).getFireLoss() >= this.heal_threshold)
                {
                    if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_fire)))
                    {
                        reagent_id = this.treatment_fire;
                    }
                }

                if (!Lang13.Bool(reagent_id) && Convert.ToDouble(((Mob_Living)C).getToxLoss()) >= this.heal_threshold)
                {
                    if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(this.treatment_tox)))
                    {
                        reagent_id = this.treatment_tox;
                    }
                }

                if (Lang13.Bool(reagent_id) && this.use_beaker && Lang13.Bool(this.reagent_glass) && Lang13.Bool(this.reagent_glass.reagents.total_volume))
                {
                    foreach (dynamic _b in Lang13.Enumerate(this.reagent_glass.reagents.reagent_list, typeof(Reagent)))
                    {
                        R = _b;


                        if (!Lang13.Bool(((Reagents)C.reagents).has_reagent(R.id)))
                        {
                            reagent_id = "internal_beaker";
                            break;
                        }
                    }
                }
            }

            if (!Lang13.Bool(reagent_id))
            {
                message = Rand13.Pick(new object [] { "All patched up!", "An apple a day keeps me away.", "Feel better soon!" });
                this.f_speak(message);
                this.bot_reset();
                return;
            }
            else
            {
                if (!(this.emagged != 0) && this.check_overdose(this.patient, reagent_id, this.injection_amount))
                {
                    this.soft_reset();
                    return;
                }
                ((Ent_Static)C).visible_message("<span class='danger'>" + this + " is trying to inject " + this.patient + "!</span>", "<span class='userdanger'>" + this + " is trying to inject you!</span>");
                Task13.Schedule(30, (Task13.Closure)(() => {
                    if (Map13.GetDistance(this, this.patient) <= 1 && Lang13.Bool(this.on) && this.assess_patient(this.patient))
                    {
                        if (reagent_id == "internal_beaker")
                        {
                            if (this.use_beaker && Lang13.Bool(this.reagent_glass) && Lang13.Bool(this.reagent_glass.reagents.total_volume))
                            {
                                fraction = Num13.MinInt(((int)((this.injection_amount ?? 0) / (this.reagent_glass.reagents.total_volume ?? 0))), 1);
                                ((Reagents)this.reagent_glass.reagents).reaction(this.patient, GlobalVars.INJECT, fraction);
                                ((Reagents)this.reagent_glass.reagents).trans_to(this.patient, this.injection_amount);
                            }
                        }
                        else
                        {
                            this.patient.reagents.add_reagent(reagent_id, this.injection_amount);
                        }
                        ((Ent_Static)C).visible_message("<span class='danger'>" + this + " injects " + this.patient + " with its syringe!</span>", "<span class='userdanger'>" + this + " injects you with its syringe!</span>");
                    }
                    else
                    {
                        this.visible_message("" + this + " retracts its syringe.");
                    }
                    this.update_icon();
                    this.soft_reset();
                    return;

                    return;
                }));
            }
            reagent_id = null;
            return;
        }
Пример #7
0
        // Function from file: other_reagents.dm
        public override void reaction_turf(dynamic T = null, double?volume = null)
        {
            dynamic blood_prop  = null;
            Disease D           = null;
            dynamic newVirus    = null;
            dynamic blood_prop2 = null;
            Disease D2          = null;
            dynamic newVirus2   = null;
            dynamic blood_prop3 = null;
            Disease D3          = null;
            dynamic newVirus3   = null;


            if (!(T is Tile_Simulated))
            {
                return;
            }

            if ((volume ?? 0) < 3)
            {
                return;
            }

            if (!Lang13.Bool(this.data["donor"]) || this.data["donor"] is Mob_Living_Carbon_Human)
            {
                blood_prop = Lang13.FindIn(typeof(Obj_Effect_Decal_Cleanable_Blood), T);

                if (!Lang13.Bool(blood_prop))
                {
                    blood_prop = new Obj_Effect_Decal_Cleanable_Blood(T);
                    blood_prop.blood_DNA[this.data["blood_DNA"]] = this.data["blood_type"];
                }

                foreach (dynamic _a in Lang13.Enumerate(this.data["viruses"], typeof(Disease)))
                {
                    D = _a;

                    newVirus            = D.Copy(true);
                    blood_prop.viruses += newVirus;
                    newVirus.holder     = blood_prop;
                }
            }
            else if (this.data["donor"] is Mob_Living_Carbon_Monkey)
            {
                blood_prop2 = Lang13.FindIn(typeof(Obj_Effect_Decal_Cleanable_Blood), T);

                if (!Lang13.Bool(blood_prop2))
                {
                    blood_prop2 = new Obj_Effect_Decal_Cleanable_Blood(T);
                    blood_prop2.blood_DNA["Non-Human DNA"] = "A+";
                }

                foreach (dynamic _b in Lang13.Enumerate(this.data["viruses"], typeof(Disease)))
                {
                    D2 = _b;

                    newVirus2            = D2.Copy(true);
                    blood_prop2.viruses += newVirus2;
                    newVirus2.holder     = blood_prop2;
                }
            }
            else if (this.data["donor"] is Mob_Living_Carbon_Alien)
            {
                blood_prop3 = Lang13.FindIn(typeof(Obj_Effect_Decal_Cleanable_Xenoblood), T);

                if (!Lang13.Bool(blood_prop3))
                {
                    blood_prop3 = new Obj_Effect_Decal_Cleanable_Xenoblood(T);
                    blood_prop3.blood_DNA["UNKNOWN DNA STRUCTURE"] = "X*";
                }

                foreach (dynamic _c in Lang13.Enumerate(this.data["viruses"], typeof(Disease)))
                {
                    D3 = _c;

                    newVirus3            = D3.Copy(true);
                    blood_prop3.viruses += newVirus3;
                    newVirus3.holder     = blood_prop3;
                }
            }
            return;
        }
Пример #8
0
        // Function from file: gibs.dm
        public void Gib(Ent_Static location = null, ByTable viruses = null, Dna MobDNA = null)
        {
            viruses = viruses ?? new ByTable();

            dynamic gib = null;
            EffectSystem_SparkSpread s = null;
            int?       i          = null;
            int?       j          = null;
            dynamic    gibType    = null;
            Ent_Static digester   = null;
            Disease    D          = null;
            dynamic    viruus     = null;
            ByTable    directions = null;


            if (this.gibtypes.len != this.gibamounts.len || this.gibamounts.len != this.gibdirections.len)
            {
                Game13.WriteMsg("<span class='danger'>Gib list length mismatch!</span>");
                return;
            }
            gib = null;

            if (this.sparks)
            {
                s = new EffectSystem_SparkSpread();
                s.set_up(2, 1, location);
                s.start();
            }
            i = null;
            i = 1;

            while ((i ?? 0) <= this.gibtypes.len)
            {
                if (Lang13.Bool(this.gibamounts[i]))
                {
                    j = null;
                    j = 1;

                    while ((j ?? 0) <= Convert.ToDouble(this.gibamounts[i]))
                    {
                        gibType = this.gibtypes[i];
                        gib     = Lang13.Call(gibType, location);

                        if (location is Mob_Living_Carbon)
                        {
                            digester = location;
                            ((dynamic)digester).stomach_contents += gib;
                        }

                        if (viruses.len > 0)
                        {
                            foreach (dynamic _a in Lang13.Enumerate(viruses, typeof(Disease)))
                            {
                                D = _a;


                                if (Rand13.PercentChance(this.virusProb))
                                {
                                    viruus        = D.Copy(true);
                                    gib.viruses  += viruus;
                                    viruus.holder = gib;
                                }
                            }
                        }

                        if (MobDNA != null)
                        {
                            gib.blood_DNA[MobDNA.unique_enzymes] = MobDNA.blood_type;
                        }
                        else if (this is Obj_Effect_Gibspawner_Generic)
                        {
                            gib.blood_DNA["Non-human DNA"] = "A+";
                        }
                        directions = this.gibdirections[i];

                        if (this.loc is Tile)
                        {
                            if (directions.len != 0)
                            {
                                gib.streak(directions);
                            }
                        }
                        j++;
                    }
                }
                i++;
            }
            GlobalFuncs.qdel(this);
            return;
        }