diff --git a/Backgrounds/SunkenSeaBG0.png b/Backgrounds/SunkenSeaBG0.png new file mode 100644 index 0000000000..24766776c4 Binary files /dev/null and b/Backgrounds/SunkenSeaBG0.png differ diff --git a/Backgrounds/SunkenSeaBG1.png b/Backgrounds/SunkenSeaBG1.png new file mode 100644 index 0000000000..f04de62d09 Binary files /dev/null and b/Backgrounds/SunkenSeaBG1.png differ diff --git a/Backgrounds/SunkenSeaBG2.png b/Backgrounds/SunkenSeaBG2.png new file mode 100644 index 0000000000..dedfad6c44 Binary files /dev/null and b/Backgrounds/SunkenSeaBG2.png differ diff --git a/Backgrounds/SunkenSeaBG3.png b/Backgrounds/SunkenSeaBG3.png new file mode 100644 index 0000000000..a25e598113 Binary files /dev/null and b/Backgrounds/SunkenSeaBG3.png differ diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs new file mode 100644 index 0000000000..7079491989 --- /dev/null +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -0,0 +1,13 @@ +using Terraria.ModLoader; + +namespace CalamityMod.Backgrounds +{ + public class SunkenSeaBGStyle : ModUndergroundBackgroundStyle + { + public override void FillTextureArray(int[] textureSlots) + { + for (int i = 0; i <= 3; i++) + textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString()); + } + } +} \ No newline at end of file diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index 86dfd70fce..ed3c069dc4 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -8,6 +8,7 @@ namespace CalamityMod.BiomeManagers public class SunkenSeaBiome : ModBiome { public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaWater"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; diff --git a/Skies/AstralScreenShaderData.cs b/Skies/AstralScreenShaderData.cs index 833a7ae972..56a7581868 100644 --- a/Skies/AstralScreenShaderData.cs +++ b/Skies/AstralScreenShaderData.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral) + if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) Filters.Scene["CalamityMod:Astral"].Deactivate(Array.Empty()); } } diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index 0da7a285bd..450cedb106 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (!Main.LocalPlayer.Calamity().ZoneAstral) + if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu) skyActive = false; if (skyActive && opacity < 1f) diff --git a/Skies/BossRushSky.cs b/Skies/BossRushSky.cs index dddb4f530e..d6dbaf2463 100644 --- a/Skies/BossRushSky.cs +++ b/Skies/BossRushSky.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Skies public static bool DetermineDrawEligibility() { - bool useEffect = (BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly; + bool useEffect = ((BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:BossRush"] != null && useEffect != SkyManager.Instance["CalamityMod:BossRush"].IsActive()) { diff --git a/Skies/CryogenSky.cs b/Skies/CryogenSky.cs index a1d565eaa0..4f2efb2418 100644 --- a/Skies/CryogenSky.cs +++ b/Skies/CryogenSky.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Skies public static void UpdateDrawEligibility() { - bool useEffect = NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly; + bool useEffect = (NPC.AnyNPCs(ModContent.NPCType()) || ShouldDrawRegularly) && !Main.gameMenu; if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useEffect != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { diff --git a/Skies/MonolithSky.cs b/Skies/MonolithSky.cs index f9c9fdda38..235d5429e0 100644 --- a/Skies/MonolithSky.cs +++ b/Skies/MonolithSky.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Skies public override void Update(GameTime gameTime) { - if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1) + if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1 || Main.gameMenu) skyActive = false; if (skyActive && opacity < 1f) diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index ebea619fad..0811ae0b23 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -77,14 +77,29 @@ namespace CalamityMod.Systems }); // Sunken Sea gens after Traps because otherwise boulders spawn in the Sunken Sea :) - int TrapsIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Traps")); + int TrapsIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again")); if (TrapsIndex != -1) { tasks.Insert(TrapsIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { progress.Message = "Partially flooding an overblown desert"; + int sunkenSeaX = WorldGen.UndergroundDesertLocation.Left; - int sunkenSeaY = WorldGen.UndergroundDesertLocation.Center.Y; + int sunkenSeaY = 0; + + //desert position shennanigans + //start right above hell, then move up until a desert tile is found, and then place the sunken sea + bool foundPosition = false; + for (int y = Main.maxTilesY - 200; y >= (Main.maxTilesY / 2) - 45; y--) + { + if (Main.tile[sunkenSeaX, y].TileType == TileID.Sand || Main.tile[sunkenSeaX, y].TileType == TileID.Sandstone || + Main.tile[sunkenSeaX, y].TileType == TileID.Sand || Main.tile[sunkenSeaX, y].TileType == TileID.Sandstone) + { + sunkenSeaY = y + 100; //offset so it doesnt generates weird + break; + } + } + SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY)); })); } diff --git a/Waters/SunkenSeaWater.png b/Waters/SunkenSeaWater.png index 45af5a5c94..75032ee095 100644 Binary files a/Waters/SunkenSeaWater.png and b/Waters/SunkenSeaWater.png differ diff --git a/Waters/SunkenSeaWater_Block.png b/Waters/SunkenSeaWater_Block.png index 87a5f07a83..0194ffae12 100644 Binary files a/Waters/SunkenSeaWater_Block.png and b/Waters/SunkenSeaWater_Block.png differ diff --git a/Waters/SunkenSeaWaterflow.png b/Waters/SunkenSeaWaterflow.png index 17626db60c..5130afd9e1 100644 Binary files a/Waters/SunkenSeaWaterflow.png and b/Waters/SunkenSeaWaterflow.png differ diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 2c59c7d6b7..abe5393a44 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -133,7 +133,8 @@ namespace CalamityMod.World int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 while (y < Main.maxTilesY) { - if (Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType]) + //check to place the astral meteor on valid tiles, place automatically on ebonstone walls, and avoid platforms + if (((Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType]) || Main.tile[x, y].WallType == 3) && !TileID.Sets.Platforms[Main.tile[x, y].TileType]) { int suitableTiles = 0; int checkRadius = 15; diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index af373359f9..b24be19fd1 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.LabFinders; @@ -289,7 +290,7 @@ namespace CalamityMod.World //for now just manually check the area around the lab and replace water with lava, may not be the best permanent fix but it works for now for (int killWaterX = placementPoint.X - 150; killWaterX <= placementPoint.X + 150; killWaterX++) { - for (int killWaterY = Main.maxTilesY - 200; killWaterY <= Main.maxTilesY - 6; killWaterY++) + for (int killWaterY = underworldTop; killWaterY <= Main.maxTilesY - 5; killWaterY++) { Tile tile = Framing.GetTileSafely(killWaterX, killWaterY); @@ -361,9 +362,21 @@ namespace CalamityMod.World else placementPositionX = WorldGen.genRand.Next(ugDesert.Right - 10, ugDesert.Right + 20) - labWidth; - // Somewhere in the middle third of the Sunken Sea, which itself is in the lower half of the Underground Desert - int sunkenSeaHeight = ugDesert.Height / 4; - int placementPositionY = (int)(ugDesert.Center.Y + Main.rand.NextFloat(0.33f, 0.67f) * sunkenSeaHeight) - labHeight; + int sunkenSeaY = 0; + bool foundPosition = false; + + //copied the desert position code from the sunken sea's generation so the lab always generates within the sunken sea properly + for (int y = Main.maxTilesY - 200; y >= (Main.maxTilesY / 2) - 45; y--) + { + if (Main.tile[placementPositionX, y].TileType == ModContent.TileType() || + Main.tile[placementPositionX, y].TileType == ModContent.TileType()) + { + sunkenSeaY = y - 90; //offset so it generates nicely + break; + } + } + + int placementPositionY = (int)(sunkenSeaY) - labHeight; placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index b04f10dc0f..31d40e942a 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; @@ -202,6 +203,7 @@ namespace CalamityMod.World Vector2 totalScale = new Vector2(totalWidth, totalHeight); Vector2 individualScale = new Vector2(clusters.Width, clusters.Height); + //I was a bit worried about editing anything in this loop too drastically, so i just changed all instances of placing navystone to eutrophic sand for (int i = -20; i < totalWidth + 20; i++) { for (int j = -20; j < totalHeight + 20; j++) @@ -241,14 +243,14 @@ namespace CalamityMod.World float num10 = num3 + num5; Tile tile = Main.tile[num6, num7]; bool flag = num8 >= 0.8f; - if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent + if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent { tile.ClearEverything(); - tile.WallType = (ushort)ModContent.WallType(); + //tile.WallType = (ushort)ModContent.WallType(); tile.LiquidAmount = 192; - if (num4 % 15 == 2) + if (num4 % 5 == 2) { - tile.ResetToType((ushort)ModContent.TileType()); + tile.ResetToType((ushort)ModContent.TileType()); tile.Get().HasTile = true; tile.LiquidAmount = 0; } @@ -260,7 +262,7 @@ namespace CalamityMod.World tile.LiquidAmount = 192; if (!flag || tile.HasTile) { - tile.ResetToType((ushort)ModContent.TileType()); + tile.ResetToType((ushort)ModContent.TileType()); tile.Get().HasTile = true; Tile.SmoothSlope(num6, num7, true); tile.LiquidAmount = 0; @@ -300,6 +302,69 @@ namespace CalamityMod.World } } } + + //seperate loop for biome polish and stuff + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = start.X + 50; j < Main.maxTilesY - 200; j++) + { + int x = i + start.X; + int y = j + start.Y; + + /* + //randomly place navystone chunks on top of exposed sand + if (WorldGen.genRand.Next(50) == 0 && tile.HasTile && tile.TileType == ModContent.TileType() && !tileAbove.HasTile) + { + //todo: change this to be more natural and not a circle, maybe use WorldGen.TileRunner? + BasicCircle(x, y, WorldGen.genRand.Next(3, 12), ModContent.TileType()); + } + */ + + //randomly kill walls so that the background can show through in some places + if (WorldGen.genRand.Next(50) == 0) + { + //TODO: continue this tomorrow + + int radius = (int)(((float)WorldGen.genRand.Next(8, 20))); + float outerRadius = WorldGen.genRand.Next(40, 56) * 0.01f; + ShapeData holeShape = new ShapeData(); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle((int)((float)radius * (outerRadius * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1 + { + new Modifiers.Blotches(2, 0.3).Output(holeShape), + new Actions.ClearWall(true), //Clear center + new Actions.SetLiquid(0, 255) + })); + } + } + } + + //final cleanup loop + for (int i = -20; i < totalWidth + 20; i++) + { + for (int j = -20; j < totalHeight + 20; j++) + { + int x = i + start.X; + int y = j + start.Y; + + Tile tile = Main.tile[x, y]; + + //lava BEGONE + if (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType()) + { + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + + //also get rid of any annoying leftover obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(x, y); + } + } + } + } } // Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits" @@ -475,7 +540,8 @@ namespace CalamityMod.World int num5 = k + start.X; int num6 = l + start.Y; Tile tile2 = Main.tile[num5, num6]; - if (tile2.HasTile && (tile2.TileType == ModContent.TileType() || tile2.TileType == ModContent.TileType())) + if (tile2.HasTile && (tile2.TileType == ModContent.TileType() || + tile2.TileType == ModContent.TileType() || tile2.TileType == ModContent.TileType())) { bool flag = true; for (int m = -1; m >= -3; m--) @@ -513,7 +579,8 @@ namespace CalamityMod.World break; } } - if (tile2.TileType == ModContent.TileType() || (tile2.TileType == ModContent.TileType() && WorldGen.genRand.Next(8) == 0)) + if (tile2.TileType == ModContent.TileType() || ((tile2.TileType == ModContent.TileType() || + tile2.TileType == ModContent.TileType()) && WorldGen.genRand.Next(8) == 0)) { if (flag3 ^ flag4) { @@ -553,41 +620,44 @@ namespace CalamityMod.World } } } + if (tile2.TileType == ModContent.TileType() || tile2.TileType == ModContent.TileType()) + { + if (WorldGen.genRand.Next(5) == 0) + { + PlaceTit(num5, num6 + 1, (ushort)ModContent.TileType()); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(10) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(5) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + if (WorldGen.genRand.Next(6) == 0) + { + WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + } + } if (!tile2.HasTile) { - if (tile2.WallType == ModContent.WallType() || tile2.WallType == ModContent.WallType()) + if (tile2.TileType == ModContent.TileType() || tile2.WallType == ModContent.WallType()) { - if (WorldGen.genRand.Next(5) == 0) - { - PlaceTit(num5, num6, (ushort)ModContent.TileType()); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(10) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(8) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } - if (WorldGen.genRand.Next(6) == 0) - { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); - } if (WorldGen.genRand.Next(4) == 0) { - WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType(), true, false, -1, 0); } } }