Ejemplo n.º 1
0
 // Function from file: stack.dm
 public void copy_evidences(Obj_Item_Stack from = null)
 {
     this.blood_DNA          = from.blood_DNA;
     this.fingerprints       = from.fingerprints;
     this.fingerprintshidden = from.fingerprintshidden;
     this.fingerprintslast   = from.fingerprintslast;
     return;
 }
Ejemplo n.º 2
0
        // Function from file: growninedible.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            dynamic        plank            = null;
            dynamic        old_plank_amount = null;
            Obj_Item_Stack ST   = null;
            dynamic        leaf = null;
            Obj_Item_Device_Flashlight_Flare_Torch T = null;

            base.attackby((object)(A), (object)(user), _params, silent, replace_spent);

            if (A is Obj_Item_Weapon_CircularSaw || A is Obj_Item_Weapon_Hatchet || A is Obj_Item_Weapon_Twohanded_Fireaxe && A.wielded || A is Obj_Item_Weapon_Melee_Energy || A is Obj_Item_Weapon_Twohanded_Required_Chainsaw)
            {
                user.show_message(new Txt("<span class='notice'>You make ").item(this.plank_name).str(" out of ").the(this).item().str("!</span>").ToString(), 1);
                plank            = Lang13.Call(this.plank_type, user.loc, Num13.Floor((this.potency ?? 0) / 25) + 1);
                old_plank_amount = plank.amount;

                foreach (dynamic _a in Lang13.Enumerate(user.loc, typeof(Obj_Item_Stack)))
                {
                    ST = _a;


                    if (ST != plank && Lang13.Bool(((dynamic)this.plank_type).IsInstanceOfType(ST)) && (ST.amount ?? 0) < (ST.max_amount ?? 0))
                    {
                        ST.attackby(plank, user);
                    }
                }

                if (Convert.ToDouble(plank.amount) > Convert.ToDouble(old_plank_amount))
                {
                    user.WriteMsg("<span class='notice'>You add the newly-formed " + this.plank_name + " to the stack. It now contains " + plank.amount + " " + this.plank_name + ".</span>");
                }
                GlobalFuncs.qdel(this);
            }

            if (GlobalFuncs.is_type_in_list(A, this.accepted))
            {
                leaf = A;

                if (leaf.dry)
                {
                    user.show_message(new Txt("<span class='notice'>You wrap ").the(A).item().str(" around the log, turning it into a torch!</span>").ToString());
                    T = new Obj_Item_Device_Flashlight_Flare_Torch(user.loc);
                    Task13.User.unEquip(A);
                    Task13.User.put_in_active_hand(T);
                    GlobalFuncs.qdel(leaf);
                    GlobalFuncs.qdel(this);
                    return(null);
                }
                else
                {
                    Task13.User.WriteMsg("<span class ='warning'>You must dry this first!</span>");
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        // Function from file: equipment_locker.dm
        public void empty_content(  )
        {
            Obj_Item_Stack s = null;
            dynamic        O = null;


            foreach (dynamic _a in Lang13.Enumerate(this.stack_list))
            {
                O = _a;

                s = this.stack_list[O];

                while ((s.amount ?? 0) > (s.max_amount ?? 0))
                {
                    Lang13.Call(s.type, this.loc, s.max_amount);
                    s.use(s.max_amount);
                }
                s.loc   = this.loc;
                s.layer = Convert.ToDouble(Lang13.Initial(s, "layer"));
            }
            return;
        }
Ejemplo n.º 4
0
        // Function from file: autolathe.dm
        public override dynamic Topic(string href = null, ByTable href_list = null, dynamic hsrc = null)
        {
            Ent_Static     T               = null;
            double?        multiplier      = null;
            int            max_multiplier  = 0;
            dynamic        is_stack        = null;
            double         coeff           = 0;
            dynamic        metal_cost      = null;
            dynamic        glass_cost      = null;
            double         power           = 0;
            ByTable        materials_used  = null;
            dynamic        N               = null;
            Obj_Item_Stack S               = null;
            ByTable        materials_used2 = null;
            dynamic        new_item        = null;
            dynamic        v               = null;
            dynamic        D               = null;


            if (Lang13.Bool(base.Topic(href, href_list, (object)(hsrc))))
            {
                return(null);
            }

            if (!this.busy)
            {
                if (Lang13.Bool(href_list["menu"]))
                {
                    this.screen = String13.ParseNumber(href_list["menu"]);
                }

                if (Lang13.Bool(href_list["category"]))
                {
                    this.selected_category = href_list["category"];
                }

                if (Lang13.Bool(href_list["make"]))
                {
                    T = this.loc;
                    this.being_built = this.files.FindDesignByID(href_list["make"]);

                    if (!(this.being_built != null))
                    {
                        return(null);
                    }
                    multiplier     = String13.ParseNumber(href_list["multiplier"]);
                    max_multiplier = Num13.MinInt(this.being_built.maxstack, ((int)((Lang13.Bool(this.being_built.materials["$metal"]) ? Num13.Floor((this.materials.amount("$metal") ?1:0) / Convert.ToDouble(this.being_built.materials["$metal"])) : Double.PositiveInfinity))), ((int)((Lang13.Bool(this.being_built.materials["$glass"]) ? Num13.Floor((this.materials.amount("$glass") ?1:0) / Convert.ToDouble(this.being_built.materials["$glass"])) : Double.PositiveInfinity))));
                    is_stack       = this.being_built.build_path.IsSubclassOf(typeof(Obj_Item_Stack));

                    if (!Lang13.Bool(is_stack) && (multiplier ?? 0) > 1)
                    {
                        return(null);
                    }

                    if (!new ByTable(new object [] { 1, 10, 25, max_multiplier }).Contains(multiplier))
                    {
                        return(null);
                    }
                    coeff      = (Lang13.Bool(is_stack) ? 1 : Math.Pow(2, this.prod_coeff));
                    metal_cost = this.being_built.materials["$metal"];
                    glass_cost = this.being_built.materials["$glass"];
                    power      = Num13.MaxInt(2000, Convert.ToInt32((metal_cost + glass_cost) * multiplier / 5));

                    if ((this.materials.amount("$metal") ?1:0) >= Convert.ToDouble(metal_cost * multiplier / coeff) && (this.materials.amount("$glass") ?1:0) >= Convert.ToDouble(glass_cost * multiplier / coeff))
                    {
                        this.busy = true;
                        this.f_use_power(power);
                        this.icon_state = "autolathe";
                        Icon13.Flick("autolathe_n", this);
                        Task13.Schedule(((int)(32 / coeff)), (Task13.Closure)(() => {
                            this.f_use_power(power);

                            if (Lang13.Bool(is_stack))
                            {
                                materials_used = new ByTable().Set("$metal", metal_cost * multiplier).Set("$glass", glass_cost * multiplier);
                                this.materials.use_amount(materials_used);
                                N = Lang13.Call(this.being_built.build_path, T, multiplier);
                                N.update_icon();
                                ((Obj_Item)N).autolathe_crafted(this);

                                foreach (dynamic _a in Lang13.Enumerate(T.contents - N, typeof(Obj_Item_Stack)))
                                {
                                    S = _a;


                                    if (Lang13.Bool(((dynamic)N.merge_type).IsInstanceOfType(S)))
                                    {
                                        N.merge(S);
                                    }
                                }
                            }
                            else
                            {
                                materials_used2 = new ByTable().Set("$metal", metal_cost / coeff).Set("$glass", glass_cost / coeff);
                                this.materials.use_amount(materials_used2);
                                new_item           = Lang13.Call(this.being_built.build_path, T);
                                new_item.materials = materials_used2.Copy();
                                ((Obj_Item)new_item).autolathe_crafted(this);
                            }
                            this.busy = false;
                            this.updateUsrDialog();
                            return;
                        }));
                    }
                }

                if (Lang13.Bool(href_list["search"]))
                {
                    this.matching_designs.Cut();

                    foreach (dynamic _b in Lang13.Enumerate(this.files.known_designs))
                    {
                        v = _b;

                        D = this.files.known_designs[v];

                        if (String13.FindIgnoreCase(D.name, href_list["to_search"], 1, 0) != 0)
                        {
                            this.matching_designs.Add(D);
                        }
                    }
                }
            }
            else
            {
                Task13.User.WriteMsg("<span class=\"alert\">The autolathe is busy. Please wait for completion of previous operation.</span>");
            }
            this.updateUsrDialog();
            return(null);
        }