diff --git a/Items/Armor/Vanity/SnailHead.cs b/Items/Armor/Vanity/AbyssHood.cs similarity index 77% rename from Items/Armor/Vanity/SnailHead.cs rename to Items/Armor/Vanity/AbyssHood.cs index b983bc3fd3..ab6f97d03a 100644 --- a/Items/Armor/Vanity/SnailHead.cs +++ b/Items/Armor/Vanity/AbyssHood.cs @@ -8,7 +8,7 @@ using CalamityMod.Items.Materials; namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] - public class SnailHead : ModItem, ILocalizedModType + public class AbyssHood : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Vanity"; @@ -32,10 +32,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddIngredient(18). - AddTile(TileID.Loom). - Register(); + AddIngredient(10). + AddIngredient(18). + AddIngredient(ItemID.Silk, 20). + AddTile(TileID.Loom). + Register(); } } } diff --git a/Items/Armor/Vanity/AbyssHood.png b/Items/Armor/Vanity/AbyssHood.png new file mode 100644 index 0000000000..22a2002aa4 Binary files /dev/null and b/Items/Armor/Vanity/AbyssHood.png differ diff --git a/Items/Armor/Vanity/AbyssHood_Head.png b/Items/Armor/Vanity/AbyssHood_Head.png new file mode 100644 index 0000000000..bc360ce6e0 Binary files /dev/null and b/Items/Armor/Vanity/AbyssHood_Head.png differ diff --git a/Items/Armor/Vanity/SnailRobe.cs b/Items/Armor/Vanity/AbyssRobe.cs similarity index 76% rename from Items/Armor/Vanity/SnailRobe.cs rename to Items/Armor/Vanity/AbyssRobe.cs index 5583c2b26b..2cf43909a3 100644 --- a/Items/Armor/Vanity/SnailRobe.cs +++ b/Items/Armor/Vanity/AbyssRobe.cs @@ -8,7 +8,7 @@ using CalamityMod.Items.Materials; namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Body)] - public class SnailRobe : ModItem, ILocalizedModType + public class AbyssRobe : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Vanity"; @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Vanity { if (Main.netMode != NetmodeID.Server) { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/SnailRobe_Legs", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/AbyssRobe_Legs", EquipType.Legs, this); } } @@ -38,11 +38,11 @@ namespace CalamityMod.Items.Armor.Vanity public override void AddRecipes() { CreateRecipe(). - AddIngredient(22). - AddIngredient(25). - AddIngredient(ItemID.Silk, 25). - AddTile(TileID.Loom). - Register(); + AddIngredient(22). + AddIngredient(25). + AddIngredient(ItemID.Silk, 25). + AddTile(TileID.Loom). + Register(); } } } diff --git a/Items/Armor/Vanity/AbyssRobe.png b/Items/Armor/Vanity/AbyssRobe.png new file mode 100644 index 0000000000..41b58da833 Binary files /dev/null and b/Items/Armor/Vanity/AbyssRobe.png differ diff --git a/Items/Armor/Vanity/AbyssRobe_Body.png b/Items/Armor/Vanity/AbyssRobe_Body.png new file mode 100644 index 0000000000..20739d0742 Binary files /dev/null and b/Items/Armor/Vanity/AbyssRobe_Body.png differ diff --git a/Items/Armor/Vanity/AbyssRobe_Legs.png b/Items/Armor/Vanity/AbyssRobe_Legs.png new file mode 100644 index 0000000000..1d14db1b22 Binary files /dev/null and b/Items/Armor/Vanity/AbyssRobe_Legs.png differ diff --git a/Items/Armor/Vanity/SnailHead.png b/Items/Armor/Vanity/SnailHead.png deleted file mode 100644 index ef910c17de..0000000000 Binary files a/Items/Armor/Vanity/SnailHead.png and /dev/null differ diff --git a/Items/Armor/Vanity/SnailHead_Head.png b/Items/Armor/Vanity/SnailHead_Head.png deleted file mode 100644 index da5f861251..0000000000 Binary files a/Items/Armor/Vanity/SnailHead_Head.png and /dev/null differ diff --git a/Items/Armor/Vanity/SnailRobe.png b/Items/Armor/Vanity/SnailRobe.png deleted file mode 100644 index a94baf2426..0000000000 Binary files a/Items/Armor/Vanity/SnailRobe.png and /dev/null differ diff --git a/Items/Armor/Vanity/SnailRobe_Body.png b/Items/Armor/Vanity/SnailRobe_Body.png deleted file mode 100644 index b64ae33c30..0000000000 Binary files a/Items/Armor/Vanity/SnailRobe_Body.png and /dev/null differ diff --git a/Items/Armor/Vanity/SnailRobe_Legs.png b/Items/Armor/Vanity/SnailRobe_Legs.png deleted file mode 100644 index cf1a2f9537..0000000000 Binary files a/Items/Armor/Vanity/SnailRobe_Legs.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index 2973515dce..626498de15 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -243,12 +243,12 @@ YharonMask: { Tooltip: "" } -SnailHead: { - DisplayName: Wearable Head Snail - Tooltip: "" +AbyssHood: { + DisplayName: Abyss Cultist Hood + Tooltip: Turns your face into tentacles } -SnailRobe: { - DisplayName: Fancy Abyss Robe - Tooltip: "" +AbyssRobe: { + DisplayName: Abyss Cultist Robe + Tooltip: It feels cold, but very cozy } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index b124fbe7a9..bf73e261b3 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -127,11 +127,12 @@ namespace CalamityMod.Systems int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; int sunkenSeaY = Main.maxTilesY / 2; - SunkenSea.PlaceRadiantReefs(sunkenSeaX - 130, sunkenSeaY + 75, true); - SunkenSea.PlaceRadiantReefs(sunkenSeaX + 130, sunkenSeaY + 75, false); + //place each piece of the sunken sea based on the above positons + SunkenSea.PlaceRadiantReefs(sunkenSeaX - 100, sunkenSeaY + 75, true); + SunkenSea.PlaceRadiantReefs(sunkenSeaX + 100, sunkenSeaY + 75, false); SunkenSea.PlacePolypForest(sunkenSeaX, sunkenSeaY + 75); SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); - SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); + SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); SunkenSea.PlaceSunkenSeaAmbience(); SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); })); diff --git a/Tiles/Abyss/AbyssCoral.cs b/Tiles/Abyss/AbyssCoral.cs new file mode 100644 index 0000000000..beb50b9a0a --- /dev/null +++ b/Tiles/Abyss/AbyssCoral.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace CalamityMod.Tiles.Abyss +{ + public class AbyssCoral : ModTile + { + public byte[,] tileAdjacency; + + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + Main.tileLighted[Type] = true; + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Dig; + DustType = 119; + AddMapEntry(new Color(139, 206, 56)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) + { + float brightness = 0.9f; + Color Color1 = new Color(52, 84, 107); + Color Color2 = new Color(29, 38, 56); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + r = (value.R + value1.R) / 300f; + g = (value.G + value1.G) / 300f; + b = (value.B + value1.B) / 300f; + r *= brightness; + g *= brightness; + b *= brightness; + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + TileFraming.GetAdjacencyData(i, j, ModContent.TileType(), out tileAdjacency[i, j]); + return TileFraming.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs index 13beaf5a31..bcffb9392d 100644 --- a/Tiles/SunkenSea/CyanCoral.cs +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -50,10 +50,10 @@ namespace CalamityMod.Tiles.SunkenSea if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { float brightness = 0.9f; - Color Cyan1 = new Color(130, 213, 247); - Color Cyan2 = new Color(26, 68, 85); - Color value = Color.Lerp(Cyan1, Cyan2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Cyan1, Cyan2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + Color Color1 = new Color(130, 213, 247); + Color Color2 = new Color(26, 68, 85); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); r = (value.R + value1.R) / 400f; g = (value.G + value1.G) / 400f; b = (value.B + value1.B) / 400f; diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index 20eca33764..98c8a0ff88 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Placeables; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -62,5 +64,44 @@ namespace CalamityMod.Tiles.SunkenSea TileFraming.GetAdjacencyData(i, j, TileID.Sand, out fifthTileAdjacency[i, j]); return TileFraming.BrimstoneFraming(i, j, resetFrame); } + + public override void RandomUpdate(int i, int j) + { + Tile tile = Main.tile[i, j]; + Tile up = Main.tile[i, j - 1]; + Tile up2 = Main.tile[i, j - 2]; + + if (!up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + //brain corals + if (WorldGen.genRand.NextBool(18)) + { + ushort[] BrainCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(BrainCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //tube corals + if (WorldGen.genRand.NextBool(8)) + { + ushort[] TubeCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + ushort newObject = Main.rand.Next(TubeCorals); + + WorldGen.PlaceObject(i, j - 1, newObject, true); + NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); + } + + //anemonie + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType(), true); + NetMessage.SendObjectPlacement(-1, i, j - 1, (ushort)ModContent.TileType(), 0, 0, -1, -1); + } + } + } } } diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs index d597331738..d64276807a 100644 --- a/Tiles/SunkenSea/LimeCoral.cs +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Tiles.SunkenSea if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { float brightness = 0.9f; - Color Lime1 = new Color(176, 242, 96); - Color Lime2 = new Color(82, 113, 29); - Color value = Color.Lerp(Lime1, Lime2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Lime1, Lime2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + Color Color1 = new Color(176, 242, 96); + Color Color2 = new Color(82, 113, 29); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); r = (value.R + value1.R) / 300f; g = (value.G + value1.G) / 300f; b = (value.B + value1.B) / 300f; diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs index 3df1e09d1a..ed7657f1cc 100644 --- a/Tiles/SunkenSea/MagentaCoral.cs +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Tiles.SunkenSea if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { float brightness = 0.9f; - Color Magenta1 = new Color(242, 96, 161); - Color Magenta2 = new Color(156, 51, 83); - Color value = Color.Lerp(Magenta1, Magenta2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Magenta1, Magenta2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + Color Color1 = new Color(242, 96, 161); + Color Color2 = new Color(156, 51, 83); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); r = (value.R + value1.R) / 300f; g = (value.G + value1.G) / 300f; b = (value.B + value1.B) / 300f; diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs index b9340c872e..bdeca4d1f6 100644 --- a/Tiles/SunkenSea/OrangeCoral.cs +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Tiles.SunkenSea if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { float brightness = 0.9f; - Color Orange1 = new Color(255, 177, 120); - Color Orange2 = new Color(117, 23, 44); - Color value = Color.Lerp(Orange1, Orange2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Orange1, Orange2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + Color Color1 = new Color(255, 177, 120); + Color Color2 = new Color(117, 23, 44); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); r = (value.R + value1.R) / 300f; g = (value.G + value1.G) / 300f; b = (value.B + value1.B) / 300f; diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs index d0e60e4c71..c057374302 100644 --- a/Tiles/SunkenSea/YellowCoral.cs +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -42,10 +42,10 @@ namespace CalamityMod.Tiles.SunkenSea if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { float brightness = 0.9f; - Color Yellow1 = new Color(218, 203, 67); - Color Yellow2 = new Color(121, 76, 1); - Color value = Color.Lerp(Yellow1, Yellow2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Yellow1, Yellow2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); + Color Color1 = new Color(218, 203, 67); + Color Color2 = new Color(121, 76, 1); + Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); + Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); r = (value.R + value1.R) / 300f; g = (value.G + value1.G) / 300f; b = (value.B + value1.B) / 300f; diff --git a/World/Abyss.cs b/World/Abyss.cs index 4c53863e6e..78b085a588 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -51,11 +51,11 @@ namespace CalamityMod.World int abyssMinX = AtLeftSideOfWorld ? 0 : abyssChasmX - 160; int abyssMaxX = AtLeftSideOfWorld ? abyssChasmX + 160 : x; - for (int abyssIndex = abyssMinX; abyssIndex < abyssMaxX; abyssIndex++) + for (int X = abyssMinX; X < abyssMaxX; X++) { - for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY + 50; abyssIndex2++) + for (int Y = 0; Y < abyssChasmY + 50; Y++) { - Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + Tile tile = Framing.GetTileSafely(X, Y); if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) { @@ -70,43 +70,43 @@ namespace CalamityMod.World //i have at least left comments so people reading will know what does what if (Main.remixWorld) { - if (abyssIndex2 <= rockLayer) + if (Y <= rockLayer) { //replaces blocks wand walls that can be converted if (canConvert) { //layer 4 - if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.6f)) + if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.4f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.2f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.19f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) { if (WorldGen.genRand.NextBool(2)) { @@ -132,37 +132,37 @@ namespace CalamityMod.World tile.Get().HasTile = true; //layer 4 - if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.6f)) + if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.4f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) + else if (Y <= rockLayer - (int)((y - 200) * 0.39f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2 - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.2f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 <= rockLayer - (int)((y - 200) * 0.19f)) + else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) { if (WorldGen.genRand.NextBool(2)) { @@ -186,37 +186,37 @@ namespace CalamityMod.World } else { - if (abyssIndex2 > (rockLayer - Main.maxTilesY / 15) + 35) + if (Y > (rockLayer - Main.maxTilesY / 15) + 35) { - //replaces blocks wand walls that can be converted + //replaces blocks and walls that can be converted if (canConvert) { //layer 4 - if (abyssIndex2 > (rockLayer + y * 0.270)) + if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 > (rockLayer + y * 0.145)) + else if (Y > (rockLayer + y * 0.145)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) + else if (Y >= rockLayer - 10 && Y <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { @@ -230,7 +230,7 @@ namespace CalamityMod.World } } //layer 1 - else if (abyssIndex2 <= rockLayer - 10) + else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); @@ -248,31 +248,31 @@ namespace CalamityMod.World tile.Get().HasTile = true; //layer 4 - if (abyssIndex2 > (rockLayer + y * 0.270)) + if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 3 - else if (abyssIndex2 > (rockLayer + y * 0.145)) + else if (Y > (rockLayer + y * 0.145)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 2-3 dithering transition - else if (abyssIndex2 > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) + else if (Y > (rockLayer + y * 0.143) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition - else if (abyssIndex2 >= rockLayer - 10 && abyssIndex2 <= rockLayer) + else if (Y >= rockLayer - 10 && Y <= rockLayer) { if (WorldGen.genRand.NextBool(2)) { @@ -286,7 +286,7 @@ namespace CalamityMod.World } } //layer 1 - else if (abyssIndex2 <= rockLayer - 10) + else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); tile.WallType = (ushort)ModContent.WallType(); @@ -523,27 +523,27 @@ namespace CalamityMod.World } //clean up - for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) + for (int X = abyssMinX + 5; X < abyssMaxX - 5; X++) { - for (int abyssIndex2 = 5; abyssIndex2 < abyssChasmY; abyssIndex2++) + for (int Y = 5; Y < abyssChasmY; Y++) { - Tile tile = Main.tile[abyssIndex, abyssIndex2]; - Tile tileUp = Main.tile[abyssIndex, abyssIndex2 - 1]; - Tile tileDown = Main.tile[abyssIndex, abyssIndex2 + 1]; - Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; - Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; + Tile tile = Main.tile[X, Y]; + Tile tileUp = Main.tile[X, Y - 1]; + Tile tileDown = Main.tile[X, Y + 1]; + Tile tileLeft = Main.tile[X - 1, Y]; + Tile tileRight = Main.tile[X + 1, Y]; if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) { //slope tiles - Tile.SmoothSlope(abyssIndex, abyssIndex2, true); + Tile.SmoothSlope(X, Y, true); //kill any individual floating tiles if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) { - WorldGen.KillTile(abyssIndex, abyssIndex2); + WorldGen.KillTile(X, Y); } } @@ -557,24 +557,24 @@ namespace CalamityMod.World //kill obsidian if (tile.TileType == TileID.Obsidian) { - WorldGen.KillTile(abyssIndex, abyssIndex2); + WorldGen.KillTile(X, Y); } } } //ambient tiles and pots - for (int abyssIndex = abyssMinX + 5; abyssIndex < abyssMaxX - 5; abyssIndex++) + for (int X = abyssMinX + 5; X < abyssMaxX - 5; X++) { - for (int abyssIndex2 = 0; abyssIndex2 < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200); abyssIndex2++) + for (int Y = 0; Y < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200); Y++) { - Tile tileToGrowVineOn = Main.tile[abyssIndex, abyssIndex2]; + Tile tileToGrowVineOn = Main.tile[X, Y]; - if (!Main.tile[abyssIndex, abyssIndex2].HasTile) + if (!Main.tile[X, Y].HasTile) { - Tile tile = Main.tile[abyssIndex, abyssIndex2 + 1]; + Tile tile = Main.tile[X, Y + 1]; //above the 4th layer - if (abyssIndex2 < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + if (Y < (Main.remixWorld ? rockLayer : Main.maxTilesY - 200) && WorldGen.SolidTile(X, Y + 1)) { //sulphur shale stuff if (tile.TileType == ModContent.TileType()) @@ -582,7 +582,7 @@ namespace CalamityMod.World //tube coral if (WorldGen.genRand.NextBool(85)) { - WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + WorldGen.PlaceObject(X, Y, (ushort)ModContent.TileType()); } //shale rock piles @@ -591,7 +591,7 @@ namespace CalamityMod.World ushort[] ShalePiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(ShalePiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(ShalePiles)); } //pire corals @@ -600,7 +600,7 @@ namespace CalamityMod.World ushort[] PireCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PireCorals)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PireCorals)); } //sulphur fossils @@ -609,7 +609,7 @@ namespace CalamityMod.World ushort[] SulphuricFossils = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SulphuricFossils)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(SulphuricFossils)); } //ribs @@ -619,7 +619,7 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Ribs)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Ribs)); } } @@ -631,17 +631,33 @@ namespace CalamityMod.World ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PlantPiles)); } } //abyss gravel stuff if (tile.TileType == ModContent.TileType()) { + //place coral blobs + if (WorldGen.genRand.NextBool(125) && !Main.tile[X, Y - 1].HasTile) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 4)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + //rare pearls if (WorldGen.genRand.NextBool(50)) { - WorldGen.PlaceObject(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + WorldGen.PlaceObject(X, Y, (ushort)ModContent.TileType()); } //giant kelp on abyss gravel @@ -650,7 +666,7 @@ namespace CalamityMod.World ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Kelps)); } //plany mush piles @@ -659,7 +675,7 @@ namespace CalamityMod.World ushort[] PlantPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PlantPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PlantPiles)); } //gravel rock piles @@ -668,7 +684,7 @@ namespace CalamityMod.World ushort[] GravelPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(GravelPiles)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(GravelPiles)); } //abyss gravel vents @@ -677,7 +693,7 @@ namespace CalamityMod.World ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Vents)); } //pirate crates @@ -686,7 +702,7 @@ namespace CalamityMod.World ushort[] PirateCrate = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(PirateCrate)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(PirateCrate)); } } @@ -700,7 +716,7 @@ namespace CalamityMod.World (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(SpiderCorals)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(SpiderCorals)); } //thermal vent @@ -709,7 +725,7 @@ namespace CalamityMod.World ushort[] Vents = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Vents)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(Vents)); } } @@ -722,57 +738,57 @@ namespace CalamityMod.World ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + WorldGen.PlaceObject(X, Y, WorldGen.genRand.Next(BulbTrees)); } } } //pots if ((tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType()) && abyssIndex2 > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) + tile.TileType == ModContent.TileType()) && Y > (Main.remixWorld ? rockLayer - (int)((y - 200) * 0.8f) : rockLayer)) { if (WorldGen.genRand.NextBool(5)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGen.PlacePot(X, Y, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(X, Y, true); } } //sulphur pots - else if (tile.TileType == ModContent.TileType() && abyssIndex2 < (Main.remixWorld ? Main.maxTilesY - 200 : (int)Main.worldSurface)) + else if (tile.TileType == ModContent.TileType() && Y < (Main.remixWorld ? Main.maxTilesY - 200 : (int)Main.worldSurface)) { if (WorldGen.genRand.NextBool(3)) { - WorldGen.PlacePot(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGen.PlacePot(X, Y, (ushort)ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(X, Y, true); } } } //esentially what this does is grow one vine on the bottom of a tile, then use the util to keep placing the vine until it decides to stop - if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[abyssIndex, abyssIndex2].Slope == 0 && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile) { if (WorldGen.genRand.Next(2) == 0) { - WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } } if (tileToGrowVineOn.TileType == ModContent.TileType()) { - CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } //same as above but for sulphur vines - if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[abyssIndex, abyssIndex2].Slope == 0 && !Main.tile[abyssIndex, abyssIndex2 + 1].HasTile) + if (tileToGrowVineOn.TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile) { if (WorldGen.genRand.Next(5) == 0) { - WorldGen.PlaceTile(abyssIndex, abyssIndex2 + 1, (ushort)ModContent.TileType()); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); } } if (tileToGrowVineOn.TileType == ModContent.TileType()) { - CalamityUtils.GrowVines(abyssIndex, abyssIndex2, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 52f5026c70..82c6115cc2 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -326,61 +326,35 @@ namespace CalamityMod.World public static void PlaceSunkenSeaLab(out Point placementPoint, List workshopPoints, StructureMap structures) { - int tries = 0; string mapKey = SunkenSeaLabKey; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); SchematicMetaTile[,] schematic = TileMaps[mapKey]; int labWidth = schematic.GetLength(0); int labHeight = schematic.GetLength(1); - do - { - // Pick a location based on the Underground Desert, because the Sunken Sea is based on the Underground Desert - Rectangle ugDesert = GenVars.UndergroundDesertLocation; - int placementPositionX = -1; + int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; + int sunkenSeaY = Main.maxTilesY / 2; - // Desperation generation: if 75% of attempts failed, start generating literally anywhere in the Sunken Sea - if (tries >= 1500) - placementPositionX = WorldGen.genRand.Next(ugDesert.Left, ugDesert.Right - labWidth); - // 50% chance to be on either the left or the right. - // If it's on the right then shove it left because all schematics are placed based on their top left corner. - else if (WorldGen.genRand.NextBool()) - placementPositionX = WorldGen.genRand.Next(ugDesert.Left - 20, ugDesert.Left + 10); - else - placementPositionX = WorldGen.genRand.Next(ugDesert.Right - 10, ugDesert.Right + 20) - labWidth; + int placementPositionX = sunkenSeaX < Main.maxTilesX / 2 ? sunkenSeaX - 120 : sunkenSeaX + 120; + int placementPositionY = (sunkenSeaY + (Main.maxTilesY / 4) - 25) - labHeight; - int sunkenSeaY = 0; + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); - //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.worldSurface; y--) - { - if (Main.tile[placementPositionX, y].WallType == ModContent.WallType() || - Main.tile[placementPositionX, y].WallType == ModContent.WallType()) - { - sunkenSeaY = y - 80; //offset so it generates nicely - break; - } - } + /* + I do not think that this check needs to exist for now, no other structures exist in the sunken sea at the moment + Once other sunken sea structures are added, i will likely re-enable this and modify the generation so that it avoids protected areas again + This is just so i can have it generating in time for the patreon beta + */ - int placementPositionY = sunkenSeaY - labHeight; - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); - - if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) - { - bool hasPlacedLogAndSchematic = false; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); - CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); - //Reverted changes to center point placement; the change caused it to not center like it should, offsetting the range at which the bio lab theme plays - CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; - break; - } - //try again if the structure is colliding with a structure from another mod - else - tries++; - } - while (tries <= 2000); + //if (structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + //{ + bool hasPlacedLogAndSchematic = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); + CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 20); + //Reverted changes to center point placement; the change caused it to not center like it should, offsetting the range at which the bio lab theme plays + CalamityWorld.SunkenSeaLabCenter = placementPoint.ToWorldCoordinates() + new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)) * 8f; + //} } #endregion diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index 31735c62b1..fa42696412 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -681,7 +681,7 @@ namespace CalamityMod.World int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(x + (x < Main.maxTilesX / 2 ? -10 : 10), YStart + depth + 80); + Point origin = new Point(x + (x < Main.maxTilesX / 2 ? -35 : 35), YStart + depth + 80); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); float angle = MathHelper.Pi * 0.15f; @@ -705,31 +705,93 @@ namespace CalamityMod.World { if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); + float percent = dist / constant; + float blurPercent = 0.98f; - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 20f, Y / 20f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + if (percent > blurPercent) { - WorldGen.KillTile(X, Y); + } else { - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 20f, Y / 20f, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 1000f, Y / 350f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; + + //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()); + } + + Main.tile[X, Y].WallType = (ushort)ModContent.WallType(); + WorldGen.PlaceWall(X, Y, ModContent.WallType()); + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + //place sand + for (int X = origin.X - size - 3; X <= origin.X + size + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) + { + canPlaceSand = true; } - Main.tile[X, Y].WallType = (ushort)ModContent.WallType(); - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + if (canPlaceSand) + { + SunkenSea.PlaceSand(X, Y, 3, ModContent.TileType()); + } + } + } + } - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; + //cleanup + for (int X = origin.X - size - 3; X <= origin.X + size + 3; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckReefsCircle(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist)) + { + //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); + } + + Tile.SmoothSlope(X, Y); } } } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 66ca590223..a7e9937ef9 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -189,20 +189,6 @@ namespace CalamityMod.World } } - 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++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) - { - if (!Main.tile[X, Y].HasTile && 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.PlaceTile(X, Y, (ushort)ModContent.TileType()); - } - } - } - } - //place extra tiles for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { @@ -276,7 +262,7 @@ namespace CalamityMod.World float angle = MathHelper.Pi * 0.15f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 140 + (Main.maxTilesX / 180); + int biomeSize = 120 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); @@ -469,13 +455,34 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + //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) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { + float percent = dist / constant; + float blurPercent = 0.98f; + if (percent > blurPercent) + { + if (Y > origin.Y + 20) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y + 10), new Shapes.Circle(20), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y + 10), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } } } } @@ -652,84 +659,55 @@ namespace CalamityMod.World //basalt biome underneath the sunken sea public static void PlaceBasaltGully(int startPosX, int startPosY) { - Point origin = new Point(startPosX, startPosY); - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 230 + (Main.maxTilesX / 180); - float actualSize = biomeSize * 16f; - float constant = actualSize * 2f / (float)Math.Sin(angle); - float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - //first, place a basalt barrier around where the gleaming burrows will be - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) + //place area of basalt all the way down to hell + for (int X = startPosX - biomeSize; X <= startPosX + biomeSize; X += 20) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + for (int Y = startPosY + 20; Y <= Main.maxTilesY - 250; Y += 20) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + if (Main.tile[X, Y].TileType != ModContent.TileType()) { - float percent = dist / constant; - float blurPercent = 0.98f; - - if (percent > blurPercent) + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] { - if (Y > origin.Y + 75 && Main.tile[X, Y].TileType != ModContent.TileType()) + blotchMod.Output(circle) + })); + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + + //place a giant area of basalt below the sunken sea + for (int j = Y; j <= Main.maxTilesY - 250; j += 15) + { + int radius = WorldGen.genRand.Next(30, 45); + int RandomX = Main.rand.Next(-25, 25); + + WorldUtils.Gen(new Point(X + RandomX, j), new Shapes.Circle(radius), Actions.Chain(new GenAction[] { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(60), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); + blotchMod.Output(circle) + })); - //place a giant area of basalt below the sunken sea - for (int j = Y; j <= Main.maxTilesY - 250; j += 15) - { - int radius = WorldGen.genRand.Next(30, 45); - int RandomX = Main.rand.Next(-25, 25); - - WorldUtils.Gen(new Point(X + RandomX, j), new Shapes.Circle(radius), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - List WallIDs = new() - { - WallID.LavaUnsafe1, WallID.LavaUnsafe2, WallID.LavaUnsafe3, WallID.LavaUnsafe4, - }; - - //place blocks - WorldUtils.Gen(new Point(X + RandomX, j), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - new Actions.PlaceWall(WorldGen.genRand.Next(WallIDs)) - })); - } - } + //place blocks + WorldUtils.Gen(new Point(X + RandomX, j), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.Clear(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall(WallID.LavaUnsafe1) + })); } } } } //place caverns and lava - for (int X = origin.X - biomeSize - (Main.maxTilesX / 25); X <= origin.X + biomeSize + (Main.maxTilesX / 25); X++) + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = origin.Y + 50; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { if (Main.tile[X, Y].TileType == ModContent.TileType()) { @@ -751,9 +729,9 @@ namespace CalamityMod.World } //place sand blocks - for (int X = origin.X - biomeSize - (Main.maxTilesX / 25); X <= origin.X + biomeSize + (Main.maxTilesX / 25); X++) + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = origin.Y + 50; Y <= Main.maxTilesY - 200; Y++) + for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) { bool canPlaceSand = false; @@ -771,9 +749,9 @@ namespace CalamityMod.World } //cleanup - for (int X = origin.X - biomeSize - (Main.maxTilesX / 25); X <= origin.X + biomeSize + (Main.maxTilesX / 25); X++) + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = origin.Y + 50; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startPosY; 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; @@ -804,20 +782,13 @@ namespace CalamityMod.World public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) { - Point origin = new Point(startPosX, startPosY); - int biomeSize = 230 + (Main.maxTilesX / 180); - for (int X = origin.X - biomeSize - (Main.maxTilesX / 25); X <= origin.X + biomeSize + (Main.maxTilesX / 25); X++) + for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = origin.Y + 50; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) { - List WallIDs = new() - { - WallID.LavaUnsafe1, WallID.LavaUnsafe2, WallID.LavaUnsafe3, WallID.LavaUnsafe4, - }; - - if (WallIDs.Contains(Main.tile[X, Y].WallType)) + if (Main.tile[X, Y].WallType == WallID.LavaUnsafe1) { //get rid of water if (Main.tile[X, Y].LiquidType == LiquidID.Water) @@ -890,6 +861,12 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } + //anemonies + if (WorldGen.genRand.NextBool(10)) + { + WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); + } + //giant navystone piles if (WorldGen.genRand.NextBool(10)) { @@ -1186,7 +1163,7 @@ namespace CalamityMod.World if (collapse) { float distY = center.Y - point.Y; - point.Y -= distY * 3f; + point.Y -= distY * 4f; } float distance1 = Vector2.Distance(point, focus1);