示例#1
0
        public bool FixEntities(int blockID = -1)
        {
            if (selectionPrefab == null)
            {
                if (Copy() < 1)
                {
                    Log.Out("Could not Copy Selection");
                    return(false);
                }
            }

            int width  = selectionPrefab.size.x;
            int height = selectionPrefab.size.y;
            int length = selectionPrefab.size.z;

            int startX, startY, startZ;

            if (start.x < end.x)
            {
                startX = start.x;
            }
            else
            {
                startX = end.x;
            }

            if (start.y < end.y)
            {
                startY = start.y;
            }
            else
            {
                startY = end.y;
            }

            if (start.z < end.z)
            {
                startZ = start.z;
            }
            else
            {
                startZ = end.z;
            }

            Dictionary <int, BlockValue> blockList = new Dictionary <int, BlockValue> ();

            for (int xOffset = -1; xOffset < width + 2; xOffset++)
            {
                for (int zOffset = -1; zOffset < length + 2; zOffset++)
                {
                    for (int yOffset = -1; yOffset < height + 2; yOffset++)
                    {
                        BlockValue bv = GameManager.Instance.World.GetBlock(startX + xOffset, startY + yOffset, startZ + zOffset);
                        if (bv.type != BlockValue.Air.type)
                        {
                            if (!blockList.ContainsKey(bv.type))
                            {
                                blockList [bv.type] = bv;
                            }

                            if (bv.type == blockID || bv.type == 1455 || bv.type == 588 || bv.type == 579)
                            {
                                BlockUtils.SetBlock(startX + xOffset, startY + yOffset, startZ + zOffset, "air");
                            }
                        }
                    }
                }
            }

            foreach (int blockType in blockList.Keys)
            {
                SdtdConsole.Instance.Output(blockType.ToString() + " - " + Block.list [blockType].GetBlockName());
            }

            return(true);
        }