Exemplo n.º 1
0
        void Init(string n, ushort x, ushort y, ushort z)
        {
            Width  = x;
            Height = y;
            Length = z;
            if (Width < 16)
            {
                Width = 16;
            }
            if (Height < 16)
            {
                Height = 16;
            }
            if (Length < 16)
            {
                Length = 16;
            }

            #pragma warning disable 0612
            width  = Width;
            length = Height;
            height = Length; depth = Length;
            #pragma warning restore 0612

            CustomBlockDefs = new BlockDefinition[256];
            for (int i = 0; i < CustomBlockDefs.Length; i++)
            {
                CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i];
            }
            CustomBlockProps = new BlockProps[256];
            for (int i = 0; i < CustomBlockProps.Length; i++)
            {
                CustomBlockProps[i] = BlockDefinition.GlobalProps[i];
            }

            name         = n;
            BlockDB      = new BlockDB(this);
            EdgeLevel    = (short)(y / 2);
            CloudsHeight = (short)(y + 2);

            blocks       = new byte[Width * Height * Length];
            ChunksX      = (Width + 15) >> 4;
            ChunksY      = (Height + 15) >> 4;
            ChunksZ      = (Length + 15) >> 4;
            CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][];

            spawnx = (ushort)(Width / 2);
            spawny = (ushort)(Height * 0.75f);
            spawnz = (ushort)(Length / 2);
            rotx   = 0; roty = 0;

            ZoneList         = new List <Zone>();
            VisitAccess      = new LevelAccessController(this, true);
            BuildAccess      = new LevelAccessController(this, false);
            listCheckExists  = new SparseBitSet(Width, Height, Length);
            listUpdateExists = new SparseBitSet(Width, Height, Length);
        }
Exemplo n.º 2
0
        internal void Init(string name, ushort width, ushort height, ushort length)
        {
            if (width < 1)
            {
                width = 1;
            }
            if (height < 1)
            {
                height = 1;
            }
            if (length < 1)
            {
                length = 1;
            }
            Width = width; Height = height; Length = length;

            for (int i = 0; i < CustomBlockDefs.Length; i++)
            {
                CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i];
            }
            if (blocks == null)
            {
                blocks = new byte[width * height * length];
            }

            LoadDefaultProps();
            for (int i = 0; i < blockAABBs.Length; i++)
            {
                blockAABBs[i] = Block.BlockAABB((ushort)i, this);
            }
            UpdateAllBlockHandlers();

            this.name = name; MapName = name.ToLower();
            BlockDB   = new BlockDB(this);

            ChunksX = Utils.CeilDiv16(width);
            ChunksY = Utils.CeilDiv16(height);
            ChunksZ = Utils.CeilDiv16(length);
            if (CustomBlocks == null)
            {
                CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][];
            }

            spawnx = (ushort)(width / 2);
            spawny = (ushort)(height * 0.75f);
            spawnz = (ushort)(length / 2);
            rotx   = 0; roty = 0;

            VisitAccess      = new LevelAccessController(Config, name, true);
            BuildAccess      = new LevelAccessController(Config, name, false);
            listCheckExists  = new SparseBitSet(width, height, length);
            listUpdateExists = new SparseBitSet(width, height, length);
        }
Exemplo n.º 3
0
        public Level(string name, ushort width, ushort height, ushort length)
        {
            if (width < 1)
            {
                width = 1;
            }
            if (height < 1)
            {
                height = 1;
            }
            if (length < 1)
            {
                length = 1;
            }

            Width = width; Height = height; Length = length;
            for (int i = 0; i < CustomBlockDefs.Length; i++)
            {
                CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i];
            }

            LoadCoreProps();
            for (int i = 0; i < blockAABBs.Length; i++)
            {
                ExtBlock block = ExtBlock.FromIndex(i);
                blockAABBs[i] = Block.BlockAABB(block, this);
            }
            UpdateBlockHandlers();

            this.name           = name; MapName = name.ToLower();
            BlockDB             = new BlockDB(this);
            Config.EdgeLevel    = (short)(height / 2);
            Config.CloudsHeight = (short)(height + 2);

            blocks       = new byte[Width * Height * Length];
            ChunksX      = Utils.CeilDiv16(Width);
            ChunksY      = Utils.CeilDiv16(Height);
            ChunksZ      = Utils.CeilDiv16(Length);
            CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][];

            spawnx = (ushort)(Width / 2);
            spawny = (ushort)(Height * 0.75f);
            spawnz = (ushort)(Length / 2);
            rotx   = 0; roty = 0;

            VisitAccess      = new LevelAccessController(this, true);
            BuildAccess      = new LevelAccessController(this, false);
            listCheckExists  = new SparseBitSet(Width, Height, Length);
            listUpdateExists = new SparseBitSet(Width, Height, Length);
        }
Exemplo n.º 4
0
        void Init(string n, ushort x, ushort y, ushort z)
        {
            //onLevelSave += null;
            Width  = x;
            Height = y;
            Length = z;
            if (Width < 16)
            {
                Width = 16;
            }
            if (Height < 16)
            {
                Height = 16;
            }
            if (Length < 16)
            {
                Length = 16;
            }
            width  = Width;
            length = Height;
            height = Length; depth = Length;

            CustomBlockDefs = new BlockDefinition[256];
            for (int i = 0; i < CustomBlockDefs.Length; i++)
            {
                CustomBlockDefs[i] = BlockDefinition.GlobalDefs[i];
            }
            name         = n;
            EdgeLevel    = (short)(y / 2);
            CloudsHeight = (short)(y + 2);
            blocks       = new byte[Width * Height * Length];
            ChunksX      = (Width + 15) >> 4;
            ChunksY      = (Height + 15) >> 4;
            ChunksZ      = (Length + 15) >> 4;
            CustomBlocks = new byte[ChunksX * ChunksY * ChunksZ][];
            ZoneList     = new List <Zone>();

            spawnx           = (ushort)(Width / 2);
            spawny           = (ushort)(Height * 0.75f);
            spawnz           = (ushort)(Length / 2);
            rotx             = 0;
            roty             = 0;
            listCheckExists  = new SparseBitSet(Width, Height, Length);
            listUpdateExists = new SparseBitSet(Width, Height, Length);
        }