예제 #1
0
파일: Swapmap.cs 프로젝트: Somnium13/SS13
        // Function from file: swapmaps.dm
        public void CutXYZ(  )
        {
            int     mx = 0;
            int     my = 0;
            int     mz = 0;
            Swapmap M  = null;

            mx = GlobalVars.swapmaps_compiled_maxx;
            my = GlobalVars.swapmaps_compiled_maxy;
            mz = GlobalVars.swapmaps_compiled_maxz;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.swapmaps_loaded, typeof(Swapmap)))
            {
                M = _a;

                mx = Num13.MaxInt(mx, M.x2);
                my = Num13.MaxInt(my, M.y2);
                mz = Num13.MaxInt(mz, M.z2 ?? 0);
            }
            Game13.map_size_x = mx;
            Game13.map_size_y = my;
            Game13.map_size_z = mz;
            return;
        }
예제 #2
0
파일: Swapmap.cs 프로젝트: Somnium13/SS13
        // Function from file: swapmaps.dm
        public ByTable ConsiderRegion(int X1 = 0, int Y1 = 0, int X2 = 0, int Y2 = 0, int?Z1 = null, int?Z2 = null)
        {
            ByTable _default = null;

            int     nextz = 0;
            Swapmap M     = null;
            int?    nz2   = null;


            while (true)
            {
                nextz = 0;

                foreach (dynamic _a in Lang13.Enumerate(GlobalVars.swapmaps_loaded, typeof(Swapmap)))
                {
                    M = _a;


                    if ((M.z2 ?? 0) < (Z1 ?? 0) || Lang13.Bool(Z2) && (M.z1 ?? 0) > (Z2 ?? 0) || (M.z1 ?? 0) >= (Z1 ?? 0) + (this.z2 ?? 0) || M.x1 > X2 || M.x2 < X1 || M.x1 >= X1 + this.x2 || M.y1 > Y2 || M.y2 < Y1 || M.y1 >= Y1 + this.y2)
                    {
                        continue;
                    }
                    nz2 = (Lang13.Bool(Z2) ? Z2 : (Z1 ?? 0) + (this.z2 ?? 0) - 1 + (M.z2 ?? 0) - (M.z1 ?? 0));

                    if (M.x1 >= X1 + this.x2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, M.x1 - 1, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.x2 <= X2 - this.x2)
                    {
                        _default = this.ConsiderRegion(M.x2 + 1, Y1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }

                    if (M.y1 >= Y1 + this.y2)
                    {
                        _default = this.ConsiderRegion(X1, Y1, X2, M.y1 - 1, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    else if (M.y2 <= Y2 - this.y2)
                    {
                        _default = this.ConsiderRegion(X1, M.y2 + 1, X2, Y2, Z1, nz2);

                        if (_default != null)
                        {
                            return(_default);
                        }
                    }
                    nextz = (nextz != 0 ? Num13.MinInt(nextz, (M.z2 ?? 0) + 1) : (M.z2 ?? 0) + 1);
                }

                if (!(M != null))
                {
                    if (nextz != 0)
                    {
                        Z1 = nextz;
                    }

                    if (!(nextz != 0) || Lang13.Bool(Z2) && (Z2 ?? 0) - (Z1 ?? 0) + 1 < (this.z2 ?? 0))
                    {
                        return(!Lang13.Bool(Z2) || (Z2 ?? 0) - (Z1 ?? 0) + 1 >= (this.z2 ?? 0) ? new ByTable(new object [] { X1, Y1, Z1 }) : null);
                    }
                    X1 = 1;
                    X2 = Game13.map_size_x;
                    Y1 = 1;
                    Y2 = Game13.map_size_y;
                }
            }
            return(_default);
        }