diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index e51c997ffb..b4793bcd0c 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -51,7 +51,8 @@ namespace CalamityMod.Backgrounds for (int j = 0; j < drawLimitY; j++) { Point pos = drawPoint + new Point(i, j); - if (Main.tile[pos.X, pos.Y].Slope != SlopeType.Solid) + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.1f); } } @@ -67,8 +68,8 @@ namespace CalamityMod.Backgrounds { Point pos = drawPoint + new Point(i, j); if (!Main.tile[pos.X, pos.Y].HasTile && - Main.tile[pos.X, pos.Y].WallType == 0 && - Main.tile[pos.X, pos.Y].LiquidAmount == 0) + Main.tile[pos.X, pos.Y].WallType == 0 && + Main.tile[pos.X, pos.Y].LiquidAmount == 0) Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.2f); } } @@ -100,7 +101,7 @@ namespace CalamityMod.Backgrounds { Point pos = drawPoint + new Point(i, j); if (!Main.tile[pos.X, pos.Y].HasTile && - Main.tile[pos.X, pos.Y].WallType == 0) + Main.tile[pos.X, pos.Y].WallType == 0) Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.2f); } } diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index 4afdf26048..0311e15215 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -231,6 +231,7 @@ namespace CalamityMod.Systems // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, // rather than keeping the player in the dark about what's happening. // it doesn't have to make sense, just be cool for the players :) -ena + SunkenSea.PlaceBasaltGullyBorderBlend(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; @@ -242,9 +243,9 @@ namespace CalamityMod.Systems SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); + SunkenSea.PlaceSunkenSeaAmbience(); SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; - SunkenSea.PlaceSunkenSeaAmbience(); })); } diff --git a/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs index 4f20979f50..d74ef3c0b4 100644 --- a/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs @@ -15,26 +15,4 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); } } - - public class DigitateCoral2Echo : DigitateCoral2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DigitateCoral2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType()); - FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class DigitateCoral3Echo : DigitateCoral3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DigitateCoral3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType()); - FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } } diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.cs b/Tiles/SunkenSea/Ambient/DigitateCoral.cs index b2255c8d13..04340a1671 100644 --- a/Tiles/SunkenSea/Ambient/DigitateCoral.cs +++ b/Tiles/SunkenSea/Ambient/DigitateCoral.cs @@ -17,6 +17,11 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileLighted[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.DrawYOffset = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.addTile(Type); AddMapEntry(new Color(48, 201, 214)); DustType = DustID.IceGolem; @@ -36,24 +41,4 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient b = 0.45f; } } - - public class DigitateCoral2 : DigitateCoral - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.14f; - g = 0.41f; - b = 0.45f; - } - } - - public class DigitateCoral3 : DigitateCoral - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.14f; - g = 0.41f; - b = 0.45f; - } - } } diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 6c8ee7e5ef..e9537446f1 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.SunkenSea DustType = DustID.Ash; HitSound = SoundID.Tink; - AddMapEntry(new Color(58, 55, 70)); + AddMapEntry(new Color(77, 75, 86)); MinPick = 110; diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs index a184ad68d5..0d9d1ee157 100644 --- a/Tiles/SunkenSea/VolcanicSand.cs +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.t_PearlWood; - AddMapEntry(new Color(117, 79, 97)); + AddMapEntry(new Color(102, 101, 106)); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); diff --git a/Walls/LargeBasaltWall.cs b/Walls/LargeBasaltWall.cs index 4c902acac2..3d108a79c5 100644 --- a/Walls/LargeBasaltWall.cs +++ b/Walls/LargeBasaltWall.cs @@ -10,7 +10,25 @@ namespace CalamityMod.Walls { Main.wallHouse[Type] = true; - AddMapEntry(new Color(45, 44, 50)); + AddMapEntry(new Color(65, 64, 68)); + } + public override void RandomUpdate(int i, int j) + { + Tile t = Main.tile[i, j]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + } + public override void PlaceInWorld(int i, int j, Item item) + { + Tile t = Main.tile[i, j]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } } public override bool CreateDust(int i, int j, ref int type) diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 11024b1055..68bd573d06 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -56,8 +56,10 @@ namespace CalamityMod.World { for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { - WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Tile tile = Main.tile[x, y]; + tile.TileType = (ushort)ModContent.TileType(); + tile.HasTile = true; + tile.WallType = (ushort)ModContent.WallType(); } } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index c194a29e6e..c32660eda1 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -446,6 +446,9 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; + ushort Shellstone = (ushort)ModContent.TileType(); + ushort ShellstoneWall = (ushort)ModContent.WallType(); + // Generate the actual caverns bool runOnce = false; // This is used to make the wall on the left side go boom on the second run for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) @@ -454,6 +457,7 @@ namespace CalamityMod.World { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { + Tile t = Main.tile[X, Y]; float percent = dist / constant; float blurPercent = 0.99f; if (percent > blurPercent) @@ -483,9 +487,14 @@ namespace CalamityMod.World // Kill or place tiles depending on the noise map if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + { WorldGen.KillTile(X, Y); + } else - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + { + t.TileType = Shellstone; + t.HasTile = true; + } // Place walls in the biome using a different "seed" so it differs from the cave generation // This creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through @@ -496,7 +505,10 @@ namespace CalamityMod.World float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + { + t.WallType = ShellstoneWall; + } + if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) WorldGen.KillTile(X, Y); @@ -613,11 +625,15 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; + ushort Limestone = (ushort)ModContent.TileType(); + ushort LimestoneWall = (ushort)ModContent.WallType(); + // Place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) { + Tile t = Main.tile[X, Y]; // Modify this part so that the generation happens from bottom to top if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { @@ -662,7 +678,8 @@ namespace CalamityMod.World } else { - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + t.TileType = Limestone; + t.HasTile = true; } //place walls in the biome using a different "seed" so it differs from the cave generation @@ -675,13 +692,13 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - //temporarily use navystone - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + t.WallType = LimestoneWall; } if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + if (t.WallType == 0) + t.WallType = (ushort)ModContent.WallType(); } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -849,6 +866,9 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; + ushort Navystone = (ushort)ModContent.TileType(); + ushort NavystoneWall = (ushort)ModContent.WallType(); + //place another barrier so the gleaming burrows doesnt just burst into the gully for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 10) { @@ -856,6 +876,7 @@ namespace CalamityMod.World { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { + Tile t = Main.tile[X, Y]; float percent = dist / constant; float blurPercent = 0.98f; @@ -890,6 +911,7 @@ namespace CalamityMod.World { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { + Tile t = Main.tile[X, Y]; float percent = dist / constant; float blurPercent = 0.99f; @@ -936,7 +958,8 @@ namespace CalamityMod.World } else { - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + t.TileType = Navystone; + t.HasTile = true; } float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; @@ -947,7 +970,7 @@ namespace CalamityMod.World if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + t.WallType = (ushort)ModContent.WallType(); } //place walls in the biome using a different "seed" so it differs from the cave generation @@ -960,7 +983,8 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + if (t.WallType == 0) + t.WallType = NavystoneWall; } @@ -1099,6 +1123,7 @@ namespace CalamityMod.World { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { + Tile t = Main.tile[X, Y]; if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { float percent = dist / constant; @@ -1142,7 +1167,7 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + t.WallType = (ushort)ModContent.WallType(); } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; @@ -1242,6 +1267,107 @@ namespace CalamityMod.World } //basalt biome underneath the sunken sea + public static void PlaceBasaltGullyBorderBlend(int startPosX, int startPosY) + { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY; + + int biomeSize = 270 + (Main.maxTilesX / 180); + + int XLeft = GenVars.UndergroundDesertLocation.Left + 40; + int XRight = GenVars.UndergroundDesertLocation.Right - 70; + + ushort Basalt = (ushort)ModContent.TileType(); + ushort BasaltWall = (ushort)ModContent.WallType(); + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance + for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) + { + const int totalCurveDepth = -320; + const int totalCurveDepthTop = 45; + + var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); + var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); + + + int curveDepth = (int)MathHelper.Lerp( + totalCurveDepth, + 0f, squrt); + int curveDepth2 = (int)MathHelper.Lerp( + totalCurveDepth, 0f, squrt2); + int curveDepthtop = (int)MathHelper.Lerp( + totalCurveDepthTop, + 0f, squrt); + int curveDepth2top = (int)MathHelper.Lerp( + totalCurveDepthTop, + 0f, squrt2); + + int Height = Main.maxTilesY - 270 + curveDepth + curveDepth2; + int StartHeight = startY - (625) + curveDepthtop + curveDepth2top; + + for (int Y = StartHeight; Y <= Height; Y++) + { + Tile t = Main.tile[X, Y]; + if (Main.tile[X, Y].HasTile) + { + t.TileType = Basalt; + t.HasTile = true; + } + + t.WallType = BasaltWall; + + //place sand clumps on top of exposed basalt + bool canPlaceSand = false; + + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 3, ModContent.TileType()); + } + } + + } + + //cleanup + for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) + { + for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + + //if any sand is floating, put tiles below it + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); + } + Tile.SmoothSlope(X, Y); + } + } + } public static void PlaceBasaltGully(int startPosX, int startPosY) { int startX = startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX; @@ -1252,41 +1378,54 @@ namespace CalamityMod.World int XLeft = GenVars.UndergroundDesertLocation.Left + 40; int XRight = GenVars.UndergroundDesertLocation.Right - 70; + + ushort Basalt = (ushort)ModContent.TileType(); + ushort BasaltWall = (ushort)ModContent.WallType(); + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) { int leftEdge = startX - biomeSize - 60; int rightEdge = startX + biomeSize + 60; - int basaltbordernoise = Main.rand.Next(0, 4); - int basaltbordernoisetop = Main.rand.Next(0, 4); + int basaltbordernoise = 270 + Main.rand.Next(0, 4); + int basaltbordernoisetop = 625 + Main.rand.Next(0, 4); const int totalCurveDepth = -320; const int totalCurveDepthTop = 45; + + var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); + var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); + + int curveDepth = (int)MathHelper.Lerp( totalCurveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true))); + 0f, squrt); int curveDepth2 = (int)MathHelper.Lerp( - totalCurveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true))); + totalCurveDepth, 0f, squrt2); int curveDepthtop = (int)MathHelper.Lerp( totalCurveDepthTop, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true))); + 0f, squrt); int curveDepth2top = (int)MathHelper.Lerp( - totalCurveDepthTop, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true))); + totalCurveDepthTop, + 0f, squrt2); - for (int Y = startY - (625 + basaltbordernoisetop) + curveDepthtop + curveDepth2top; Y <= Main.maxTilesY - (270 + basaltbordernoise) + curveDepth + curveDepth2; Y++) + int Height = Main.maxTilesY - basaltbordernoise + curveDepth + curveDepth2; + int StartHeight = startY - (basaltbordernoisetop) + curveDepthtop + curveDepth2top; + + for (int Y = StartHeight; Y <= Height; Y++) { int leftIndent = Main.rand.Next(0, 12); int rightIndent = Main.rand.Next(0, 12); if (X < leftEdge + leftIndent || X > rightEdge - rightIndent) continue; - Main.tile[X, Y].ClearEverything(); - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + + Tile t = Main.tile[X, Y]; + t.ClearEverything(); + t.TileType = Basalt; + t.WallType = BasaltWall; + t.HasTile = true; } } @@ -1297,17 +1436,24 @@ namespace CalamityMod.World { if (Main.tile[X, Y].TileType == ModContent.TileType()) { + Tile t = Main.tile[X, Y]; //place caves - if (WorldGen.genRand.NextBool(350)) + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 130, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( - WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.ClearTile())); + t.HasTile = false; + t.LiquidType = 1; } //place lava if (WorldGen.genRand.NextBool(2000)) { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new Modifiers.Blotches( WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.SetLiquid(LiquidID.Lava, 255))); } } @@ -1366,22 +1512,25 @@ namespace CalamityMod.World } } } + //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) { + ushort BasaltWall = (ushort)ModContent.WallType(); int biomeSize = 230 + (Main.maxTilesX / 180); for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) { - if (Main.tile[X, Y].WallType == WallID.LavaUnsafe1) + Tile t = Main.tile[X, Y]; + if (Main.tile[X, Y].WallType == BasaltWall) { //get rid of water if (Main.tile[X, Y].LiquidType == LiquidID.Water) { - Main.tile[X, Y].Get().LiquidType = LiquidID.Lava; + t.LiquidType = 1; } //get rid of obsidian blocks @@ -1585,11 +1734,20 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); } } + //grow depth vines on navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } if (Main.tile[X, Y].TileType == ModContent.TileType()) { int Rand3() => WorldGen.genRand.Next(3); - int TableCoralVariants = Rand3(); - int SpeleothemsVariants = Rand3(); + int TableCoralVariants = WorldGen.genRand.Next(3); + int SpeleothemsVariants = WorldGen.genRand.Next(3); int Rand6() => WorldGen.genRand.Next(6); int NavystonePileVariants = Rand6(); @@ -1645,17 +1803,6 @@ namespace CalamityMod.World { WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); } - - - //grow depth vines on navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } } //Polyp Forest Ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) @@ -1673,7 +1820,15 @@ namespace CalamityMod.World ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); } - + } + //GilHerb Vines + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -1699,8 +1854,7 @@ namespace CalamityMod.World } if (WorldGen.genRand.NextBool(25)) { - ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); } @@ -1755,15 +1909,7 @@ namespace CalamityMod.World if (WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), mute: true)) shipPlaced = true; } - //GilHerb Vines - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } + } //radiant reefs ambient tiles @@ -1856,7 +2002,6 @@ namespace CalamityMod.World CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } - if (Main.tile[X, Y].TileType == ModContent.TileType()) { int Rand4() => WorldGen.genRand.Next(4); @@ -2058,7 +2203,7 @@ namespace CalamityMod.World WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), - new Actions.SetLiquid() + new Actions.ClearWall(true) })); } }