// Function from file: bottle.dm
        public override bool throw_impact(dynamic target = null, Mob_Living_Carbon thrower = null)
        {
            bool    firestarter = false;
            Reagent R           = null;
            dynamic A           = null;

            firestarter = false;

            foreach (dynamic _b in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
            {
                R = _b;


                foreach (dynamic _a in Lang13.Enumerate(this.accelerants))
                {
                    A = _a;


                    if (Lang13.Bool(A.IsInstanceOfType(R)))
                    {
                        firestarter = true;
                        break;
                    }
                }
            }
            this.SplashReagents(target);

            if (firestarter && this.active)
            {
                ((Ent_Static)target).fire_act();
                new Obj_Effect_Hotspot(GlobalFuncs.get_turf(target));
            }
            base.throw_impact((object)(target), thrower);
            return(false);
        }
示例#2
0
        // Function from file: icecream_vat.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            dynamic dat   = null;
            Reagent R     = null;
            Browser popup = null;

            dat += "<b>ICE CREAM</b><br><div class='statusDisplay'>";
            dat += "<b>Dispensing: " + this.flavour_name + " icecream </b> <br><br>";
            dat += new Txt("<b>Vanilla ice cream:</b> <a href='?src=").Ref(this).str(";select=").item(1).str("'><b>Select</b></a> <a href='?src=").Ref(this).str(";make=").item(1).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(1).str(";amount=5'><b>x5</b></a> ").item(this.product_types[1]).str(" scoops left. (Ingredients: milk, ice)<br>").ToString();
            dat += new Txt("<b>Strawberry ice cream:</b> <a href='?src=").Ref(this).str(";select=").item(3).str("'><b>Select</b></a> <a href='?src=").Ref(this).str(";make=").item(3).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(3).str(";amount=5'><b>x5</b></a> ").item(this.product_types[3]).str(" dollops left. (Ingredients: milk, ice, berry juice)<br>").ToString();
            dat += new Txt("<b>Chocolate ice cream:</b> <a href='?src=").Ref(this).str(";select=").item(2).str("'><b>Select</b></a> <a href='?src=").Ref(this).str(";make=").item(2).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(2).str(";amount=5'><b>x5</b></a> ").item(this.product_types[2]).str(" dollops left. (Ingredients: milk, ice, coco powder)<br>").ToString();
            dat += new Txt("<b>Blue ice cream:</b> <a href='?src=").Ref(this).str(";select=").item(4).str("'><b>Select</b></a> <a href='?src=").Ref(this).str(";make=").item(4).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(4).str(";amount=5'><b>x5</b></a> ").item(this.product_types[4]).str(" dollops left. (Ingredients: milk, ice, singulo)<br></div>").ToString();
            dat += "<br><b>CONES</b><br><div class='statusDisplay'>";
            dat += new Txt("<b>Waffle cones:</b> <a href='?src=").Ref(this).str(";cone=").item(5).str("'><b>Dispense</b></a> <a href='?src=").Ref(this).str(";make=").item(5).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(5).str(";amount=5'><b>x5</b></a> ").item(this.product_types[5]).str(" cones left. (Ingredients: flour, sugar)<br>").ToString();
            dat += new Txt("<b>Chocolate cones:</b> <a href='?src=").Ref(this).str(";cone=").item(6).str("'><b>Dispense</b></a> <a href='?src=").Ref(this).str(";make=").item(6).str(";amount=1'><b>Make</b></a> <a href='?src=").Ref(this).str(";make=").item(6).str(";amount=5'><b>x5</b></a> ").item(this.product_types[6]).str(" cones left. (Ingredients: flour, sugar, coco powder)<br></div>").ToString();
            dat += "<br>";
            dat += "<b>VAT CONTENT</b><br>";

            foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;

                dat += "" + R.name + ": " + R.volume;
                dat += new Txt("<A href='?src=").Ref(this).str(";disposeI=").item(R.id).str("'>Purge</A><BR>").ToString();
            }
            dat  += new Txt("<a href='?src=").Ref(this).str(";refresh=1'>Refresh</a> <a href='?src=").Ref(this).str(";close=1'>Close</a>").ToString();
            popup = new Browser(user, "icecreamvat", "Icecream Vat", 700, 500, this);
            popup.set_content(dat);
            popup.open();
            return(null);
        }
示例#3
0
        // Function from file: medicine_reagents.dm
        public override bool on_mob_life(dynamic M = null)
        {
            Reagent R = null;


            if (M.radiation > 0)
            {
                M.radiation -= 4;
            }
            ((Mob_Living)M).adjustToxLoss(-2);

            if (M.radiation < 0)
            {
                M.radiation = 0;
            }

            foreach (dynamic _a in Lang13.Enumerate(M.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;


                if (R != this)
                {
                    ((Reagents)M.reagents).remove_reagent(R.id, 2);
                }
            }
            base.on_mob_life((object)(M));
            return(false);
        }
        // Function from file: chem_heater.dm
        public override ByTable ui_data(dynamic user = null)
        {
            ByTable data           = null;
            ByTable beakerContents = null;
            Reagent R = null;

            data = new ByTable();
            data["targetTemp"]          = this.target_temperature;
            data["isActive"]            = this.on;
            data["isBeakerLoaded"]      = (Lang13.Bool(this.beaker) ? true : false);
            data["currentTemp"]         = (Lang13.Bool(this.beaker) ? this.beaker.reagents.chem_temp : null);
            data["beakerCurrentVolume"] = (Lang13.Bool(this.beaker) ? this.beaker.reagents.total_volume : null);
            data["beakerMaxVolume"]     = (Lang13.Bool(this.beaker) ? this.beaker.volume : null);
            beakerContents = new ByTable(0);

            if (Lang13.Bool(this.beaker))
            {
                foreach (dynamic _a in Lang13.Enumerate(this.beaker.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    beakerContents.Add(new ByTable(new object [] { new ByTable().Set("name", R.name).Set("volume", R.volume) }));
                }
            }
            data["beakerContents"] = beakerContents;
            return(data);
        }
示例#5
0
        // Function from file: medical_tools.dm
        public bool analyze_reagents(dynamic A = null)
        {
            Reagent R = null;


            if (Map13.GetDistance(this, A) >= 4)
            {
                this.occupant_message("The object is too far away.");
                return(false);
            }

            if (!Lang13.Bool(A.reagents) || A is Mob)
            {
                this.occupant_message("<span class=\"alert\">No reagent info gained from " + A + ".</span>");
                return(false);
            }
            this.occupant_message("Analyzing reagents...");

            foreach (dynamic _a in Lang13.Enumerate(A.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;


                if (R.can_synth && this.add_known_reagent(R.id, R.name))
                {
                    this.occupant_message("Reagent analyzed, identified as " + R.name + " and added to database.");
                    GlobalFuncs.send_byjax(this.chassis.occupant, "msyringegun.browser", "reagents_form", this.get_reagents_form());
                }
            }
            this.occupant_message("Analyzis complete.");
            return(true);
        }
示例#6
0
        // Function from file: chem_dispenser.dm
        public override ByTable ui_data(dynamic user = null)
        {
            ByTable data                = null;
            ByTable beakerContents      = null;
            double  beakerCurrentVolume = 0;
            Reagent R         = null;
            ByTable chemicals = null;
            dynamic re        = null;
            dynamic temp      = null;

            data                   = new ByTable();
            data["amount"]         = this.amount;
            data["energy"]         = this.energy;
            data["maxEnergy"]      = this.max_energy;
            data["isBeakerLoaded"] = (Lang13.Bool(this.beaker) ? true : false);
            beakerContents         = new ByTable(0);
            beakerCurrentVolume    = 0;

            if (Lang13.Bool(this.beaker) && Lang13.Bool(this.beaker.reagents) && this.beaker.reagents.reagent_list.len != 0)
            {
                foreach (dynamic _a in Lang13.Enumerate(this.beaker.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    beakerContents.Add(new ByTable(new object [] { new ByTable().Set("name", R.name).Set("volume", R.volume) }));
                    beakerCurrentVolume += R.volume;
                }
            }
            data["beakerContents"] = beakerContents;

            if (Lang13.Bool(this.beaker))
            {
                data["beakerCurrentVolume"]   = beakerCurrentVolume;
                data["beakerMaxVolume"]       = this.beaker.volume;
                data["beakerTransferAmounts"] = this.beaker.possible_transfer_amounts;
            }
            else
            {
                data["beakerCurrentVolume"]   = null;
                data["beakerMaxVolume"]       = null;
                data["beakerTransferAmounts"] = null;
            }
            chemicals = null;
            chemicals = new ByTable(0);

            foreach (dynamic _b in Lang13.Enumerate(this.dispensable_reagents))
            {
                re = _b;

                temp = GlobalVars.chemical_reagents_list[re];

                if (Lang13.Bool(temp))
                {
                    chemicals.Add(new ByTable(new object [] { new ByTable().Set("title", temp.name).Set("id", temp.id) }));
                }
            }
            data["chemicals"] = chemicals;
            return(data);
        }
示例#7
0
        // Function from file: projectile.dm
        public virtual dynamic on_hit(Ent_Static target = null, double?blocked = null, dynamic hit_zone = null)
        {
            blocked = blocked ?? 0;

            Ent_Static L = null;
            string     organ_hit_text = null;
            int?       volume         = null;
            string     reagent_note   = null;
            Reagent    R = null;


            if (!(target is Mob_Living))
            {
                return(0);
            }
            L = target;

            if (blocked != 100)
            {
                organ_hit_text = "";

                if (Lang13.Bool(((dynamic)L).has_limbs))
                {
                    organ_hit_text = new Txt(" in ").the(GlobalFuncs.parse_zone(this.def_zone)).item().ToString();
                }

                if (this.suppressed)
                {
                    GlobalFuncs.playsound(this.loc, this.hitsound, 5, 1, -1);
                    ((dynamic)L).WriteMsg(new Txt("<span class='userdanger'>You're shot by ").a(this).item().item(organ_hit_text).str("!</span>").ToString());
                }
                else
                {
                    if (Lang13.Bool(this.hitsound))
                    {
                        volume = this.vol_by_damage();
                        GlobalFuncs.playsound(this.loc, this.hitsound, volume, 1, -1);
                    }
                    L.visible_message(new Txt("<span class='danger'>").item(L).str(" is hit by ").a(this).item().item(organ_hit_text).str("!</span>").ToString(), new Txt("<span class='userdanger'>").item(L).str(" is hit by ").a(this).item().item(organ_hit_text).str("!</span>").ToString());
                }
                ((dynamic)L).on_hit(this.type);
            }

            if (this.reagents != null && this.reagents.reagent_list != null)
            {
                reagent_note = " REAGENTS:";

                foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    reagent_note += R.id + " (";
                    reagent_note += String13.NumberToString(R.volume) + ") ";
                }
            }
            GlobalFuncs.add_logs(this.firer, L, "shot", this, reagent_note);
            return(((dynamic)L).apply_effects(this.stun, this.weaken, this.paralyze, this.irradiate, this.slur, this.stutter, this.eyeblur, this.drowsy, blocked, this.stamina, this.jitter));
        }
示例#8
0
        // Function from file: food_cart.dm
        public override dynamic interact(dynamic user = null, bool?flag1 = null)
        {
            dynamic dat   = null;
            Reagent R     = null;
            Reagent R2    = null;
            dynamic V     = null;
            Browser popup = null;

            dat += "<br><b>STORED INGREDIENTS AND DRINKS</b><br><div class='statusDisplay'>";
            dat += "Remaining glasses: " + this.glasses + "<br>";
            dat += new Txt("Portion: <a href='?src=").Ref(this).str(";portion=1'>").item(this.portion).str("</a><br>").ToString();

            foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;

                dat += "" + R.name + ": " + R.volume + " ";
                dat += new Txt("<a href='?src=").Ref(this).str(";disposeI=").item(R.id).str("'>Purge</a>").ToString();

                if (this.glasses > 0)
                {
                    dat += new Txt("<a href='?src=").Ref(this).str(";pour=").item(R.id).str("'>Pour in a glass</a>").ToString();
                }
                dat += new Txt("<a href='?src=").Ref(this).str(";mix=").item(R.id).str("'>Add to the mixer</a><br>").ToString();
            }
            dat += "</div><br><b>MIXER CONTENTS</b><br><div class='statusDisplay'>";

            foreach (dynamic _b in Lang13.Enumerate(this.mixer.reagents.reagent_list, typeof(Reagent)))
            {
                R2 = _b;

                dat += "" + R2.name + ": " + R2.volume + " ";
                dat += new Txt("<a href='?src=").Ref(this).str(";transfer=").item(R2.id).str("'>Transfer back</a>").ToString();

                if (this.glasses > 0)
                {
                    dat += new Txt("<a href='?src=").Ref(this).str(";m_pour=").item(R2.id).str("'>Pour in a glass</a>").ToString();
                }
                dat += "<br>";
            }
            dat += "</div><br><b>STORED FOOD</b><br><div class='statusDisplay'>";

            foreach (dynamic _c in Lang13.Enumerate(this.stored_food))
            {
                V = _c;


                if (Convert.ToDouble(this.stored_food[V]) > 0)
                {
                    dat += new Txt("<b>").item(V).str(": ").item(this.stored_food[V]).str("</b> <a href='?src=").Ref(this).str(";dispense=").item(V).str("'>Dispense</a><br>").ToString();
                }
            }
            dat  += new Txt("</div><br><a href='?src=").Ref(this).str(";refresh=1'>Refresh</a> <a href='?src=").Ref(this).str(";close=1'>Close</a>").ToString();
            popup = new Browser(user, "foodcart", "Food Cart", 500, 350, this);
            popup.set_content(dat);
            popup.open();
            return(null);
        }
        // Function from file: reagent_containers.dm
        public override bool throw_impact(dynamic target = null, Mob_Living_Carbon thrower = null)
        {
            bool _default = false;

            dynamic M = null;
            dynamic R = null;
            Reagent A = null;

            _default = base.throw_impact((object)(target), thrower);

            if (!(this.reagents != null) || !Lang13.Bool(this.reagents.total_volume) || !this.spillable)
            {
                return(_default);
            }

            if (target is Mob && Lang13.Bool(target.reagents))
            {
                this.reagents.total_volume *= Rand13.Int(5, 10) * 0.1;
                M = target;
                ((Ent_Static)target).visible_message("<span class='danger'>" + M + " has been splashed with something!</span>", "<span class='userdanger'>" + M + " has been splashed with something!</span>");

                foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                {
                    A = _a;

                    R += A.id + " (";
                    R += String13.NumberToString(A.volume) + "),";
                }

                if (Lang13.Bool(this.thrownby))
                {
                    GlobalFuncs.add_logs(this.thrownby, M, "splashed", R);
                }
                this.reagents.reaction(target, GlobalVars.TOUCH);
            }
            else if (((Ent_Static)target).CanPass(this, GlobalFuncs.get_turf(this)) && Lang13.Bool(this.thrownby) && Lang13.Bool(this.thrownby.mind) && this.thrownby.mind.assigned_role == "Bartender")
            {
                this.visible_message("<span class='notice'>" + this + " lands onto the " + target.name + " without spilling a single drop.</span>");
                return(_default);
            }
            else
            {
                this.visible_message("<span class='notice'>" + this + " spills its contents all over " + target + ".</span>");
                this.reagents.reaction(target, GlobalVars.TOUCH);

                if (Lang13.Bool(GlobalFuncs.qdeleted(this)))
                {
                    return(_default);
                }
            }
            this.reagents.clear_reagents();
            return(_default);
        }
示例#10
0
        // Function from file: medbot.dm
        public bool check_overdose(dynamic patient = null, string reagent_id = null, double?injection_amount = null)
        {
            Reagent R = null;
            bool    current_volume = false;

            R = GlobalVars.chemical_reagents_list[reagent_id];
            current_volume = ((Reagents)patient.reagents).get_reagent_amount(reagent_id);

            if ((current_volume ?1:0) + (injection_amount ?? 0) > R.overdose_threshold)
            {
                return(true);
            }
            return(false);
        }
示例#11
0
        // Function from file: holder.dm
        public double?trans_id_to(dynamic target = null, dynamic reagent = null, double?amount = null, bool?preserve_data = null)
        {
            amount        = amount ?? 1;
            preserve_data = preserve_data ?? true;

            Reagents R               = null;
            dynamic  trans_data      = null;
            Reagent  current_reagent = null;


            if (!Lang13.Bool(target))
            {
                return(null);
            }

            if (!Lang13.Bool(target.reagents) || (this.total_volume ?? 0) <= 0 || !this.get_reagent_amount(reagent))
            {
                return(null);
            }
            R = target.reagents;

            if ((this.get_reagent_amount(reagent) ?1:0) < (amount ?? 0))
            {
                amount = this.get_reagent_amount(reagent) ?1:0;
            }
            amount     = Num13.MinInt(((int)(amount ?? 0)), Convert.ToInt32(R.maximum_volume - R.total_volume));
            trans_data = null;

            foreach (dynamic _a in Lang13.Enumerate(this.reagent_list, typeof(Reagent)))
            {
                current_reagent = _a;


                if (current_reagent.id == reagent)
                {
                    if (preserve_data == true)
                    {
                        trans_data = current_reagent.data;
                    }
                    R.add_reagent(current_reagent.id, amount, trans_data, this.chem_temp);
                    this.remove_reagent(current_reagent.id, amount, true);
                    break;
                }
            }
            this.update_total();
            R.update_total();
            R.handle_reactions();
            return(amount);
        }
示例#12
0
        // Function from file: Sleeper.dm
        public override ByTable ui_data(dynamic user = null)
        {
            ByTable data = null;
            dynamic chem = null;
            dynamic R    = null;
            Reagent R2   = null;

            data             = new ByTable();
            data["occupied"] = (Lang13.Bool(this.occupant) ? true : false);
            data["open"]     = this.state_open;
            data["chems"]    = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(this.available_chems))
            {
                chem = _a;

                R              = GlobalVars.chemical_reagents_list[chem];
                data["chems"] += new ByTable(new object [] { new ByTable().Set("name", R.name).Set("id", R.id).Set("allowed", this.chem_allowed(chem)) });
            }
            data["occupant"] = new ByTable();

            if (Lang13.Bool(this.occupant))
            {
                data["occupant"]["name"]      = this.occupant.name;
                data["occupant"]["stat"]      = this.occupant.stat;
                data["occupant"]["health"]    = this.occupant.health;
                data["occupant"]["maxHealth"] = this.occupant.maxHealth;
                data["occupant"]["minHealth"] = GlobalVars.config.health_threshold_dead;
                data["occupant"]["bruteLoss"] = ((Mob_Living)this.occupant).getBruteLoss();
                data["occupant"]["oxyLoss"]   = ((Mob_Living)this.occupant).getOxyLoss();
                data["occupant"]["toxLoss"]   = ((Mob_Living)this.occupant).getToxLoss();
                data["occupant"]["fireLoss"]  = ((Mob_Living)this.occupant).getFireLoss();
                data["occupant"]["cloneLoss"] = ((Mob_Living)this.occupant).getCloneLoss();
                data["occupant"]["brainLoss"] = ((Mob_Living)this.occupant).getBrainLoss();
                data["occupant"]["reagents"]  = new ByTable();

                if (this.occupant.reagents.reagent_list.len != 0)
                {
                    foreach (dynamic _b in Lang13.Enumerate(this.occupant.reagents.reagent_list, typeof(Reagent)))
                    {
                        R2 = _b;

                        data["occupant"]["reagents"] += new ByTable(new object [] { new ByTable().Set("name", R2.name).Set("volume", R2.volume) });
                    }
                }
            }
            return(data);
        }
        // Function from file: reagent_containers.dm
        public override bool ex_act(double?severity = null, dynamic target = null)
        {
            Reagent R = null;


            if (this.reagents != null)
            {
                foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    R.on_ex_act();
                }
            }
            base.ex_act(severity, (object)(target));
            return(false);
        }
示例#14
0
        // Function from file: cryo.dm
        public override ByTable ui_data(dynamic user = null)
        {
            ByTable data           = null;
            ByTable occupantData   = null;
            dynamic air1           = null;
            ByTable beakerContents = null;
            Reagent R = null;

            data = new ByTable();
            data["isOperating"] = this.on;
            data["hasOccupant"] = (Lang13.Bool(this.occupant) ? true : false);
            data["isOpen"]      = this.state_open;
            data["autoEject"]   = this.autoeject;
            occupantData        = new ByTable();

            if (Lang13.Bool(this.occupant))
            {
                occupantData["name"]            = this.occupant.name;
                occupantData["stat"]            = this.occupant.stat;
                occupantData["health"]          = this.occupant.health;
                occupantData["maxHealth"]       = this.occupant.maxHealth;
                occupantData["minHealth"]       = GlobalVars.config.health_threshold_dead;
                occupantData["bruteLoss"]       = ((Mob_Living)this.occupant).getBruteLoss();
                occupantData["oxyLoss"]         = ((Mob_Living)this.occupant).getOxyLoss();
                occupantData["toxLoss"]         = ((Mob_Living)this.occupant).getToxLoss();
                occupantData["fireLoss"]        = ((Mob_Living)this.occupant).getFireLoss();
                occupantData["bodyTemperature"] = this.occupant.bodytemperature;
            }
            data["occupant"]        = occupantData;
            air1                    = this.airs[1];
            data["cellTemperature"] = Num13.Floor(Convert.ToDouble(air1.temperature));
            data["isBeakerLoaded"]  = (Lang13.Bool(this.beaker) ? true : false);
            beakerContents          = new ByTable();

            if (Lang13.Bool(this.beaker) && Lang13.Bool(this.beaker.reagents) && this.beaker.reagents.reagent_list.len != 0)
            {
                foreach (dynamic _a in Lang13.Enumerate(this.beaker.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    beakerContents.Add(new ByTable(new object [] { new ByTable().Set("name", R.name).Set("volume", R.volume) }));
                }
            }
            data["beakerContents"] = beakerContents;
            return(data);
        }
        // Function from file: hypospray.dm
        public override bool attack(dynamic M = null, dynamic user = null, bool?def_zone = null)
        {
            double? fraction  = null;
            ByTable injected  = null;
            Reagent R         = null;
            dynamic trans     = null;
            string  contained = null;


            if (!Lang13.Bool(this.reagents.total_volume))
            {
                user.WriteMsg("<span class='warning'>" + this + " is empty!</span>");
                return(false);
            }

            if (!(M is Mob_Living_Carbon))
            {
                return(false);
            }

            if (Lang13.Bool(this.reagents.total_volume) && (this.ignore_flags || ((Mob_Living)M).can_inject(user, true)))
            {
                M.WriteMsg("<span class='warning'>You feel a tiny prick!</span>");
                user.WriteMsg("<span class='notice'>You inject " + M + " with " + this + ".</span>");
                fraction = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);
                this.reagents.reaction(M, GlobalVars.INJECT, fraction);

                if (Lang13.Bool(M.reagents))
                {
                    injected = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                    {
                        R = _a;

                        injected.Add(R.name);
                    }
                    trans = this.reagents.trans_to(M, this.amount_per_transfer_from_this);
                    user.WriteMsg(new Txt("<span class='notice'>").item(trans).str(" unit").s().str(" injected.  ").item(this.reagents.total_volume).str(" unit").s().str(" remaining in ").item(this).str(".</span>").ToString());
                    contained = GlobalFuncs.english_list(injected);
                    GlobalFuncs.add_logs(user, M, "injected", this, "(" + contained + ")");
                }
            }
            return(false);
        }
        // Function from file: reagent_containers.dm
        public string reagentlist(Obj_Item_Weapon_ReagentContainers snack = null)
        {
            dynamic data = null;
            Reagent R    = null;


            if (snack.reagents.reagent_list != null && snack.reagents.reagent_list.len != 0)
            {
                foreach (dynamic _a in Lang13.Enumerate(snack.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;

                    data += "" + R.id + "(" + R.volume + " units); ";
                }
                return(data);
            }
            else
            {
                return("No reagents");
            }
        }
示例#17
0
        // Function from file: table.dm
        public void check_table(  )
        {
            Obj_Item I  = null;
            Obj_Item S  = null;
            Obj_Item RC = null;
            Reagent  A  = null;

            this.table_contents = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Obj_Item)))
            {
                I = _b;


                if (I is Obj_Item_Stack)
                {
                    S = I;
                    this.table_contents[I.type] += ((dynamic)S).amount;
                }
                else
                {
                    if (I is Obj_Item_Weapon_ReagentContainers)
                    {
                        RC = I;

                        if (Lang13.Bool(RC.flags & 4096))
                        {
                            foreach (dynamic _a in Lang13.Enumerate(RC.reagents.reagent_list, typeof(Reagent)))
                            {
                                A = _a;

                                this.table_contents[A.type] += A.volume;
                            }
                        }
                    }
                    this.table_contents[I.type] += 1;
                }
            }
            return;
        }
示例#18
0
        // Function from file: medical_tools.dm
        public double get_patient_reagents(  )
        {
            double _default = 0;

            Reagent R = null;


            if (Lang13.Bool(this.patient.reagents))
            {
                foreach (dynamic _a in Lang13.Enumerate(this.patient.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;


                    if (R.volume > 0)
                    {
                        _default += /*[I CANNOT CONVERT SOME RANDOM SHIT TO A DOUBLE: string]*/ 0;
                    }
                }
            }
            return(_default != 0 || Lang13.Bool("None") ?1:0);
        }
示例#19
0
        // Function from file: medical_tools.dm
        public dynamic get_available_reagents(  )
        {
            dynamic output = null;
            dynamic SG     = null;
            Reagent R      = null;

            SG = Lang13.FindIn(typeof(Obj_Item_MechaParts_MechaEquipment_Medical_SyringeGun), this.chassis);

            if (Lang13.Bool(SG) && Lang13.Bool(SG.reagents) && SG.reagents.reagent_list is ByTable)
            {
                foreach (dynamic _a in Lang13.Enumerate(SG.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;


                    if (R.volume > 0)
                    {
                        output += new Txt("<a href=\"?src=").Ref(this).str(";inject=").Ref(R).str(";source=").Ref(SG).str("\">Inject ").item(R.name).str("</a><br />").ToString();
                    }
                }
            }
            return(output);
        }
示例#20
0
        // Function from file: medicine_reagents.dm
        public override bool on_mob_life(dynamic M = null)
        {
            Reagent R = null;


            foreach (dynamic _a in Lang13.Enumerate(M.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;


                if (R != this)
                {
                    ((Reagents)M.reagents).remove_reagent(R.id, 2.5);
                }
            }

            if (Convert.ToDouble(M.health) > 20)
            {
                ((Mob_Living)M).adjustToxLoss(2.5);
            }
            base.on_mob_life((object)(M));
            return(false);
        }
示例#21
0
        // Function from file: medical_tools.dm
        public bool get_current_reagents(  )
        {
            dynamic output = null;
            Reagent R      = null;


            foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
            {
                R = _a;


                if (R.volume > 0)
                {
                    output += new Txt().item(R).str(": ").item(Num13.Round(R.volume, 0.001)).str(" - <a href=\"?src=").Ref(this).str(";purge_reagent=").item(R.id).str("\">Purge Reagent</a><br />").ToString();
                }
            }

            if (Lang13.Bool(output))
            {
                output += new Txt("Total: ").item(Num13.Round(this.reagents.total_volume ?? 0, 0.001)).str("/").item(this.reagents.maximum_volume).str(" - <a href=\"?src=").Ref(this).str(";purge_all=1\">Purge All</a>").ToString();
            }
            return(Lang13.Bool(output) || Lang13.Bool("None"));
        }
示例#22
0
        // Function from file: scanners.dm
        public override dynamic attack_self(dynamic user = null, dynamic flag = null, bool?emp = null)
        {
            ByTable blood_traces = null;
            Reagent R            = null;
            string  dat          = null;
            dynamic R2           = null;


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

            if (this.crit_fail)
            {
                user.WriteMsg("<span class='warning'>This device has critically failed and is no longer functional!</span>");
                return(null);
            }

            if (!((Mob)user).IsAdvancedToolUser())
            {
                user.WriteMsg("<span class='warning'>You don't have the dexterity to do this!</span>");
                return(null);
            }

            if (Lang13.Bool(this.reagents.total_volume))
            {
                blood_traces = new ByTable();

                foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                {
                    R = _a;


                    if (R.id != "blood")
                    {
                        this.reagents.clear_reagents();
                        user.WriteMsg("<span class='warning'>The sample was contaminated! Please insert another sample.</span>");
                        return(null);
                    }
                    else
                    {
                        blood_traces = String13.ParseUrlParams(R.data["trace_chem"]);
                        break;
                    }
                }
                dat = "<i><b>Trace Chemicals Found:</b>";

                if (!(blood_traces.len != 0))
                {
                    dat += "<br>None";
                }
                else
                {
                    foreach (dynamic _b in Lang13.Enumerate(blood_traces))
                    {
                        R2 = _b;


                        if (Rand13.PercentChance(((int)(this.reliability))))
                        {
                            dat += "<br>" + GlobalVars.chemical_reagents_list[R2];

                            if (this.details)
                            {
                                dat += " (" + blood_traces[R2] + " units)";
                            }
                            this.recent_fail = false;
                        }
                        else if (this.recent_fail)
                        {
                            this.crit_fail = true;
                            this.reagents.clear_reagents();
                            return(null);
                        }
                        else
                        {
                            this.recent_fail = true;
                        }
                    }
                }
                dat += "</i>";
                user.WriteMsg(dat);
                this.reagents.clear_reagents();
            }
            return(null);
        }
		// Function from file: reagentgrinder.dm
		public override dynamic interact( dynamic user = null, bool? flag1 = null ) {
			bool is_chamber_empty = false;
			bool is_beaker_ready = false;
			string processing_chamber = null;
			string beaker_contents = null;
			string dat = null;
			Obj_Item O = null;
			bool anything = false;
			Reagent R = null;
			Browser popup = null;

			is_chamber_empty = false;
			is_beaker_ready = false;
			processing_chamber = "";
			beaker_contents = "";
			dat = "";

			if ( !this.operating ) {
				
				foreach (dynamic _a in Lang13.Enumerate( this.holdingitems, typeof(Obj_Item) )) {
					O = _a;
					
					processing_chamber += new Txt().A( O.name ).item().str( "<BR>" ).ToString();
				}

				if ( !Lang13.Bool( processing_chamber ) ) {
					is_chamber_empty = true;
					processing_chamber = "Nothing.";
				}

				if ( !Lang13.Bool( this.beaker ) ) {
					beaker_contents = "<B>No beaker attached.</B><br>";
				} else {
					is_beaker_ready = true;
					beaker_contents = "<B>The beaker contains:</B><br>";
					anything = false;

					foreach (dynamic _b in Lang13.Enumerate( this.beaker.reagents.reagent_list, typeof(Reagent) )) {
						R = _b;
						
						anything = true;
						beaker_contents += "" + R.volume + " - " + R.name + "<br>";
					}

					if ( !anything ) {
						beaker_contents += "Nothing<br>";
					}
				}
				dat = "\n		<b>Processing chamber contains:</b><br>\n		" + processing_chamber + "<br>\n		" + beaker_contents + "<hr>\n		";

				if ( is_beaker_ready && !is_chamber_empty && !( ( this.stat & 3 ) != 0 ) ) {
					dat += new Txt( "<A href='?src=" ).Ref( this ).str( ";action=grind'>Grind the reagents</a><BR>" ).ToString();
					dat += new Txt( "<A href='?src=" ).Ref( this ).str( ";action=juice'>Juice the reagents</a><BR><BR>" ).ToString();
				}

				if ( this.holdingitems != null && this.holdingitems.len > 0 ) {
					dat += new Txt( "<A href='?src=" ).Ref( this ).str( ";action=eject'>Eject the reagents</a><BR>" ).ToString();
				}

				if ( Lang13.Bool( this.beaker ) ) {
					dat += new Txt( "<A href='?src=" ).Ref( this ).str( ";action=detach'>Detach the beaker</a><BR>" ).ToString();
				}
			} else {
				dat += "Please wait...";
			}
			popup = new Browser( user, "reagentgrinder", "All-In-One Grinder" );
			popup.set_content( dat );
			popup.set_title_image( ((Mob)user).browse_rsc_icon( this.icon, this.icon_state ) );
			popup.open( true );
			return null;
		}
        // Function from file: glass.dm
        public override bool attack(dynamic M = null, dynamic user = null, bool?def_zone = null)
        {
            dynamic R        = null;
            Reagent A        = null;
            double? fraction = null;


            if (!this.canconsume(M, user))
            {
                return(false);
            }

            if (!this.spillable)
            {
                return(false);
            }

            if (!(this.reagents != null) || !Lang13.Bool(this.reagents.total_volume))
            {
                user.WriteMsg("<span class='warning'>" + this + " is empty!</span>");
                return(false);
            }

            if (M is Mob)
            {
                if (user.a_intent == "harm")
                {
                    ((Ent_Static)M).visible_message("<span class='danger'>" + user + " splashes the contents of " + this + " onto " + M + "!</span>", "<span class='userdanger'>" + user + " splashes the contents of " + this + " onto " + M + "!</span>");

                    if (this.reagents != null)
                    {
                        foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                        {
                            A = _a;

                            R += A.id + " (";
                            R += String13.NumberToString(A.volume) + "),";
                        }
                    }
                    this.reagents.reaction(M, GlobalVars.TOUCH);
                    GlobalFuncs.add_logs(user, M, "splashed", R);
                    this.reagents.clear_reagents();
                }
                else
                {
                    if (M != user)
                    {
                        ((Ent_Static)M).visible_message("<span class='danger'>" + user + " attempts to feed something to " + M + ".</span>", "<span class='userdanger'>" + user + " attempts to feed something to you.</span>");

                        if (!GlobalFuncs.do_mob(user, M))
                        {
                            return(false);
                        }

                        if (!(this.reagents != null) || !Lang13.Bool(this.reagents.total_volume))
                        {
                            return(false);
                        }
                        ((Ent_Static)M).visible_message("<span class='danger'>" + user + " feeds something to " + M + ".</span>", "<span class='userdanger'>" + user + " feeds something to you.</span>");
                        GlobalFuncs.add_logs(user, M, "fed", this.reagentlist(this));
                    }
                    else
                    {
                        user.WriteMsg("<span class='notice'>You swallow a gulp of " + this + ".</span>");
                    }
                    fraction = Num13.MinInt(((int)(5 / (this.reagents.total_volume ?? 0))), 1);
                    this.reagents.reaction(M, GlobalVars.INGEST, fraction);
                    Task13.Schedule(5, (Task13.Closure)(() => {
                        this.reagents.trans_to(M, 5);
                        return;
                    }));
                    GlobalFuncs.playsound(M.loc, "sound/items/drink.ogg", Rand13.Int(10, 50), 1);
                }
            }
            return(false);
        }
示例#25
0
        // Function from file: chem_master.dm
        public override dynamic attack_hand(dynamic a = null, bool?b = null, bool?c = null)
        {
            string  dat   = null;
            Reagent G     = null;
            Reagent N     = null;
            Browser popup = null;


            if ((this.stat & 1) != 0)
            {
                return(null);
            }
            ((Mob)a).set_machine(this);
            dat = "";

            if (Lang13.Bool(this.beaker))
            {
                dat += new Txt("Beaker [").item(this.beaker.reagents.total_volume).str("/").item(this.beaker.volume).str("] <A href='?src=").Ref(this).str(";eject=1'>Eject and Clear Buffer</A><BR>").ToString();
            }
            else
            {
                dat = "Please insert beaker.<BR>";
            }
            dat += "<HR><B>Add to buffer:</B><UL>";

            if (Lang13.Bool(this.beaker))
            {
                if (Lang13.Bool(this.beaker.reagents.total_volume))
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.beaker.reagents.reagent_list, typeof(Reagent)))
                    {
                        G = _a;

                        dat += "<LI>" + G.name + ", " + G.volume + " Units - ";
                        dat += new Txt("<A href='?src=").Ref(this).str(";analyze=1;reagent=").Ref(G).str("'>Analyze</A> ").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";add=").item(G.id).str(";amount=1'>1</A> ").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";add=").item(G.id).str(";amount=5'>5</A> ").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";add=").item(G.id).str(";amount=10'>10</A> ").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";add=").item(G.id).str(";amount=").item(G.volume).str("'>All</A> ").ToString();
                        dat += new Txt("<A href='?src=").Ref(this).str(";addcustom=").item(G.id).str("'>Custom</A>").ToString();
                    }
                }
                else
                {
                    dat += "<LI>Beaker is empty.";
                }
            }
            else
            {
                dat += "<LI>No beaker.";
            }
            dat += new Txt("</UL><HR><B>Transfer to <A href='?src=").Ref(this).str(";toggle=1'>").item((!this.mode ? "disposal" : "beaker")).str("</A>:</B><UL>").ToString();

            if (Lang13.Bool(this.reagents.total_volume))
            {
                foreach (dynamic _b in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                {
                    N = _b;

                    dat += "<LI>" + N.name + ", " + N.volume + " Units - ";
                    dat += new Txt("<A href='?src=").Ref(this).str(";analyze=1;reagent=").Ref(N).str("'>Analyze</A> ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";remove=").item(N.id).str(";amount=1'>1</A> ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";remove=").item(N.id).str(";amount=5'>5</A> ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";remove=").item(N.id).str(";amount=10'>10</A> ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";remove=").item(N.id).str(";amount=").item(N.volume).str("'>All</A> ").ToString();
                    dat += new Txt("<A href='?src=").Ref(this).str(";removecustom=").item(N.id).str("'>Custom</A>").ToString();
                }
            }
            else
            {
                dat += "<LI>Buffer is empty.";
            }
            dat += "</UL><HR>";

            if (!this.condi)
            {
                if (Lang13.Bool(this.bottle))
                {
                    dat += new Txt("Pill Bottle [").item(this.bottle.contents.len).str("/").item(this.bottle.storage_slots).str("] <A href='?src=").Ref(this).str(";ejectp=1'>Eject</A>").ToString();
                }
                else
                {
                    dat += "No pill bottle inserted.";
                }
            }
            else
            {
                dat += "<BR>";
            }
            dat += "<UL>";

            if (!this.condi)
            {
                if (Lang13.Bool(this.beaker) && Lang13.Bool(this.reagents.total_volume))
                {
                    dat += new Txt("<LI><A href='?src=").Ref(this).str(";createpill=1;many=0'>Create pill</A> (50 units max)").ToString();
                    dat += new Txt("<LI><A href='?src=").Ref(this).str(";createpill=1;many=1'>Create multiple pills</A><BR>").ToString();
                    dat += new Txt("<LI><A href='?src=").Ref(this).str(";createpatch=1;many=0'>Create patch</A> (50 units max)").ToString();
                    dat += new Txt("<LI><A href='?src=").Ref(this).str(";createpatch=1;many=1'>Create multiple patches</A><BR>").ToString();
                }
                else
                {
                    dat += "<LI><span class='linkOff'>Create pill</span> (50 units max)";
                    dat += "<LI><span class='linkOff'>Create multiple pills</span><BR>";
                    dat += "<LI><span class='linkOff'>Create patch</span> (50 units max)";
                    dat += "<LI><span class='linkOff'>Create multiple patches</span><BR>";
                }
            }
            else if (Lang13.Bool(this.beaker) && Lang13.Bool(this.reagents.total_volume))
            {
                dat += new Txt("<LI><A href='?src=").Ref(this).str(";createpill=1'>Create pack</A> (10 units max)<BR>").ToString();
            }
            else
            {
                dat += "<LI><span class='linkOff'>Create pack</span> (10 units max)<BR>";
            }
            dat  += new Txt("<LI><A href='?src=").Ref(this).str(";createbottle=1'>Create bottle</A> (").item((this.condi ? "50" : "30")).str(" units max)").ToString();
            dat  += "</UL>";
            dat  += new Txt("<BR><A href='?src=").Ref(this).str(";close=1'>Close</A>").ToString();
            popup = new Browser(a, "chem_master", this.name, 470, 500);
            popup.set_content(dat);
            popup.set_title_image(((Mob)a).browse_rsc_icon(this.icon, this.icon_state));
            popup.open(true);
            return(null);
        }
示例#26
0
        // Function from file: dropper.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic trans      = null;
            double? fraction   = null;
            dynamic victim     = null;
            dynamic safe_thing = null;
            dynamic M          = null;
            dynamic R          = null;
            Reagent A          = null;
            dynamic trans2     = null;


            if (!(proximity_flag == true))
            {
                return(false);
            }

            if (!Lang13.Bool(target.reagents))
            {
                return(false);
            }

            if ((this.reagents.total_volume ?? 0) > 0)
            {
                if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>" + target + " is full.</span>");
                    return(false);
                }

                if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Mob) && !(target is Obj_Item_Weapon_ReagentContainers_Food) && !(target is Obj_Item_Clothing_Mask_Cigarette))
                {
                    user.WriteMsg("<span class='warning'>You cannot directly fill " + target + "!</span>");
                    return(false);
                }
                trans    = 0;
                fraction = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);

                if (target is Mob)
                {
                    if (target is Mob_Living_Carbon_Human)
                    {
                        victim     = target;
                        safe_thing = null;

                        if (Lang13.Bool(victim.wear_mask))
                        {
                            if (Lang13.Bool(victim.wear_mask.flags_cover & 2))
                            {
                                safe_thing = victim.wear_mask;
                            }
                        }

                        if (Lang13.Bool(victim.head))
                        {
                            if (Lang13.Bool(victim.head.flags_cover & 2))
                            {
                                safe_thing = victim.head;
                            }
                        }

                        if (Lang13.Bool(victim.glasses))
                        {
                            if (!Lang13.Bool(safe_thing))
                            {
                                safe_thing = victim.glasses;
                            }
                        }

                        if (Lang13.Bool(safe_thing))
                        {
                            if (!Lang13.Bool(safe_thing.reagents))
                            {
                                ((Ent_Static)safe_thing).create_reagents(100);
                            }
                            this.reagents.reaction(safe_thing, GlobalVars.TOUCH, fraction);
                            trans = this.reagents.trans_to(safe_thing, this.amount_per_transfer_from_this);
                            ((Ent_Static)target).visible_message("<span class='danger'>" + user + " tries to squirt something into " + target + "'s eyes, but fails!</span>", "<span class='userdanger'>" + user + " tries to squirt something into " + target + "'s eyes, but fails!</span>");
                            user.WriteMsg(new Txt("<span class='notice'>You transfer ").item(trans).str(" unit").s().str(" of the solution.</span>").ToString());
                            this.update_icon();
                            return(false);
                        }
                    }
                    ((Ent_Static)target).visible_message("<span class='danger'>" + user + " squirts something into " + target + "'s eyes!</span>", "<span class='userdanger'>" + user + " squirts something into " + target + "'s eyes!</span>");
                    this.reagents.reaction(target, GlobalVars.TOUCH, fraction);
                    M = target;

                    if (this.reagents != null)
                    {
                        foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                        {
                            A = _a;

                            R += A.id + " (";
                            R += String13.NumberToString(A.volume) + "),";
                        }
                    }
                    GlobalFuncs.add_logs(user, M, "squirted", R);
                }
                trans = this.reagents.trans_to(target, this.amount_per_transfer_from_this);
                user.WriteMsg(new Txt("<span class='notice'>You transfer ").item(trans).str(" unit").s().str(" of the solution.</span>").ToString());
                this.update_icon();
            }
            else
            {
                if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Obj_Structure_ReagentDispensers))
                {
                    user.WriteMsg("<span class='notice'>You cannot directly remove reagents from " + target + ".</span>");
                    return(false);
                }

                if (!Lang13.Bool(target.reagents.total_volume))
                {
                    user.WriteMsg("<span class='warning'>" + target + " is empty!</span>");
                    return(false);
                }
                trans2 = ((Reagents)target.reagents).trans_to(this, this.amount_per_transfer_from_this);
                user.WriteMsg(new Txt("<span class='notice'>You fill ").item(this).str(" with ").item(trans2).str(" unit").s().str(" of the solution.</span>").ToString());
                this.update_icon();
            }
            return(false);
        }
示例#27
0
        public override bool f_action(dynamic target = null)
        {
            Obj_Item_Weapon_ReagentContainers_Syringe S = null;
            dynamic           trg              = null;
            Ent_Dynamic       mechsyringe      = null;
            Ent_Static        originaloccupant = null;
            int?              i    = null;
            ByTable           mobs = null;
            Mob_Living_Carbon M    = null;
            dynamic           M2   = null;
            dynamic           R    = null;
            Reagent           A    = null;


            if (!this.action_checks(target))
            {
                return(false);
            }

            if (target is Obj_Item_Weapon_ReagentContainers_Syringe)
            {
                return(this.load_syringe(target));
            }

            if (target is Obj_Item_Weapon_Storage)
            {
                foreach (dynamic _a in Lang13.Enumerate(target.contents, typeof(Obj_Item_Weapon_ReagentContainers_Syringe)))
                {
                    S = _a;

                    this.load_syringe(S);
                }
                return(false);
            }

            if (this.mode)
            {
                return(this.analyze_reagents(target));
            }

            if (!(this.syringes.len != 0))
            {
                this.occupant_message("<span class=\"alert\">No syringes loaded.</span>");
                return(false);
            }

            if ((this.reagents.total_volume ?? 0) <= 0)
            {
                this.occupant_message("<span class=\"alert\">No available reagents to load syringe with.</span>");
                return(false);
            }
            trg         = GlobalFuncs.get_turf(target);
            mechsyringe = this.syringes[1];
            mechsyringe.forceMove(GlobalFuncs.get_turf(this.chassis));
            this.reagents.trans_to(mechsyringe, Num13.MinInt(Convert.ToInt32(((dynamic)mechsyringe).volume), ((int)(this.reagents.total_volume ?? 0))));
            this.syringes.Remove(mechsyringe);
            mechsyringe.icon       = "icons/obj/chemical.dmi";
            mechsyringe.icon_state = "syringeproj";
            GlobalFuncs.playsound(this.chassis, "sound/items/syringeproj.ogg", 50, 1);
            this.log_message("Launched " + mechsyringe + " from " + this + ", targeting " + target + ".");
            originaloccupant = this.chassis.occupant;
            Task13.Schedule(0, (Task13.Closure)(() => {
                Task13.Source = null;
                i             = null;
                i             = 0;

                while ((i ?? 0) < 6)
                {
                    if (!(mechsyringe != null))
                    {
                        break;
                    }
                    Map13.StepTowardsSimple(mechsyringe, trg);

                    if (!(mechsyringe != null))
                    {
                        mobs = new ByTable();

                        foreach (dynamic _b in Lang13.Enumerate(mechsyringe.loc, typeof(Mob_Living_Carbon)))
                        {
                            M = _b;

                            mobs.Add(M);
                        }
                        M2 = GlobalFuncs.safepick(mobs);

                        if (Lang13.Bool(M2))
                        {
                            R = null;
                            mechsyringe.visible_message("<span class=\"attack\"> " + M2 + " was hit by the syringe!</span>");

                            if (((Mob_Living)M2).can_inject(null, true))
                            {
                                if (mechsyringe.reagents != null)
                                {
                                    foreach (dynamic _c in Lang13.Enumerate(mechsyringe.reagents.reagent_list, typeof(Reagent)))
                                    {
                                        A = _c;

                                        R += A.id + " (";
                                        R += String13.NumberToString(A.volume) + "),";
                                    }
                                }
                                mechsyringe.icon_state = Lang13.Initial(mechsyringe, "icon_state");
                                mechsyringe.icon       = Lang13.Initial(mechsyringe, "icon");
                                mechsyringe.reagents.trans_to(M2, mechsyringe.reagents.total_volume);
                                ((Mob_Living)M2).take_organ_damage(2);
                                GlobalFuncs.add_logs(originaloccupant, M2, "shot", "syringegun");
                            }
                            break;
                        }
                        else if (mechsyringe.loc == trg)
                        {
                            mechsyringe.icon_state = Lang13.Initial(mechsyringe, "icon_state");
                            mechsyringe.icon       = Lang13.Initial(mechsyringe, "icon");
                            ((dynamic)mechsyringe).update_icon();
                            break;
                        }
                    }
                    else
                    {
                        mechsyringe.icon_state = Lang13.Initial(mechsyringe, "icon_state");
                        mechsyringe.icon       = Lang13.Initial(mechsyringe, "icon");
                        ((dynamic)mechsyringe).update_icon();
                        break;
                    }
                    Task13.Sleep(1);
                    i++;
                }
                return;
            }));
            return(true);
        }
示例#28
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;
        }
示例#29
0
        // Function from file: syringes.dm
        public override bool afterattack(dynamic target = null, dynamic user = null, bool?proximity_flag = null, string click_parameters = null)
        {
            dynamic       M          = null;
            dynamic       H          = null;
            dynamic       amount     = null;
            dynamic       T          = null;
            dynamic       B          = null;
            dynamic       H2         = null;
            dynamic       trans      = null;
            ByTable       rinject    = null;
            Reagent       R          = null;
            string        contained  = null;
            dynamic       M2         = null;
            double?       fraction   = null;
            ByTable       rinject2   = null;
            Reagent       R2         = null;
            string        contained2 = null;
            dynamic       M3         = null;
            double?       fraction2  = null;
            Reagent_Blood B2         = null;
            Reagent_Blood d          = null;
            dynamic       C          = null;


            if (this.busy)
            {
                return(false);
            }

            if (!(proximity_flag == true))
            {
                return(false);
            }

            if (!Lang13.Bool(target.reagents))
            {
                return(false);
            }

            if (target is Mob_Living)
            {
                M = target;

                if (!((Mob_Living)M).can_inject(user, true))
                {
                    return(false);
                }
            }

            switch ((bool)(this.mode))
            {
            case false:

                if ((this.reagents.total_volume ?? 0) >= Convert.ToDouble(this.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>The syringe is full.</span>");
                    return(false);
                }

                if (target is Mob)
                {
                    if (target is Mob_Living_Carbon_Human)
                    {
                        H = target;

                        if (Lang13.Bool(((dynamic)(H.dna.species.specflags != null && !(H.dna.species.exotic_blood != null))).Contains(1024)))
                        {
                            user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                            return(false);
                        }
                    }

                    if (Lang13.Bool(this.reagents.has_reagent("blood")))
                    {
                        user.WriteMsg("<span class='warning'>There is already a blood sample in this syringe!</span>");
                        return(false);
                    }

                    if (target is Mob_Living_Carbon)
                    {
                        amount = this.reagents.maximum_volume - this.reagents.total_volume;
                        T      = target;

                        if (!Lang13.Bool(T.has_dna()) || Lang13.Bool(T.disabilities & 128))
                        {
                            user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                            return(false);
                        }

                        if (target != user)
                        {
                            ((Ent_Static)target).visible_message("<span class='danger'>" + user + " is trying to take a blood sample from " + target + "!</span>", "<span class='userdanger'>" + user + " is trying to take a blood sample from " + target + "!</span>");
                            this.busy = true;

                            if (!GlobalFuncs.do_mob(user, target))
                            {
                                this.busy = false;
                                return(false);
                            }
                        }
                        this.busy = false;
                        B         = null;
                        B         = ((Mob_Living_Carbon)T).take_blood(this, amount);

                        if (!Lang13.Bool(B) && target is Mob_Living_Carbon_Human)
                        {
                            H2 = target;

                            if (H2.dna.species.exotic_blood != null && Lang13.Bool(H2.reagents.total_volume))
                            {
                                ((Reagents)target.reagents).trans_to(this, amount);
                            }
                            else
                            {
                                user.WriteMsg("<span class='warning'>You are unable to locate any blood!</span>");
                                return(false);
                            }
                        }

                        if (Lang13.Bool(B))
                        {
                            this.reagents.reagent_list.Add(B);
                            this.reagents.update_total();
                            this.on_reagent_change();
                            this.reagents.handle_reactions();
                        }
                        ((Ent_Static)user).visible_message("" + user + " takes a blood sample from " + target + ".");
                    }
                }
                else
                {
                    if (!Lang13.Bool(target.reagents.total_volume))
                    {
                        user.WriteMsg("<span class='warning'>" + target + " is empty!</span>");
                        return(false);
                    }

                    if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Obj_Structure_ReagentDispensers) && !(target is Obj_Item_SlimeExtract))
                    {
                        user.WriteMsg("<span class='warning'>You cannot directly remove reagents from " + target + "!</span>");
                        return(false);
                    }
                    trans = ((Reagents)target.reagents).trans_to(this, this.amount_per_transfer_from_this);
                    user.WriteMsg("<span class='notice'>You fill " + this + " with " + trans + " units of the solution.</span>");
                }

                if ((this.reagents.total_volume ?? 0) >= Convert.ToDouble(this.reagents.maximum_volume))
                {
                    this.mode = !this.mode;
                    this.update_icon();
                }
                break;

            case true:

                if (!Lang13.Bool(this.reagents.total_volume))
                {
                    user.WriteMsg("<span class='notice'>" + this + " is empty.</span>");
                    return(false);
                }

                if (!Lang13.Bool(((Ent_Static)target).is_open_container()) && !(target is Mob) && !(target is Obj_Item_Weapon_ReagentContainers_Food) && !(target is Obj_Item_SlimeExtract) && !(target is Obj_Item_Clothing_Mask_Cigarette) && !(target is Obj_Item_Weapon_Storage_Fancy_Cigarettes))
                {
                    user.WriteMsg("<span class='warning'>You cannot directly fill " + target + "!</span>");
                    return(false);
                }

                if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                {
                    user.WriteMsg("<span class='notice'>" + target + " is full.</span>");
                    return(false);
                }

                if (target is Mob && target != user)
                {
                    ((Ent_Static)target).visible_message("<span class='danger'>" + user + " is trying to inject " + target + "!</span>", "<span class='userdanger'>" + user + " is trying to inject " + target + "!</span>");

                    if (!GlobalFuncs.do_mob(user, target))
                    {
                        return(false);
                    }

                    if (!Lang13.Bool(this.reagents.total_volume))
                    {
                        return(false);
                    }

                    if ((target.reagents.total_volume ?? 0) >= Convert.ToDouble(target.reagents.maximum_volume))
                    {
                        return(false);
                    }
                    ((Ent_Static)target).visible_message("<span class='danger'>" + user + " injects " + target + " with the syringe!", "<span class='userdanger'>" + user + " injects " + target + " with the syringe!");
                    rinject = new ByTable();

                    foreach (dynamic _a in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                    {
                        R = _a;

                        rinject.Add(R.name);
                    }
                    contained = GlobalFuncs.english_list(rinject);
                    M2        = target;
                    GlobalFuncs.add_logs(user, M2, "injected", this, "which had " + contained);
                    fraction = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);
                    this.reagents.reaction(target, GlobalVars.INJECT, fraction);
                }

                if (target is Mob && target == user)
                {
                    rinject2 = new ByTable();

                    foreach (dynamic _b in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent)))
                    {
                        R2 = _b;

                        rinject2.Add(R2.name);
                    }
                    contained2 = GlobalFuncs.english_list(rinject2);
                    M3         = target;
                    GlobalFuncs.log_attack("<font color='red'>" + user.name + " (" + user.ckey + ") injected " + M3.name + " (" + M3.ckey + ") with " + this.name + ", which had " + contained2 + " (INTENT: " + String13.ToUpper(user.a_intent) + ")</font>");
                    M3.attack_log += "[" + GlobalFuncs.time_stamp() + "] <font color='orange'>Injected themselves (" + contained2 + ") with " + this.name + ".</font>";
                    fraction2      = Num13.MinInt(((int)((this.amount_per_transfer_from_this ?? 0) / (this.reagents.total_volume ?? 0))), 1);
                    this.reagents.reaction(target, GlobalVars.INJECT, fraction2);
                }
                Task13.Schedule(5, (Task13.Closure)(() => {
                    B2 = null;

                    foreach (dynamic _c in Lang13.Enumerate(this.reagents.reagent_list, typeof(Reagent_Blood)))
                    {
                        d = _c;

                        B2 = d;
                        break;
                    }

                    if (B2 != null && target is Mob_Living_Carbon)
                    {
                        C = target;
                        ((Mob_Living_Carbon)C).inject_blood(this, 5);
                    }
                    else
                    {
                        this.reagents.trans_to(target, this.amount_per_transfer_from_this);
                    }
                    user.WriteMsg("<span class='notice'>You inject " + this.amount_per_transfer_from_this + " units of the solution. The syringe now contains " + this.reagents.total_volume + " units.</span>");

                    if ((this.reagents.total_volume ?? 0) <= 0 && this.mode)
                    {
                        this.mode = false;
                        this.update_icon();
                    }
                    return;
                }));
                break;
            }
            return(false);
        }
示例#30
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);
        }