// Function from file: microwave.dm
        public override void RefreshParts(  )
        {
            dynamic E         = null;
            dynamic max_items = null;
            Obj_Item_Weapon_StockParts_MicroLaser M  = null;
            Obj_Item_Weapon_StockParts_MatterBin  M2 = null;

            max_items = 10;

            foreach (dynamic _a in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_StockParts_MicroLaser)))
            {
                M = _a;

                E += M.rating;
            }

            foreach (dynamic _b in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_StockParts_MatterBin)))
            {
                M2 = _b;

                max_items = M2.rating * 10;
            }
            this.efficiency     = Lang13.BoolNullable(E);
            this.max_n_of_items = max_items;
            return;
        }
Example #2
0
        // Function from file: tgstation.dme
        public void place_poster(dynamic P = null, dynamic user = null)
        {
            int stuff_on_wall           = 0;
            Obj O                       = null;
            Obj_Structure_Sign_Poster D = null;
            Ent_Static temp_loc         = null;


            if (!(P.resulting_poster != null))
            {
                return;
            }
            stuff_on_wall = 0;

            foreach (dynamic _a in Lang13.Enumerate(this.contents, typeof(Obj)))
            {
                O = _a;


                if (O is Obj_Structure_Sign_Poster)
                {
                    user.WriteMsg("<span class='warning'>The wall is far too cluttered to place a poster!</span>");
                    return;
                }
                stuff_on_wall++;

                if (stuff_on_wall == 3)
                {
                    user.WriteMsg("<span class='warning'>The wall is far too cluttered to place a poster!</span>");
                    return;
                }
            }
            user.WriteMsg("<span class='notice'>You start placing the poster on the wall...</span>");
            D        = P.resulting_poster;
            temp_loc = user.loc;
            Icon13.Flick("poster_being_set", D);
            D.loc      = this;
            D.official = Lang13.BoolNullable(P.official);
            GlobalFuncs.qdel(P);
            GlobalFuncs.playsound(D.loc, "sound/items/poster_being_created.ogg", 100, 1);

            if (GlobalFuncs.do_after(user, D.placespeed, null, this))
            {
                if (!(D != null))
                {
                    return;
                }

                if (this is Tile_Simulated_Wall && Lang13.Bool(user) && user.loc == temp_loc)
                {
                    user.WriteMsg("<span class='notice'>You place the poster!</span>");
                }
                else
                {
                    D.roll_and_drop(temp_loc, D.official);
                }
                return;
            }
            return;
        }
Example #3
0
        // Function from file: vending.dm
        public void build_inventory(ByTable productlist = null, bool?hidden = null, bool?req_coin = null, bool?start_empty = null)
        {
            hidden   = hidden ?? false;
            req_coin = req_coin ?? false;

            dynamic             typepath = null;
            bool?               amount   = null;
            dynamic             temp     = null;
            Data_VendingProduct R        = null;


            foreach (dynamic _a in Lang13.Enumerate(productlist))
            {
                typepath = _a;

                amount = Lang13.BoolNullable(productlist[typepath]);

                if (amount == null)
                {
                    amount = false;
                }
                temp           = Lang13.Call(typepath, null);
                R              = new Data_VendingProduct();
                R.product_name = Lang13.Initial(temp, "name");
                R.product_path = typepath;

                if (!(start_empty == true))
                {
                    R.amount = Lang13.IntNullable(amount);
                }
                R.max_amount    = amount;
                R.display_color = Rand13.Pick(new object [] { "red", "blue", "green" });

                if (hidden == true)
                {
                    this.hidden_records.Add(R);
                }
                else if (req_coin == true)
                {
                    this.coin_records.Add(R);
                }
                else
                {
                    this.product_records.Add(R);
                }
            }
            return;
        }
Example #4
0
        // Function from file: dbcore.dm
        public bool Connect(string dbi_handler = null, string user_handler = null, string password_handler = null, bool?cursor_handler = null)
        {
            dbi_handler      = dbi_handler ?? this.dbi;
            user_handler     = user_handler ?? this.user;
            password_handler = password_handler ?? this.password;


            if (!GlobalVars.config.sql_enabled)
            {
                return(false);
            }

            if (!(this != null))
            {
                return(false);
            }
            cursor_handler = Lang13.BoolNullable(this.default_cursor);

            if (!(cursor_handler == true))
            {
                cursor_handler = false;
            }
            return(DB13.connect(this._db_con, dbi_handler, user_handler, password_handler, cursor_handler, null));
        }
Example #5
0
        // Function from file: photography.dm
        public Icon camera_get_icon(ByTable turfs = null, dynamic center = null)
        {
            ByTable     atoms  = null;
            dynamic     T      = null;
            Ent_Dynamic A      = null;
            Ent_Dynamic O      = null;
            ByTable     sorted = null;
            int?        j      = null;
            double      i      = 0;
            dynamic     c      = null;
            dynamic     c2     = null;
            Icon        res    = null;
            Ent_Static  A2     = null;
            Icon        img    = null;
            double?     offX   = null;
            double?     offY   = null;
            dynamic     T2     = null;

            atoms = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(turfs))
            {
                T = _b;

                atoms.Add(T);

                foreach (dynamic _a in Lang13.Enumerate(T, typeof(Ent_Dynamic)))
                {
                    A = _a;


                    if (A.invisibility != 0)
                    {
                        if (this.see_ghosts)
                        {
                            if (A is Mob_Dead_Observer)
                            {
                                O = A;

                                if (Lang13.Bool(O.orbiting))
                                {
                                    continue;
                                }
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    atoms.Add(A);
                }
            }
            sorted = new ByTable();
            j      = null;

            foreach (dynamic _c in Lang13.IterateRange(1, atoms.len))
            {
                i = _c;

                c = atoms[i];
                j = sorted.len;

                while ((j ?? 0) > 0)
                {
                    c2 = sorted[j];

                    if (Convert.ToDouble(c2.layer) <= Convert.ToDouble(c.layer))
                    {
                        break;
                    }
                    j--;
                }
                sorted.Insert((j ?? 0) + 1, c);
            }
            res = new Icon("icons/effects/96x96.dmi", "");

            foreach (dynamic _d in Lang13.Enumerate(sorted, typeof(Ent_Static)))
            {
                A2 = _d;

                img = GlobalFuncs.getFlatIcon(A2);

                if (A2 is Mob_Living && Lang13.Bool(((dynamic)A2).lying))
                {
                    img.Turn(((dynamic)A2).lying);
                }
                offX = (A2.x - Convert.ToDouble(center.x)) * 32 + A2.pixel_x + 33;
                offY = (A2.y - Convert.ToDouble(center.y)) * 32 + A2.pixel_y + 33;

                if (A2 is Ent_Dynamic)
                {
                    offX += Convert.ToDouble(((dynamic)A2).step_x);
                    offY += Convert.ToDouble(((dynamic)A2).step_y);
                }
                res.Blend(img, GlobalFuncs.blendMode2iconMode(Lang13.BoolNullable(A2.blend_mode)), offX, offY);

                if (A2 is Obj_Item_Areaeditor_Blueprints)
                {
                    this.blueprints = true;
                }
            }

            foreach (dynamic _e in Lang13.Enumerate(turfs))
            {
                T2 = _e;

                res.Blend(GlobalFuncs.getFlatIcon(T2.loc), GlobalFuncs.blendMode2iconMode(Lang13.BoolNullable(T2.blend_mode)), Lang13.DoubleNullable((T2.x - center.x) * 32 + 33), Lang13.DoubleNullable((T2.y - center.y) * 32 + 33));
            }
            return(res);
        }