예제 #1
0
        public void ConnectTo(LostBuilding other)
        {
            int bridgeHeight = ConfigReader.Get <int>("worldgen.lost city.house bridge height");

            int right = Math.Max(Area.Left, other.Area.Left);
            int left  = Math.Min(Area.Right, other.Area.Right);

            int floorShared = Math.Max(Area.Bottom, other.Area.Bottom);
            int roofShared  = Math.Min(Area.Top, other.Area.Top);

            int bridgeFloor = WorldGen.genRand.Next(roofShared + bridgeHeight, floorShared);

            for (int i = left; i <= right; i++)
            {
                WorldGen.PlaceTile(i, bridgeFloor, ModContent.TileType <Tiles.LostCity.LostBrickUnsafe>(), forced: true);
                WorldGen.PlaceTile(i, bridgeFloor - bridgeHeight, ModContent.TileType <Tiles.LostCity.LostBrickUnsafe>(), forced: true);

                for (int j = bridgeFloor - bridgeHeight + 1; j < bridgeFloor; j++)
                {
                    WorldGen.KillTile(i, j);

                    WorldGen.KillWall(i, j);
                    WorldGen.PlaceWall(i, j, ModContent.WallType <Walls.LostCity.LostBrickWall>());
                }
            }
        }
예제 #2
0
 private static void ErectBuildings(IEnumerable<LostBuilding> set)
 {
     LostBuilding lastBuilding = null;
     foreach (var building in set)
     {
         building.ClearInside();
         building.GenerateFrame();
         building.GenerateFloors();
         lastBuilding?.ConnectTo(building);
         lastBuilding = building;
     }
 }
예제 #3
0
            private void GenLostChest(IList<LostBuilding> buildings)
            {
                LostBuilding lostChestBuilding = Main.rand.Next(buildings);
                for (int attempt = 0; attempt < 100; attempt++)
                {
                    int i = WorldGen.genRand.Next(lostChestBuilding.Area.Left + 1, lostChestBuilding.Area.Right);
                    int j = lostChestBuilding.Area.Bottom - WorldGen.genRand.Next(lostChestBuilding.Floors) * lostChestBuilding.FloorHeight;

                    if (!WorldGen.SolidTile(i, j) || !WorldGen.SolidTile(i - 1, j))
                    {
                        continue;
                    }

                    if (TileExtensions.PlaceMultitile(i - 1, j - 2, TileType<LostChest>(), 2, 2))
                    {
                        return;
                    }
                }
                GenLostChest(buildings);
            }