Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        // Function from file: photography.dm
        public void captureimage(dynamic target = null, dynamic user = null, bool?flag = null)
        {
            string  mobs  = null;
            bool    isAi  = false;
            ByTable seen  = null;
            ByTable turfs = null;
            dynamic T     = null;
            Icon    temp  = null;

            mobs = "";
            isAi = user is Mob_Living_Silicon_Ai;

            if (!isAi)
            {
                if (Lang13.Bool(user.client))
                {
                    seen = GlobalFuncs.get_hear(Game13.view, user.client.eye);
                }
                else
                {
                    seen = GlobalFuncs.get_hear(Game13.view, user);
                }
            }
            else
            {
                seen = GlobalFuncs.get_hear(Game13.view, target);
            }
            turfs = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRange(target, 1)))
            {
                T = _a;


                if (seen.Contains(T))
                {
                    if (isAi && !GlobalVars.cameranet.checkTurfVis(T))
                    {
                        continue;
                    }
                    else
                    {
                        turfs.Add(T);
                        mobs += this.camera_get_mobs(T);
                    }
                }
            }
            temp = new Icon("icons/effects/96x96.dmi", "");
            temp.Blend("#000", 3);
            temp.Blend(this.camera_get_icon(turfs, target), 3);

            if (!(user is Mob_Living_Silicon))
            {
                this.printpicture(user, temp, mobs, flag);
            }
            else
            {
                this.aipicture(user, temp, mobs, isAi);
            }
            return;
        }