public static void MakeBed(int x1, int x2, int y, int z1, int z2, int intMirror)
        {
            int intBedOrientation;

            if (x1 == x2 - 1)
            {
                intBedOrientation = (int)BedOrientation.NORTH;
            }
            else if (x1 == x2 + 1)
            {
                intBedOrientation = (int)BedOrientation.SOUTH;
            }
            else if (z1 == z2 - 1)
            {
                intBedOrientation = (int)BedOrientation.EAST;
            }
            else
            {
                intBedOrientation = (int)BedOrientation.WEST;
            }
            BlockShapes.MakeBlock(x1, y, z1, BlockType.BED, (int)BedState.HEAD + intBedOrientation);
            BlockShapes.MakeBlock(x2, y, z2, BlockType.BED, intBedOrientation);
            if (intMirror > 0)
            {
                MakeBed(_intMapSize - x1, _intMapSize - x2, y, z1, z2, 0);
                MakeBed(x1, x2, y, _intMapSize - z1, _intMapSize - z2, 0);
                MakeBed(_intMapSize - x1, _intMapSize - x2, y, _intMapSize - z1, _intMapSize - z2, 0);
                if (intMirror == 2)
                {
                    MakeBed(z1, z2, y, x1, x2, 1);
                }
            }
        }
Beispiel #2
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, Buildings.structPoint spMineshaftEntrance, frmMace frmLogForm)
        {
            _intBlockStartBuildings = City.EdgeLength + 13;
            int intMineshaftSize = (1 + City.MapLength) - (_intBlockStartBuildings * 2);

            if (intMineshaftSize % 5 > 0)
            {
                intMineshaftSize += 5 - (intMineshaftSize % 5);
            }
            _intBlockStartBuildings -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                if (Utils.ValueFromXMLElement(Path.Combine("Resources", "Mineshaft.xml"), "active", "level" + intLevel.ToString()).IsAffirmative())
                {
                    MakeLevel(world, bm, intLevel, intMineshaftSize, spMineshaftEntrance, frmLogForm);
                }
            }
            int intBlockToReplace = bm.GetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1);

            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x,
                                     3, 63, spMineshaftEntrance.z + 1, spMineshaftEntrance.z + 1, BlockInfo.Wood.ID, 0);
            BlockHelper.MakeLadder(spMineshaftEntrance.x, 4, 63, spMineshaftEntrance.z, 0, BlockInfo.Wood.ID);
            BlockShapes.MakeSolidBox(spMineshaftEntrance.x, spMineshaftEntrance.x, 3, 63, spMineshaftEntrance.z + 1,
                                     spMineshaftEntrance.z + 1, BlockInfo.Stone.ID, 0);
            bm.SetID(spMineshaftEntrance.x, 63, spMineshaftEntrance.z + 1, intBlockToReplace);
        }
Beispiel #3
0
 private static void MakePark(BlockManager bm, int x, int z)
 {
     BlockShapes.MakeSolidBox(x + 4, x + 6, 63, 63, z + 4, z + 6, (int)BlockType.STATIONARY_WATER);
     for (int a = x + 1; a <= x + 7; a += 6)
     {
         for (int b = z + 1; b <= z + 7; b += 6)
         {
             bm.SetID(a + 1, 64, b + 1, (int)BlockType.SAPLING);
             bm.SetData(a + 1, 64, b + 1, 15);
         }
     }
     for (int x1 = x + 1; x1 <= x + 9; x1++)
     {
         for (int z1 = z + 1; z1 <= z + 9; z1++)
         {
             if (bm.GetID(x1, 64, z1) != (int)BlockType.SAPLING &&
                 bm.GetID(x1, 63, z1) != (int)BlockType.STATIONARY_WATER)
             {
                 int intRand = rand.Next(100);
                 if (intRand > 55)
                 {
                     bm.SetID(x1, 64, z1, (int)BlockType.YELLOW_FLOWER);
                 }
                 else if (intRand > 20)
                 {
                     bm.SetID(x1, 64, z1, (int)BlockType.RED_ROSE);
                 }
             }
         }
     }
 }
Beispiel #4
0
        private static void MakeSewerEntrance(BlockManager bm, int x, int z, int intPlotSize)
        {
            // path
            BlockShapes.MakeHollowLayers(x, x + 8, 63, 63, z, z + intPlotSize, (int)BlockType.DOUBLE_SLAB);
            // building
            BlockShapes.MakeHollowBox(x + 2, x + 6, 63, 67, z + 2, z + 6, (int)BlockType.STONE);
            // doorway
            BlockShapes.MakeSolidBox(x + 4, x + 4, 64, 65, z + 2, z + 2, (int)BlockType.AIR);
            // tunnel down
            BlockShapes.MakeSolidBox(x + 4, x + 4, 55, 63, z + 4, z + 4, (int)BlockType.AIR);
            // ladder back
            BlockShapes.MakeSolidBox(x + 4, x + 4, 52, 55, z + 5, z + 5, (int)BlockType.STONE);
            // ladder rungs
            BlockHelper.MakeLadder(x + 4, 52, 63, z + 4);
            // hatch
            bm.SetID(x + 4, 64, z + 4, (int)BlockType.TRAPDOOR);
            bm.SetData(x + 4, 64, z + 4, 2);
            // chest with torches
            bm.SetID(x + 5, 64, z + 5, (int)BlockType.CHEST);
            TileEntityChest tec = new TileEntityChest();

            tec.Items[0] = BlockHelper.MakeItem((int)BlockType.REDSTONE_TORCH_ON, 64);
            tec.Items[1] = BlockHelper.MakeItem((int)BlockType.TORCH, 32);
            bm.SetTileEntity(x + 5, 64, z + 5, tec);
            // sign
            BlockHelper.MakeSign(x + 4, 66, z + 1, "Sewers||Currently|empty!", (int)BlockType.STONE);
        }
        public static void MakeBed(int x1, int x2, int y, int z1, int z2, int intMirror)
        {
            int intBedOrientation;

            if (x1 == x2 - 1)
            {
                intBedOrientation = (int)BedOrientation.NORTH;
            }
            else if (x1 == x2 + 1)
            {
                intBedOrientation = (int)BedOrientation.SOUTH;
            }
            else if (z1 == z2 - 1)
            {
                intBedOrientation = (int)BedOrientation.EAST;
            }
            else
            {
                intBedOrientation = (int)BedOrientation.WEST;
            }
            BlockShapes.MakeBlock(x1, y, z1, BlockInfo.Bed.ID, (int)BedState.HEAD + intBedOrientation);
            BlockShapes.MakeBlock(x2, y, z2, BlockInfo.Bed.ID, intBedOrientation);
            if (intMirror > 0)
            {
                MakeBed(City.MapLength - x1, City.MapLength - x2, y, z1, z2, 0);
                MakeBed(x1, x2, y, City.MapLength - z1, City.MapLength - z2, 0);
                MakeBed(City.MapLength - x1, City.MapLength - x2, y, City.MapLength - z1, City.MapLength - z2, 0);
                if (intMirror == 2)
                {
                    MakeBed(z1, z2, y, x1, x2, 1);
                }
            }
        }
 public static void MakeGuardTowers(BlockManager bm, int intFarmSize, int intMapSize, bool booIncludeWalls)
 {
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79,
                              intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80,
                               intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 59, 71,
                              intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81,
                                  intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockHelper.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 2);
     BlockHelper.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 2);
     // add cobwebs
     // todo: could probably use double-mirroring here
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, (int)BlockType.COBWEB, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, (int)BlockType.COBWEB, 1, 30);
     // add chests
     MakeGuardChest(bm, intFarmSize + 11, 72, intFarmSize + 11);
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intFarmSize + 11);
     MakeGuardChest(bm, intFarmSize + 11, 72, intMapSize - (intFarmSize + 11));
     MakeGuardChest(bm, intMapSize - (intFarmSize + 11), 72, intMapSize - (intFarmSize + 11));
     // add archery slots
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 73, 76,
                              intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 4, 75, 75,
                              intFarmSize + 7, intFarmSize + 9, (int)BlockType.AIR, 2);
     if (!booIncludeWalls)
     {
         BlockHelper.MakeLadder(intFarmSize + 13, 64, 71, intFarmSize + 8, 2);
     }
 }
Beispiel #7
0
 public static void MakeDrawbridges(BlockManager bm, int intFarmSize, int intMapSize,
                                    bool booIncludeMoat, bool booIncludeWalls)
 {
     if (booIncludeWalls)
     {
         // drawbridge
         int intBridgeEnd = booIncludeMoat ? -2 : 5;
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63,
                                  intFarmSize + intBridgeEnd, intFarmSize + 13, (int)BlockType.STONE, 2);
         // carve out the entrance/exit
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 64, 67,
                                  intFarmSize + 6, intFarmSize + 10, (int)BlockType.AIR, 2);
         // add the bottom of a portcullis
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 67, 67,
                                  intFarmSize + 6, intFarmSize + 6, (int)BlockType.FENCE, 2);
         // add room for murder holes
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, (intMapSize / 2) + 2, 69, 71,
                                  intFarmSize + 8, intFarmSize + 9, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 69, 72,
                                  intFarmSize + 8, intFarmSize + 9, (int)BlockType.AIR, 2);
         BlockHelper.MakeLadder(intMapSize / 2, 69, 72, intFarmSize + 9, 2, (int)BlockType.STONE);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 72, 72,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 2);
         // murder holes
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, (intMapSize / 2) - 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         BlockShapes.MakeSolidBox((intMapSize / 2) + 2, (intMapSize / 2) + 2, 68, 68,
                                  intFarmSize + 8, intFarmSize + 8, (int)BlockType.AIR, 2);
         // chests
         BlockShapes.MakeBlock((intMapSize / 2) - 4, 69, intFarmSize + 9, (int)BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) + 4, 69, intFarmSize + 9, (int)BlockType.GRAVEL, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) - 3, 70, intFarmSize + 9, (int)BlockType.AIR, 2, 100, -1);
         BlockShapes.MakeBlock((intMapSize / 2) + 3, 70, intFarmSize + 9, (int)BlockType.AIR, 2, 100, -1);
         TileEntityChest tec = new TileEntityChest();
         tec.Items[0] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         tec.Items[1] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         tec.Items[2] = BlockHelper.MakeItem(ItemInfo.LavaBucket.ID, 1);
         BlockHelper.MakeChest((intMapSize / 2) - 3, 69, intFarmSize + 9, (int)BlockType.GRAVEL, tec, 2);
         // add torches
         BlockHelper.MakeTorch((intMapSize / 2) - 1, 70, intFarmSize + 9, (int)BlockType.STONE, 2);
         BlockHelper.MakeTorch((intMapSize / 2) + 1, 70, intFarmSize + 9, (int)BlockType.STONE, 2);
         // link to main roads
         //BlockShapes.MakeSolidBox((intMapSize / 2) - 1, (intMapSize / 2) + 1, 63, 63,
         //                         intFarmSize + 11, intFarmSize + 13, (int)BlockType.DOUBLE_SLAB, 0);
     }
     else if (booIncludeMoat)
     {
         BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63,
                                  intFarmSize - 2, intFarmSize + 6, (int)BlockType.STONE, 2);
     }
 }
Beispiel #8
0
 private static void MakeStreetLights(BlockManager bm, int intMapSize, int intFarmSize)
 {
     for (int a = intMapSize / 2; a >= intFarmSize + 16; a -= 8)
     {
         BlockShapes.MakeSolidBox(a, a, 64, 66, intMapSize / 2, intMapSize / 2, (int)BlockType.FENCE, 2);
         BlockShapes.MakeBlock(a, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a - 1, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a + 1, 67, intMapSize / 2, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a, 67, (intMapSize / 2) - 1, (int)BlockType.WOOD_PLANK, 2);
         BlockHelper.MakeTorch(a, 67, (intMapSize / 2) + 1, (int)BlockType.WOOD_PLANK, 2);
     }
 }
Beispiel #9
0
        public static void ReplaceValuableBlocks(BetaWorld worldDest, BlockManager bm)
        {
            int intReplaced = 0;

            for (int x = 0; x < City.MapLength; x++)
            {
                for (int z = 0; z < City.MapLength; z++)
                {
                    for (int y = 32; y < 128; y++)
                    {
                        if (bm.GetID(x, y, z) != City.WallMaterialID ||
                            bm.GetData(x, y, z) != City.WallMaterialData)
                        {
#pragma warning disable
                            switch ((int)bm.GetID(x, y, z))
                            {
                            case BlockType.GOLD_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockInfo.Wool.ID, (int)WoolColor.YELLOW);
                                intReplaced++;
                                break;

                            case BlockType.IRON_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockInfo.Wool.ID, (int)WoolColor.LIGHT_GRAY);
                                intReplaced++;
                                break;

                            case BlockType.OBSIDIAN:
                                BlockShapes.MakeBlock(x, y, z, BlockInfo.Wool.ID, (int)WoolColor.BLACK);
                                intReplaced++;
                                break;

                            case BlockType.DIAMOND_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockInfo.Wool.ID, (int)WoolColor.LIGHT_BLUE);
                                intReplaced++;
                                break;

                            case BlockType.LAPIS_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockInfo.Wool.ID, (int)WoolColor.BLUE);
                                intReplaced++;
                                break;
                                // no need for a default, because we purposefully want to skip all the other blocks
                            }
#pragma warning restore
                            if (intReplaced > 25)
                            {
                                worldDest.Save();
                                intReplaced = 0;
                            }
                        }
                    }
                }
            }
        }
Beispiel #10
0
 private static void RemovePaths(BlockManager bm, int[,] intArea, int intBlockStart)
 {
     for (int x = 0; x < intArea.GetLength(0); x++)
     {
         for (int z = 0; z < intArea.GetLength(1); z++)
         {
             if (intArea[x, z] == 1)
             {
                 BlockShapes.MakeBlock(intBlockStart + x, 63, intBlockStart + z, City.GroundBlockID, City.GroundBlockData);
             }
         }
     }
 }
Beispiel #11
0
        public static void ReplaceValuableBlocks(BetaWorld worldDest, BlockManager bm, int intCitySize,
                                                 int intWallMaterial)
        {
            int intReplaced = 0;

            for (int x = 0; x < intCitySize; x++)
            {
                for (int z = 0; z < intCitySize; z++)
                {
                    for (int y = 32; y < 128; y++)
                    {
                        if ((int)bm.GetID(x, y, z) != intWallMaterial)
                        {
                            switch ((int)bm.GetID(x, y, z))
                            {
                            case BlockType.GOLD_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockType.WOOL, (int)WoolColor.YELLOW);
                                intReplaced++;
                                break;

                            case BlockType.IRON_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockType.WOOL, (int)WoolColor.LIGHT_GRAY);
                                intReplaced++;
                                break;

                            case BlockType.OBSIDIAN:
                                BlockShapes.MakeBlock(x, y, z, BlockType.WOOL, (int)WoolColor.BLACK);
                                intReplaced++;
                                break;

                            case BlockType.DIAMOND_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockType.WOOL, (int)WoolColor.LIGHT_BLUE);
                                intReplaced++;
                                break;

                            case BlockType.LAPIS_BLOCK:
                                BlockShapes.MakeBlock(x, y, z, BlockType.WOOL, (int)WoolColor.BLUE);
                                intReplaced++;
                                break;
                                // no need for a default, because we purposefully want to skip all the other blocks
                            }
                            if (intReplaced > 25)
                            {
                                worldDest.Save();
                                intReplaced = 0;
                            }
                        }
                    }
                }
            }
        }
Beispiel #12
0
 public static void MakeLever(int x, int y, int z, int intBlockAgainst, int intMirror)
 {
     BlockShapes.MakeBlock(x, y, z, BlockInfo.Lever.ID, BlockDirection(x, y, z, intBlockAgainst));
     if (intMirror > 0)
     {
         MakeLever(City.MapLength - x, y, z, intBlockAgainst, 0);
         MakeLever(x, y, City.MapLength - z, intBlockAgainst, 0);
         MakeLever(City.MapLength - x, y, City.MapLength - z, intBlockAgainst, 0);
         if (intMirror == 2)
         {
             MakeLever(z, y, x, intBlockAgainst, 1);
         }
     }
 }
Beispiel #13
0
 public static void MakeLever(int x, int y, int z, int intBlockAgainst, int intMirror)
 {
     BlockShapes.MakeBlock(x, y, z, BlockType.LEVER, BlockDirection(x, y, z, intBlockAgainst));
     if (intMirror > 0)
     {
         MakeLever(_intMapSize - x, y, z, intBlockAgainst, 0);
         MakeLever(x, y, _intMapSize - z, intBlockAgainst, 0);
         MakeLever(_intMapSize - x, y, _intMapSize - z, intBlockAgainst, 0);
         if (intMirror == 2)
         {
             MakeLever(z, y, x, intBlockAgainst, 1);
         }
     }
 }
Beispiel #14
0
        private static void AddFlowersToBlock(BlockManager bm, int x, int z, int intFreeNeighbours, string strFlower)
        {
            int intBlock = Convert.ToInt32(strFlower.Split('_')[0]);
            int intID    = 0;

            if (strFlower.Contains("_"))
            {
                intID = City.groundBlockData = Convert.ToInt32(strFlower.Split('_')[1]);
            }
            if (intBlock != BlockInfo.Cactus.ID || intFreeNeighbours == 9)
            {
                BlockShapes.MakeBlock(x, 64, z, intBlock, intID);
            }
        }
Beispiel #15
0
 public static void MakeChest(int x, int y, int z, int intBlockAgainst, TileEntityChest tec, int intMirror)
 {
     BlockShapes.MakeBlock(x, y, z, BlockType.CHEST, BlockHelper.BlockDirection(x, y, z, intBlockAgainst));
     _bmDest.SetTileEntity(x, y, z, tec);
     if (intMirror > 0)
     {
         MakeChest(_intMapSize - x, y, z, intBlockAgainst, tec, 0);
         MakeChest(x, y, _intMapSize - z, intBlockAgainst, tec, 0);
         MakeChest(_intMapSize - x, y, _intMapSize - z, intBlockAgainst, tec, 0);
         if (intMirror == 2)
         {
             MakeChest(z, y, x, intBlockAgainst, tec, 1);
         }
     }
 }
Beispiel #16
0
        public static void MakeMineshaft(BetaWorld world, BlockManager bm, int intFarmSize, int intMapSize)
        {
            intBlockStart = intFarmSize + 13;
            int intMineshaftSize = (1 + intMapSize) - (intBlockStart * 2);

            intBlockStart -= 2;
            for (int intLevel = 1; intLevel <= 7; intLevel++)
            {
                MakeLevel(world, bm, intLevel, intMineshaftSize);
            }
            BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 3, 64, (intMapSize / 2) + 1, (intMapSize / 2) + 1, (int)BlockType.WOOD, 0);
            BlockHelper.MakeLadder(intMapSize / 2, 4, 63, intMapSize / 2, 0, (int)BlockType.WOOD);
            //BlockShapes.MakeSolidBox(intMapSize / 2, intMapSize / 2, 4, 63, intMapSize / 2, intMapSize / 2, (int)BlockType.AIR, 0);
            bm.SetID(intMapSize / 2, 64, intMapSize / 2, (int)BlockType.TRAPDOOR);
        }
Beispiel #17
0
 public static void MakeChest(int x, int y, int z, int intBlockAgainst, TileEntityChest tec, int intMirror)
 {
     BlockShapes.MakeBlock(x, y, z, BlockInfo.Chest.ID, BlockHelper.BlockDirection(x, y, z, intBlockAgainst));
     _bmDest.SetTileEntity(x, y, z, tec);
     if (intMirror > 0)
     {
         MakeChest(City.MapLength - x, y, z, intBlockAgainst, tec, 0);
         MakeChest(x, y, City.MapLength - z, intBlockAgainst, tec, 0);
         MakeChest(City.MapLength - x, y, City.MapLength - z, intBlockAgainst, tec, 0);
         if (intMirror == 2)
         {
             MakeChest(z, y, x, intBlockAgainst, tec, 1);
         }
     }
 }
Beispiel #18
0
        private static void AddFlowersToBlock(BlockManager bm, int x, int z, int intFreeNeighbours)
        {
            string strFlower = Utils.RandomValueFromXMLElement(Path.Combine("Resources", "Themes", City.ThemeName + ".xml"),
                                                               "options", "flowers");
            int intBlock = Convert.ToInt32(strFlower.Split('_')[0]);
            int intID    = 0;

            if (strFlower.Contains("_"))
            {
                intID = City.GroundBlockData = Convert.ToInt32(strFlower.Split('_')[1]);
            }
            if (intBlock != BlockInfo.Cactus.ID || intFreeNeighbours == 9)
            {
                BlockShapes.MakeBlock(x, 64, z, intBlock, intID);
            }
        }
Beispiel #19
0
 public static void MakeGuardTowers()
 {
     Console.WriteLine("Making guard towers");
     // remove wall
     BlockShapes.MakeSolidBox(intFarmSize + 5, intFarmSize + 11, 64, 79, intFarmSize + 5, intFarmSize + 11, (int)BlockType.AIR, 1);
     // add tower
     BlockShapes.MakeHollowBox(intFarmSize + 4, intFarmSize + 12, 63, 80, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // divide into two rooms
     BlockShapes.MakeSolidBox(intFarmSize + 4, intFarmSize + 12, 71, 71, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // add openings to the walls
     for (int y = 72; y <= 74; y++)
     {
         for (int x = intFarmSize + 7; x <= intFarmSize + 9; x++)
         {
             BlockShapes.MakeBlock(x, y, intFarmSize + 12, (int)BlockType.AIR, 2);
         }
     }
     // add blocks on top of the towers
     BlockShapes.MakeHollowLayers(intFarmSize + 4, intFarmSize + 12, 81, 81, intFarmSize + 4, intFarmSize + 12, (int)BlockType.STONE, 1);
     // alternating top blocks
     for (int x = intFarmSize + 4; x <= intFarmSize + 12; x += 2)
     {
         for (int z = intFarmSize + 4; z <= intFarmSize + 12; z += 2)
         {
             if (x == intFarmSize + 4 || x == intFarmSize + 12 || z == intFarmSize + 4 || z == intFarmSize + 12)
             {
                 BlockShapes.MakeBlock(x, 82, z, (int)BlockType.STONE, 1);
             }
         }
     }
     // add central columns
     BlockShapes.MakeSolidBox(intFarmSize + 8, intFarmSize + 8, 72, 81, intFarmSize + 8, intFarmSize + 8, (int)BlockType.STONE, 1);
     BlockShapes.MakeLadder(intFarmSize + 7, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 9, 72, 81, intFarmSize + 8, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 7, 0, 1);
     BlockShapes.MakeLadder(intFarmSize + 8, 72, 81, intFarmSize + 9, 0, 1);
     // add cobwebs
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 5, 79, intFarmSize + 11, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 5, 30, 1, 30);
     BlockShapes.MakeBlock(intFarmSize + 11, 79, intFarmSize + 11, 30, 1, 30);
     // add chests
     MakeGuardChest(intFarmSize + 5, 72, intFarmSize + 5);
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intFarmSize + 5);
     MakeGuardChest(intFarmSize + 5, 72, intMapSize - (intFarmSize + 5));
     MakeGuardChest(intMapSize - (intFarmSize + 5), 72, intMapSize - (intFarmSize + 5));
 }
Beispiel #20
0
 static void MakeSewerSection(bool[,] booMaze, int intMazeX, int intMazeZ, int intMapX, int intMapZ,
                              int intStartY, int intPlotSize)
 {
     BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY, intStartY,
                              intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
     BlockShapes.MakeSolidBox(intMapX - 2, intMapX + 2, intStartY + 1, intStartY + 3,
                              intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
     BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY + 4, intStartY + 4,
                              intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     if (booMaze[intMazeX - 1, intMazeZ])
     {
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 1, intStartY, intStartY,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 2, intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - (intPlotSize / 2), intMapX - 1, intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX + 1, intMazeZ])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + (intPlotSize / 2), intStartY, intStartY,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX + (intPlotSize / 2), intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + (intPlotSize / 2), intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX, intMazeZ - 1])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX - 1, intStartY, intStartY,
                                  intMapZ - (intPlotSize / 2), intMapZ + 1, (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX - 2, intStartY + 1, intStartY + 3,
                                  intMapZ - (intPlotSize / 2), intMapZ + 2, (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX - 1, intStartY + 4, intStartY + 4,
                                  intMapZ - (intPlotSize / 2), intMapZ + 1, (int)BlockType.AIR);
     }
     if (booMaze[intMazeX, intMazeZ + 1])
     {
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY, intStartY,
                                  intMapZ - 1, intMapZ + (intPlotSize / 2), (int)BlockType.STATIONARY_WATER);
         BlockShapes.MakeSolidBox(intMapX - 2, intMapX + 2, intStartY + 1, intStartY + 3,
                                  intMapZ - 2, intMapZ + (intPlotSize / 2), (int)BlockType.AIR);
         BlockShapes.MakeSolidBox(intMapX - 1, intMapX + 1, intStartY + 4, intStartY + 4,
                                  intMapZ - 1, intMapZ + (intPlotSize / 2), (int)BlockType.AIR);
     }
 }
Beispiel #21
0
        public static void MakeMoat(int intFarmSize, int intMapSize, string strMoatLiquid)
        {
            int intMoatLiquid = (int)BlockType.STATIONARY_WATER;

            if (strMoatLiquid == "Lava" || (strMoatLiquid == "Random" && rand.NextDouble() > 0.75))
            {
                intMoatLiquid = (int)BlockType.STATIONARY_LAVA;
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 62, a, intMapSize - a, intMoatLiquid);
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 63, 63, a, intMapSize - a, (int)BlockType.AIR);
            }
        }
Beispiel #22
0
        private static void MakeEmblem(int intFarmLength, int intMapLength, string strCityEmblem)
        {
            if (strCityEmblem.ToLower() != "none")
            {
                int intBlockyBlock = RandomHelper.RandomNumber(BlockType.IRON_BLOCK, BlockType.GOLD_BLOCK,
                                                               BlockType.DIAMOND_BLOCK);
                string[] strEmblem;
                if (strCityEmblem == "Random")
                {
                    string[] strFiles = Directory.GetFiles("Resources", "Emblem*.txt");
                    strCityEmblem = RandomHelper.RandomItemFromArray(strFiles);
                    strEmblem     = File.ReadAllLines(strCityEmblem);
                }
                else
                {
                    strEmblem = File.ReadAllLines(Path.Combine("Resources", "Emblem " + strCityEmblem + ".txt"));
                }

                for (int y = 0; y < strEmblem.GetLength(0); y++)
                {
                    strEmblem[y] = strEmblem[y].Replace("  ", " ");
                    strEmblem[y] = strEmblem[y].Replace((char)9, ' '); //tab
                    string[] strLine = strEmblem[y].Split(' ');
                    for (int x = 0; x < strLine.GetLength(0); x++)
                    {
                        string[] strSplit = strLine[x].Split(':');
                        if (strSplit.GetLength(0) == 1)
                        {
                            Array.Resize(ref strSplit, 2);
                        }
                        if (strSplit[0] == "-1")
                        {
                            strSplit[0] = intBlockyBlock.ToString();
                        }
                        BlockShapes.MakeBlock(((intMapLength / 2) - (strLine.GetLength(0) + 5)) + x, 71 - y,
                                              intFarmLength + 5, Convert.ToInt32(strSplit[0]), 2, 100,
                                              Convert.ToInt32(strSplit[1]));
                    }
                    for (int x = strLine.GetLength(0) + 1; x < strLine.GetLength(0) + 5; x++)
                    {
                        BlockShapes.MakeBlock((intMapLength / 2) - (5 + x), 69, intFarmLength + 5, BlockType.AIR, 2, 100, 0);
                        BlockShapes.MakeBlock((intMapLength / 2) - (5 + x), 70, intFarmLength + 5, BlockType.AIR, 2, 100, 0);
                    }
                }
            }
        }
Beispiel #23
0
 private static void MakeHouse(BlockManager bm, int x, int z)
 {
     BlockShapes.MakeHollowBox(x + 2, x + 10, 63, 67, z + 2, z + 10, (int)BlockType.WOOD_PLANK);
     for (int a = 0; a <= 4; a++)
     {
         BlockShapes.MakeSolidBox(x + 2, x + 10, 67 + a, 67 + a, z + 2 + a, z + 10 - a, (int)BlockType.WOOD);
     }
     BlockShapes.MakeSolidBox(x + 10, x + 10, 65, 65, z + 6, z + 8, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 2, x + 2, 65, 65, z + 4, z + 8, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 2, z + 2, (int)BlockType.GLASS);
     BlockShapes.MakeSolidBox(x + 4, x + 8, 65, 65, z + 10, z + 10, (int)BlockType.GLASS);
     bm.SetID(x + 10, 64, z + 4, (int)BlockType.WOOD_DOOR);
     bm.SetData(x + 10, 64, z + 4, 5);
     bm.SetID(x + 10, 65, z + 4, (int)BlockType.WOOD_DOOR);
     bm.SetData(x + 10, 65, z + 4, 13);
     BlockShapes.RotateBlocks(x + 2, x + 10, 63, 71, z + 2, z + 10);
 }
Beispiel #24
0
        public static void MakeLadder(int x, int y1, int y2, int z, int intMirror, int intBlockAgainst)
        {
            int intDirection = BlockDirectionLadderSign(x, y1, z, intBlockAgainst);

            for (int y = y1; y <= y2; y++)
            {
                BlockShapes.MakeBlock(x, y, z, BlockInfo.Ladder.ID, intDirection);
            }
            if (intMirror > 0)
            {
                MakeLadder(City.MapLength - x, y1, y2, z, 0, intBlockAgainst);
                MakeLadder(x, y1, y2, City.MapLength - z, 0, intBlockAgainst);
                MakeLadder(City.MapLength - x, y1, y2, City.MapLength - z, 0, intBlockAgainst);
                if (intMirror == 2)
                {
                    MakeLadder(z, y1, y2, x, 1, intBlockAgainst);
                }
            }
        }
Beispiel #25
0
        public static void MakeLadder(int x, int y1, int y2, int z, int intMirror, int intBlockAgainst)
        {
            int intDirection = BlockDirectionLadderSign(x, y1, z, intBlockAgainst);

            for (int y = y1; y <= y2; y++)
            {
                BlockShapes.MakeBlock(x, y, z, BlockType.LADDER, intDirection);
            }
            if (intMirror > 0)
            {
                MakeLadder(_intMapSize - x, y1, y2, z, 0, intBlockAgainst);
                MakeLadder(x, y1, y2, _intMapSize - z, 0, intBlockAgainst);
                MakeLadder(_intMapSize - x, y1, y2, _intMapSize - z, 0, intBlockAgainst);
                if (intMirror == 2)
                {
                    MakeLadder(z, y1, y2, x, 1, intBlockAgainst);
                }
            }
        }
Beispiel #26
0
 public static void MakeDrawbridges()
 {
     Console.WriteLine("Making drawbridges");
     // drawbridge
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 63, 63, intFarmSize - 2, intFarmSize + 11, (int)BlockType.STONE, 2);
     // carve out the entrance/exit
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 64, 67, intFarmSize + 6, intFarmSize + 10, (int)BlockType.AIR, 2);
     // add the bottom of a portcullis
     BlockShapes.MakeSolidBox((intMapSize / 2) - 2, intMapSize / 2, 67, 67, intFarmSize + 6, intFarmSize + 6, (int)BlockType.FENCE, 2);
     // ladder
     BlockShapes.MakeLadder((intMapSize / 2) - 4, 64, 72, intFarmSize + 11);
     BlockShapes.MakeLadder((intMapSize / 2) + 4, 64, 72, intFarmSize + 11);
     BlockShapes.MakeLadder((intMapSize / 2) - 4, 64, 72, intMapSize - (intFarmSize + 11));
     BlockShapes.MakeLadder((intMapSize / 2) + 4, 64, 72, intMapSize - (intFarmSize + 11));
     BlockShapes.MakeLadder(intFarmSize + 11, 64, 72, (intMapSize / 2) - 4);
     BlockShapes.MakeLadder(intFarmSize + 11, 64, 72, (intMapSize / 2) + 4);
     BlockShapes.MakeLadder(intMapSize - (intFarmSize + 11), 64, 72, (intMapSize / 2) - 4);
     BlockShapes.MakeLadder(intMapSize - (intFarmSize + 11), 64, 72, (intMapSize / 2) + 4);
 }
Beispiel #27
0
        public static void MakeMoat()
        {
            Console.WriteLine("Making moat");
            int intMoatLiquid = (int)BlockType.STATIONARY_WATER;

            if (rand.Next(100) > 75)
            {
                intMoatLiquid = (int)BlockType.STATIONARY_LAVA;
            }

            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 59, 62, a, intMapSize - a, intMoatLiquid);
            }
            for (int a = intFarmSize - 1; a <= intFarmSize + 5; a++)
            {
                BlockShapes.MakeHollowLayers(a, intMapSize - a, 63, 63, a, intMapSize - a, (int)BlockType.AIR);
            }
        }
Beispiel #28
0
 public static void MakeWall()
 {
     Console.WriteLine("Making walls");
     // walls
     for (int a = intFarmSize + 6; a <= intFarmSize + 10; a++)
     {
         BlockShapes.MakeHollowLayers(a, intMapSize - a, 58, 71, a, intMapSize - a, (int)BlockType.STONE);
     }
     // outside and inside edges at the top
     BlockShapes.MakeHollowLayers(intFarmSize + 6, intMapSize - (intFarmSize + 6), 72, 72, intFarmSize + 6, intMapSize - (intFarmSize + 6), (int)BlockType.STONE);
     BlockShapes.MakeHollowLayers(intFarmSize + 10, intMapSize - (intFarmSize + 10), 72, 72, intFarmSize + 10, intMapSize - (intFarmSize + 10), (int)BlockType.STONE);
     // alternating blocks on top of the edges
     for (int a = intFarmSize + 7; a <= intMapSize - (intFarmSize + 7); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 6, (int)BlockType.STONE, 2);
     }
     for (int a = intFarmSize + 11; a <= intMapSize - (intFarmSize + 11); a += 2)
     {
         BlockShapes.MakeBlock(a, 73, intFarmSize + 10, (int)BlockType.STONE, 2);
     }
 }
Beispiel #29
0
        public static void MakeDoor(int x, int y, int z, int intBlockAgainst, bool booIronDoor, int intMirror)
        {
            int intDirection = BlockHelper.DoorDirection(x, y + 1, z, intBlockAgainst);
            int intBlockType = BlockInfo.WoodDoor.ID;

            if (booIronDoor)
            {
                intBlockType = BlockInfo.IronDoor.ID;
            }
            BlockShapes.MakeBlock(x, y + 1, z, intBlockType, (int)DoorState.TOPHALF + intDirection);
            BlockShapes.MakeBlock(x, y, z, intBlockType, intDirection);
            if (intMirror > 0)
            {
                MakeDoor(City.MapLength - x, y, z, intBlockAgainst, booIronDoor, 0);
                MakeDoor(x, y, City.MapLength - z, intBlockAgainst, booIronDoor, 0);
                MakeDoor(City.MapLength - x, y, City.MapLength - z, intBlockAgainst, booIronDoor, 0);
                if (intMirror == 2)
                {
                    MakeDoor(z, y, x, intBlockAgainst, booIronDoor, 1);
                }
            }
        }
Beispiel #30
0
        public static void MakeDoor(int x, int y, int z, int intBlockAgainst, bool booIronDoor, int intMirror)
        {
            int intDirection = BlockHelper.DoorDirection(x, y + 1, z, intBlockAgainst);
            int intBlockType = BlockType.WOOD_DOOR;

            if (booIronDoor)
            {
                intBlockType = BlockType.IRON_DOOR;
            }
            BlockShapes.MakeBlock(x, y + 1, z, intBlockType, (int)DoorState.TOPHALF + intDirection);
            BlockShapes.MakeBlock(x, y, z, intBlockType, intDirection);
            if (intMirror > 0)
            {
                MakeDoor(_intMapSize - x, y, z, intBlockAgainst, booIronDoor, 0);
                MakeDoor(x, y, _intMapSize - z, intBlockAgainst, booIronDoor, 0);
                MakeDoor(_intMapSize - x, y, _intMapSize - z, intBlockAgainst, booIronDoor, 0);
                if (intMirror == 2)
                {
                    MakeDoor(z, y, x, intBlockAgainst, booIronDoor, 1);
                }
            }
        }