public void CreateSepulchre(Vector2 position) { int[] invalidTypes = new int[] { TileID.BeeHive, TileID.BlueDungeonBrick, TileID.GreenDungeonBrick, TileID.PinkDungeonBrick, TileID.LihzahrdBrick }; for (int x = (int)position.X - 50; x < (int)position.X + 50; x++) //Main structure, DO NOT USE LOOPTHROUGHTILES HERE { for (int y = (int)position.Y - 50; y < (int)position.Y + 50; y++) { for (int z = 0; z < invalidTypes.Length; z++) { if (Framing.GetTileSafely(x, y).type == invalidTypes[z]) { return; } } } } PerlinNoiseTwo noiseType = new PerlinNoiseTwo(WorldGen._genRandSeed); int i = (int)position.X; int j = (int)position.Y; /*for (int x = i - 50; x < i + 50; x++) //dirt square * { * for (int y = j - 90; y < j + 50; y++) * { * Main.tile[x,y].active(true); * } * }*/ for (int x = i - 25; x < i + 25; x++) //Main structure, DO NOT USE LOOPTHROUGHTILES HERE { for (int y = j - 20; y < j + 20; y++) { if (noiseType.Noise2D((x * 600) / (float)4200, (y * 600) / (float)1200) > 0.85f) //regular rooms { CreateRoom(x, y, WorldGen.genRand.Next(5, 10), WorldGen.genRand.Next(5, 10)); } if (noiseType.Noise2D((x * 600) / (float)4200, (y * 600) / (float)1200) > 0.95f || (x == i && y == j)) //towers { int towerheight = 30; int width = WorldGen.genRand.Next(5, 8); CreateRoom(x, y - towerheight, width, towerheight - 8); CreateHalfCircle(x + (int)(width / 2) + 2, y - (int)(towerheight * 1.5f), width + 4); } } } WallCleanup(i, j); for (int x = i - 50; x < i + 50; x++) { for (int y = j - 90; y < j + 50; y++) { if (Main.rand.Next(25) == 0 && (Main.tile[x, y].type == tile || Main.tile[x, y].type == tiletwo) && Main.tile[x, y].active()) { Main.tile[x, y].active(false); } } } CreateChests(i, j); PolishSepulchre(i, j); RemoveWaterFromRegion(50, 40, position - new Vector2(25, 20)); }
public void PolishSepulchre(int i, int j) { bool placedEvilTome = false; PerlinNoiseTwo noiseType2 = new PerlinNoiseTwo(WorldGen._genRandSeed); List <AtTile> delegateList = new List <AtTile>(); delegateList.Add(delegate(int x, int y) //platforms { if (Main.rand.Next(50) == 0 && Main.tile[x - 1, y].type == tile && Main.tile[x - 1, y].active()) { CreateShelf(x, y, 50, 12, false, ref placedEvilTome); } }); delegateList.Add(delegate(int x, int y) //cursed armor { if ((Main.tile[x, y + 1].type == tile || Main.tile[x, y + 1].type == tiletwo) && Main.rand.Next(17) == 1 && Main.tile[x, y].wall == wall) { WorldGen.PlaceObject(x, y, ModContent.TileType <CursedArmor>()); } }); delegateList.Add(delegate(int x, int y) //pots { if ((Main.tile[x, y + 1].type == tile || Main.tile[x, y + 1].type == tiletwo) && Main.rand.Next(4) == 1 && Main.tile[x, y].wall == wall) { int potType = 0; switch (Main.rand.Next(3)) { case 0: potType = ModContent.TileType <SepulchrePot1>(); break; case 1: potType = ModContent.TileType <SepulchrePot2>(); break; case 2: potType = ModContent.TileType <SepulchrePot2>(); break; } WorldGen.PlaceObject(x, y, potType); } }); delegateList.Add(delegate(int x, int y) //cracks in walls { if (noiseType2.Noise2D((float)(x * 200) / (float)1200, (float)(y * 200) / (float)1200) > 0.75f && Main.tile[x, y].wall == wall) { Main.tile[x, y].wall = (ushort)0; } }); delegateList.Add(delegate(int x, int y) //chandeliers { if ((Main.tile[x, y - 1].type == tile || Main.tile[x, y - 1].type == tiletwo) && Main.rand.Next(12) == 1 && Main.tile[x, y].wall == wall) { WorldGen.PlaceObject(x, y, ModContent.TileType <SepulchreChandelier>()); } }); delegateList.Add(delegate(int x, int y) //Windows { if (WorldGen.genRand.Next(30) == 0 && (Main.tile[x - 1, y].type == tile || Main.tile[x - 1, y].type == tiletwo) && Main.tile[x - 1, y].active()) { int windowType = 0; switch (Main.rand.Next(2)) { case 0: windowType = ModContent.TileType <SepulchreWindowOne>(); break; default: windowType = ModContent.TileType <SepulchreWindowTwo>(); break; } CreateWindowRow(x, y, 50, windowType); } }); delegateList.Add(delegate(int x, int y) //shelves { if (Main.rand.Next(30) == 0 && (Main.tile[x - 1, y].type == tile || Main.tile[x - 1, y].type == tiletwo) && Main.tile[x - 1, y].active()) { CreateShelf(x, y, Main.rand.Next(4, 8), 12, true, ref placedEvilTome); } if (Main.rand.Next(30) == 0 && (Main.tile[x - 1, y].type == tile || Main.tile[x - 1, y].type == tiletwo) && Main.tile[x + 1, y].active()) { CreateShelfBackwards(x, y, Main.rand.Next(4, 8), 12, true, ref placedEvilTome); } }); delegateList.Add(delegate(int x, int y) //cobwebs { if (noiseType2.Noise2D((float)(x * 100) / (float)1200, (float)(y * 100) / (float)1200) > 0.70f && Main.tile[x, y].wall == wall && !Main.tile[x, y].active()) { Main.tile[x, y].active(true); Main.tile[x, y].type = 51; } }); delegateList.Add(delegate(int x, int y) //torches { if (Main.rand.Next(200) == 0 && Main.tile[x, y].wall == wall && !Main.tile[x, y].active()) { WorldGen.PlaceTile(x, y, 4, true, false, -1, 8); } }); delegateList.Add(delegate(int x, int y) //mirrors { if (Main.rand.Next(200) == 0 && Main.tile[x, y].wall == wall && !Main.tile[x, y].active()) { if (!MirrorsNearby(x, y)) { WorldGen.PlaceObject(x, y, ModContent.TileType <SepulchreMirror>()); } } }); foreach (AtTile atTile in delegateList) { LoopThroughTiles(i, j, atTile); } }