Ejemplo n.º 1
0
        // Function from file: air.dm
        public void setup_allturfs(double?z_level = null)
        {
            double?        z_start       = null;
            double?        z_finish      = null;
            ByTable        turfs_to_init = null;
            Tile_Simulated T             = null;
            dynamic        tile          = null;
            dynamic        enemy_tile    = null;
            GasMixture     enemy_air     = null;
            dynamic        is_active     = null;
            Tile_Simulated T2            = null;

            z_start  = 1;
            z_finish = Game13.map_size_z;

            if (1 <= (z_level ?? 0) && (z_level ?? 0) <= Game13.map_size_z)
            {
                z_level  = Num13.Floor(z_level ?? 0);
                z_start  = z_level;
                z_finish = z_level;
            }
            turfs_to_init = Map13.FetchInBlock(Map13.GetTile(1, 1, ((int)(z_start ?? 0))), Map13.GetTile(Game13.map_size_x, Game13.map_size_y, ((int)(z_finish ?? 0))));

            foreach (dynamic _b in Lang13.Enumerate(turfs_to_init, typeof(Tile_Simulated)))
            {
                T = _b;

                T.CalculateAdjacentTurfs();
                T.excited = false;
                this.active_turfs.Remove(T);

                if (T.blocks_air)
                {
                    continue;
                }
                T.update_visuals();

                foreach (dynamic _a in Lang13.Enumerate(T.atmos_adjacent_turfs))
                {
                    tile = _a;

                    enemy_tile = tile;
                    enemy_air  = ((Ent_Static)enemy_tile).return_air();
                    is_active  = T.air.compare(enemy_air);

                    if (Lang13.Bool(is_active))
                    {
                        GlobalFuncs.testing("Active turf found. Return value of compare(): " + is_active);
                        T.excited = true;
                        this.active_turfs.Or(T);
                        break;
                    }
                }
            }

            if (this.active_turfs.len != 0)
            {
                GlobalFuncs.warning("There are " + this.active_turfs.len + " active turfs at roundstart, this is a mapping error caused by a difference of the air between the adjacent turfs. You can see its coordinates using \"Mapping -> Show roundstart AT list\" verb (debug verbs required)");

                foreach (dynamic _c in Lang13.Enumerate(this.active_turfs, typeof(Tile_Simulated)))
                {
                    T2 = _c;

                    GlobalVars.active_turfs_startlist.Add("" + T2.x + ", " + T2.y + ", " + T2.z + "\n");
                }
            }
            return;
        }
Ejemplo n.º 2
0
        // Function from file: area_copy.dm
        public dynamic copy_contents_to(dynamic A = null, bool?platingRequired = null, bool?nerf_weapons = null)
        {
            platingRequired = platingRequired ?? false;
            nerf_weapons    = nerf_weapons ?? false;

            ByTable        turfs_src       = null;
            ByTable        turfs_trg       = null;
            int            src_min_x       = 0;
            int            src_min_y       = 0;
            ByTable        refined_src     = null;
            dynamic        T               = null;
            dynamic        T2              = null;
            int            trg_min_x       = 0;
            int            trg_min_y       = 0;
            ByTable        refined_trg     = null;
            dynamic        T3              = null;
            dynamic        T4              = null;
            ByTable        toupdate        = null;
            ByTable        copiedobjs      = null;
            Tile_Simulated T5              = null;
            dynamic        coordstring     = null;
            dynamic        B               = null;
            int            old_dir1        = 0;
            string         old_icon_state1 = null;
            string         old_icon1       = null;
            dynamic        X               = null;
            Obj            O               = null;
            dynamic        O2              = null;
            dynamic        M               = null;
            dynamic        SM              = null;
            dynamic        V               = null;
            Tile_Simulated T1              = null;


            if (!Lang13.Bool(A) || !(this != null))
            {
                return(0);
            }
            turfs_src   = GlobalFuncs.get_area_turfs(this.type);
            turfs_trg   = GlobalFuncs.get_area_turfs(A.type);
            src_min_x   = 99999;
            src_min_y   = 99999;
            refined_src = new ByTable();

            foreach (dynamic _a in Lang13.Enumerate(turfs_src))
            {
                T = _a;

                src_min_x = Num13.MinInt(src_min_x, Convert.ToInt32(T.x));
                src_min_y = Num13.MinInt(src_min_y, Convert.ToInt32(T.y));
            }

            foreach (dynamic _b in Lang13.Enumerate(turfs_src))
            {
                T2 = _b;

                refined_src[T2] = "" + (T2.x - src_min_x) + "." + (T2.y - src_min_y);
            }
            trg_min_x   = 99999;
            trg_min_y   = 99999;
            refined_trg = new ByTable();

            foreach (dynamic _c in Lang13.Enumerate(turfs_trg))
            {
                T3 = _c;

                trg_min_x = Num13.MinInt(trg_min_x, Convert.ToInt32(T3.x));
                trg_min_y = Num13.MinInt(trg_min_y, Convert.ToInt32(T3.y));
            }

            foreach (dynamic _d in Lang13.Enumerate(turfs_trg))
            {
                T4 = _d;

                refined_trg["" + (T4.x - trg_min_x) + "." + (T4.y - trg_min_y)] = T4;
            }
            toupdate   = new ByTable();
            copiedobjs = new ByTable();

            foreach (dynamic _h in Lang13.Enumerate(refined_src, typeof(Tile_Simulated)))
            {
                T5 = _h;

                coordstring = refined_src[T5];
                B           = refined_trg[coordstring];

                if (!(B is Tile))
                {
                    continue;
                }

                if (platingRequired == true)
                {
                    if (B is Tile_Space)
                    {
                        continue;
                    }
                }
                old_dir1        = T5.dir;
                old_icon_state1 = T5.icon_state;
                old_icon1       = T5.icon;
                X            = Lang13.Call(T5.type, B);
                X.dir        = old_dir1;
                X.icon       = old_icon1;
                X.icon_state = old_icon_state1;

                foreach (dynamic _e in Lang13.Enumerate(T5, typeof(Obj)))
                {
                    O = _e;

                    O2 = GlobalFuncs.DuplicateObject(O, true, null, X, nerf_weapons);

                    if (!Lang13.Bool(O2))
                    {
                        continue;
                    }
                    copiedobjs.Add(((Ent_Static)O2).GetAllContents());
                }

                foreach (dynamic _f in Lang13.Enumerate(T5))
                {
                    M = _f;


                    if (M is Mob_Camera)
                    {
                        continue;
                    }
                    SM = GlobalFuncs.DuplicateObject(M, true, null, X);
                    copiedobjs.Add(((Ent_Static)SM).GetAllContents());
                }

                foreach (dynamic _g in Lang13.Enumerate(T5.vars - GlobalVars.forbidden_vars))
                {
                    V = _g;


                    if (V == "air")
                    {
                        X.air.copy_from(T5.air);
                        continue;
                    }
                    X.vars[V] = T5.vars[V];
                }
                toupdate.Add(X);
            }

            if (toupdate.len != 0)
            {
                foreach (dynamic _i in Lang13.Enumerate(toupdate, typeof(Tile_Simulated)))
                {
                    T1 = _i;

                    T1.CalculateAdjacentTurfs();
                    GlobalVars.SSair.add_to_active(T1, true);
                }
            }
            return(copiedobjs);
        }