diff --git a/Buffs/Pets/EidolonSnailBuff.cs b/Buffs/Pets/EidolonSnailBuff.cs index 2deb6e5aa1..6627cd3394 100644 --- a/Buffs/Pets/EidolonSnailBuff.cs +++ b/Buffs/Pets/EidolonSnailBuff.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Buffs.Pets { public override void SetStaticDefaults() { - DisplayName.SetDefault("Eidol-Cargot"); - Description.SetDefault("He probably doesn't taste good, but is very friendly"); + DisplayName.SetDefault("Escargdolon Snail"); + Description.SetDefault("It's like an Eidolon Wyrm... but a snail!"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } diff --git a/CalamityMod.cs b/CalamityMod.cs index 2cc9da341f..274765ee5c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -279,7 +279,7 @@ namespace CalamityMod Filters.Scene["CalamityMod:MonolithAccursed"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:MonolithAccursed"] = new MonolithSky(); - Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower"), EffectPriority.VeryHigh); + Filters.Scene["CalamityMod:BrimstoneCrag"] = new Filter(new MonolithScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0f).UseOpacity(0f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:BrimstoneCrag"] = new BrimstoneCragSky(); SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); diff --git a/ILEditing/ILHelperMethods.cs b/ILEditing/ILHelperMethods.cs index f11c936e0a..d86e761bb3 100644 --- a/ILEditing/ILHelperMethods.cs +++ b/ILEditing/ILHelperMethods.cs @@ -149,6 +149,41 @@ namespace CalamityMod.ILEditing initialColor.BottomRightColor *= 0.4f; } + private static void SelectSunkenSeaWaterColor(int x, int y, ref VertexColors initialColor) + { + if (SulphuricWaterSafeZoneSystem.NearbySafeTiles.Count >= 1) + { + Color cleanWaterColor = new(10, 62, 193); + Point closestSafeZone = SulphuricWaterSafeZoneSystem.NearbySafeTiles.Keys.OrderBy(t => t.ToVector2().DistanceSQ(new(x, y))).First(); + List points = new() + { + new Vector2(x - 0.5f, y - 0.5f), + new Vector2(x + 0.5f, y - 0.5f), + new Vector2(x - 0.5f, y + 0.5f), + new Vector2(x + 0.5f, y + 0.5f), + }; + + for (int i = 0; i < 4; i++) + { + float distanceToClosest = points[i].Distance(closestSafeZone.ToVector2()); + float acidicWaterInterpolant = Utils.GetLerpValue(12f, 20.5f, distanceToClosest + (1f - SulphuricWaterSafeZoneSystem.NearbySafeTiles[closestSafeZone]) * 21f, true); + if (i == 0) + initialColor.TopLeftColor = Color.Lerp(initialColor.TopLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); + if (i == 1) + initialColor.TopRightColor = Color.Lerp(initialColor.TopRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); + if (i == 2) + initialColor.BottomLeftColor = Color.Lerp(initialColor.BottomLeftColor, cleanWaterColor, 1f - acidicWaterInterpolant); + if (i == 3) + initialColor.BottomRightColor = Color.Lerp(initialColor.BottomRightColor, cleanWaterColor, 1f - acidicWaterInterpolant); + } + } + + initialColor.TopLeftColor *= 0.4f; + initialColor.TopRightColor *= 0.4f; + initialColor.BottomLeftColor *= 0.4f; + initialColor.BottomRightColor *= 0.4f; + } + public static void DumpToLog(ILContext il) => CalamityMod.Instance.Logger.Debug(il.ToString()); public static void LogFailure(string name, string reason) => CalamityMod.Instance.Logger.Warn($"IL edit \"{name}\" failed! {reason}"); } diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index dd5521da6e..bdd62df0aa 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -837,6 +837,9 @@ namespace CalamityMod.ILEditing if (liquidType == ModContent.Find("CalamityMod/SulphuricWater").Slot) SelectSulphuricWaterColor(x, y, ref initialColor); + if (liquidType == ModContent.Find("CalamityMod/SunkenSeaWater").Slot) + SelectSunkenSeaWaterColor(x, y, ref initialColor); + // Apply any extra color conditions. initialColor = ExtraColorChangeConditions?.Invoke(initialColor, liquidType, new(x, y)) ?? initialColor; @@ -961,11 +964,13 @@ namespace CalamityMod.ILEditing orig(self, x, y, out outputColor); Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.LiquidAmount <= 0 || tile.HasTile || Main.waterStyle != ModContent.Find("CalamityMod/SulphuricWater").Slot) + if (tile.LiquidAmount <= 0 || tile.HasTile || Main.waterStyle != ModContent.Find("CalamityMod/SulphuricWater").Slot && + Main.waterStyle != ModContent.Find("CalamityMod/SunkenSeaWater").Slot) return; Tile above = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9)) + if (!Main.gamePaused && !above.HasTile && above.LiquidAmount <= 0 && Main.rand.NextBool(9) && + Main.waterStyle == ModContent.Find("CalamityMod/SulphuricWater").Slot) { MediumMistParticle acidFoam = new(new(x * 16f + Main.rand.NextFloat(16f), y * 16f + 8f), -Vector2.UnitY.RotatedByRandom(0.67f) * Main.rand.NextFloat(1f, 2.4f), Color.LightSeaGreen, Color.White, 0.16f, 128f, 0.02f); GeneralParticleHandler.SpawnParticle(acidFoam); diff --git a/Items/Pets/AbyssShell.cs b/Items/Pets/AbyssShell.cs index 2fb30873aa..ca3d17f9d2 100644 --- a/Items/Pets/AbyssShell.cs +++ b/Items/Pets/AbyssShell.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Pets { SacrificeTotal = 1; DisplayName.SetDefault("Abyss Shell Fossil"); - Tooltip.SetDefault("An old fossil of a goofy little abyss creature" - + "\nSummons a pet Eidol-cargot"); + Tooltip.SetDefault("A prehistoric shell, once belonging to a goofy aquatic creature" + + "\nSummons a pet Escargdolon Snail"); } public override void SetDefaults() diff --git a/Items/Placeables/SacrificialBlossomSeeds.cs b/Items/Placeables/SacrificialBlossomSeeds.cs new file mode 100644 index 0000000000..75cf3134eb --- /dev/null +++ b/Items/Placeables/SacrificialBlossomSeeds.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SacrificialBlossomSeeds : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrificial Blossom Seeds"); + Tooltip.SetDefault("Places sacrificial blossom grass on scorched remains"); + } + + public override void SetDefaults() + { + Item.useTurn = true; + Item.autoReuse = true; + Item.consumable = true; + Item.width = 16; + Item.height = 16; + Item.useTime = 15; + Item.useAnimation = 15; + Item.useStyle = ItemUseStyleID.Swing; + Item.maxStack = 999; + } + + public override bool? UseItem(Player player) + { + Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); + Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); + + if (tile.HasTile && !tileAbove.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY)) + { + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/Items/Placeables/SacrificialBlossomSeeds.png b/Items/Placeables/SacrificialBlossomSeeds.png new file mode 100644 index 0000000000..f71415f1af Binary files /dev/null and b/Items/Placeables/SacrificialBlossomSeeds.png differ diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs index 146f1451b4..23b10e94bc 100644 --- a/Projectiles/Pets/EidolonSnail.cs +++ b/Projectiles/Pets/EidolonSnail.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { - DisplayName.SetDefault("Eidolon Snail"); + DisplayName.SetDefault("Escargdolon Snail"); Main.projFrames[Projectile.type] = 6; Main.projPet[Projectile.type] = true; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Pets float playerDistance = vector48.Length(); if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && Projectile.position.X == Projectile.oldPosition.X))) { - Projectile.velocity.Y = -5f; + Projectile.velocity.Y = -8f; } Projectile.velocity.Y += 0.35f; if (Projectile.velocity.Y > 15f) @@ -84,17 +84,17 @@ namespace CalamityMod.Projectiles.Pets if (player.position.X - Projectile.position.X > 0f) { Projectile.velocity.X += 0.10f; - if (Projectile.velocity.X > 7f) + if (Projectile.velocity.X > 5f) { - Projectile.velocity.X = 7f; + Projectile.velocity.X = 5f; } } else { Projectile.velocity.X -= 0.10f; - if (Projectile.velocity.X < -7f) + if (Projectile.velocity.X < -5f) { - Projectile.velocity.X = -7f; + Projectile.velocity.X = -5f; } } } @@ -116,6 +116,10 @@ namespace CalamityMod.Projectiles.Pets } } } + if (playerDistance < 70f) + { + Projectile.velocity.X *= 0.5f; + } if (Projectile.position.X == Projectile.oldPosition.X && Projectile.position.Y == Projectile.oldPosition.Y && Projectile.velocity.X == 0) { Projectile.frame = 0; @@ -139,6 +143,15 @@ namespace CalamityMod.Projectiles.Pets Projectile.frame = 1; } } + + if (Projectile.velocity.X > 0.8f) + { + Projectile.spriteDirection = 1; + } + else if (Projectile.velocity.X < -0.8f) + { + Projectile.spriteDirection = -1; + } } else if (fly) { @@ -174,6 +187,7 @@ namespace CalamityMod.Projectiles.Pets if (playerStill > 10 && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { fly = false; + Projectile.velocity *= 0.2f; Projectile.tileCollide = true; } } @@ -231,18 +245,28 @@ namespace CalamityMod.Projectiles.Pets Projectile.velocity.Y = Projectile.velocity.Y - num16 * 2f; } } - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; + + if (playerDistance < 100f) + { + Projectile.rotation += 0.2f * (float)Projectile.direction; + } + else + { + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.05f * (float)Projectile.direction; + } + + if (Projectile.Center.X < Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = 1; + } + else if (Projectile.Center.X > Main.player[Projectile.owner].Center.X) + { + Projectile.spriteDirection = -1; + } + Projectile.frame = 5; idleTimer = 0; } - if (Projectile.velocity.X > 0.8f) - { - Projectile.spriteDirection = 1; - } - else if (Projectile.velocity.X < -0.8f) - { - Projectile.spriteDirection = -1; - } } private bool HoleBelow() //pretty much the same as the one used in mantis diff --git a/Projectiles/Pets/EidolonSnail.png b/Projectiles/Pets/EidolonSnail.png index c7a16c50b1..0cae679dc8 100644 Binary files a/Projectiles/Pets/EidolonSnail.png and b/Projectiles/Pets/EidolonSnail.png differ diff --git a/Skies/BrimstoneCragSky.cs b/Skies/BrimstoneCragSky.cs index a86f09bbb7..81f01080bf 100644 --- a/Skies/BrimstoneCragSky.cs +++ b/Skies/BrimstoneCragSky.cs @@ -104,9 +104,9 @@ namespace CalamityMod.Skies // Clear away all dead cinders. Cinders.RemoveAll(c => c.Time >= c.Lifetime); - if (!Main.LocalPlayer.Calamity().ZoneCalamity) - Filters.Scene["CalamityMod:BrimstoneCrag"].Deactivate(Array.Empty()); - } + if (!Main.LocalPlayer.Calamity().ZoneCalamity) + Filters.Scene["CalamityMod:BrimstoneCrag"].Deactivate(Array.Empty()); + } public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 1346e285d1..2d895e9637 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -134,10 +134,7 @@ namespace CalamityMod.Systems tasks.Insert(++currentFinalIndex, new PassLegacy("Brimstone Crag", (progress, config) => { progress.Message = "Uncovering the ruins of a fallen empire"; - //place on the same side as the abyss, right at the edge of the world - //the 25 block offset on both sides is there to prevent any "outside of bounds" crashes - int CragsX = (Main.dungeonX < Main.maxTilesX / 2) ? 25 : Main.maxTilesX - (Main.maxTilesX / 6) - 25; - BrimstoneCrag.GenCrags(CragsX); + BrimstoneCrag.GenCrags(); })); //biome shrines diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index a736da1857..5f688334a0 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -27,9 +27,15 @@ namespace CalamityMod.Tiles.Crags AddMapEntry(new Color(204, 55, 153)); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.339f; + g = 0.069f; + b = 0.076f; + } + public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 60, 0f, 0f, 1, new Color(255, 255, 255), 1f); Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); return false; } @@ -38,64 +44,5 @@ namespace CalamityMod.Tiles.Crags { return false; } - - /* - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) - { - frameXOffset = i % 2 * subsheetWidth; - frameYOffset = j % 2 * subsheetHeight; - } - - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - return TileFraming.BrimstoneFraming(i, j, resetFrame); - } - */ - - /*public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - Texture2D sprite = ModContent.GetTexture("CalamityMod/Tiles/Crags/BrimstoneSlagGlow"); - int frameXOffset = i % 2 * subsheetWidth; - int frameYOffset = j % 2 * subsheetHeight; - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - if (tile.Slope == (byte)0 && !tile.IsHalfBlock) - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 16), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - else if (tile.IsHalfBlock) - { - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y + 10) + 8) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else - { - byte num9 = tile.Slope; - for (int index4 = 0; index4 < 8; ++index4) - { - int width2 = index4 << 1; - Rectangle drawRectangle = new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset + index4 * 2, width2, 2); - int num10 = 0; - switch (num9) - { - case 2: - drawRectangle.X = 16 - width2; - num10 = 16 - width2; - break; - case 3: - drawRectangle.Width = 16 - width2; - break; - case 4: - drawRectangle.Width = 14 - width2; - drawRectangle.X = width2 + 2; - num10 = width2 + 2; - break; - } - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } - }*/ } } diff --git a/Waters/SunkenSeaWater.png b/Waters/SunkenSeaWater.png index 75032ee095..55938da31d 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 0194ffae12..9aecd8d559 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 5130afd9e1..f1a381e0c8 100644 Binary files a/Waters/SunkenSeaWaterflow.png and b/Waters/SunkenSeaWaterflow.png differ diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index da166e0a81..c93b4c87f7 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Terraria; using Terraria.IO; @@ -15,11 +16,17 @@ namespace CalamityMod.World { public class BrimstoneCrag { - //clear area for the biome to generate in, do this way before the biome itself places to prevent weird issues or hell terrain shennanigans - private static void ClearArea(int StartX) + static int StartX = WorldGen.dungeonX < Main.maxTilesX / 2 ? 25 : (Main.maxTilesX - (Main.maxTilesX / 6)) - 25; + + static int lavaLakePlaceDelay = 0; + static int lavaLakeBigPlaceDelay = 0; + + //basic terrain (also sorry for the excessive amount of loops lmao) + private static void CragsTerrain() { //set these before genning just to be safe int biomeStart = StartX; + int biomeMiddle = (biomeStart + (Main.maxTilesX / 6)) / 2; int biomeEdge = biomeStart + (Main.maxTilesX / 6); //clear all blocks and lava in the area @@ -32,20 +39,11 @@ namespace CalamityMod.World WorldGen.KillWall(x, y); } } - } - - //basic terrain (also sorry for the excessive amount of loops lmao) - private static void BasicCragTerrain(int StartX) - { - int biomeStart = StartX; - int biomeEdge = biomeStart + (Main.maxTilesX / 6); - - float yLevel = 0; //place basic rectangle of brimstone slag for (int x = biomeStart; x <= biomeEdge; x++) { - for (int y = Main.maxTilesY - 110; y <= Main.maxTilesY - 6; y++) + for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); @@ -56,8 +54,7 @@ namespace CalamityMod.World //this is done after placing the lava lake so it keeps its shape but still has unique terrain for (int x = biomeStart; x <= biomeEdge; x++) { - //place clusters of slag around the edges of the main square to create a more interesting shape - for (int y = Main.maxTilesY - 130; y <= Main.maxTilesY - 6; y++) + for (int y = Main.maxTilesY - 110; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; Tile tileUp = Main.tile[x, y - 1]; @@ -69,19 +66,33 @@ namespace CalamityMod.World tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || tileRight.TileType != ModContent.TileType())) { - Circle(x, y, WorldGen.genRand.Next(5, 22), ModContent.TileType(), false); + NaturalCircle(x, y, WorldGen.genRand.Next(5, 22), ModContent.TileType()); } } } - //place clumps of scorched remains - for (int x = biomeStart + 20; x <= biomeEdge - 20; x++) + //oh also place clumps of scorched remains on the terrain too + for (int x = biomeStart; x <= biomeEdge; x++) { - if (WorldGen.genRand.Next(50) == 0) + for (int y = Main.maxTilesY - 110; y <= Main.maxTilesY - 5; y++) { - TileRunner runner = new TileRunner(new Vector2(x, Main.maxTilesY - 125), new Vector2(0, 5), new Point16(-45, 45), - new Point16(-45, 45), 15f, WorldGen.genRand.Next(100, 250), (ushort)ModContent.TileType(), true, true); - runner.Start(); + 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() && (tileUp.TileType != ModContent.TileType() || + tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || + tileRight.TileType != ModContent.TileType())) + { + if (WorldGen.genRand.Next(12) == 0) + { + NaturalCircle(x - 10, y + 12, WorldGen.genRand.Next(15, 32), ModContent.TileType()); + NaturalCircle(x, y + 12, WorldGen.genRand.Next(15, 32), ModContent.TileType()); + NaturalCircle(x + 10, y + 12, WorldGen.genRand.Next(15, 32), ModContent.TileType()); + } + } } } @@ -92,61 +103,13 @@ namespace CalamityMod.World { if (WorldGen.genRand.Next(25) == 0 || Main.tile[x, y].TileType == TileID.Ash) { - Circle(x, y, WorldGen.genRand.Next(5, 15), ModContent.TileType(), false); + NaturalCircle(x, y, WorldGen.genRand.Next(5, 15), ModContent.TileType()); } } } - /* - //place lava lakes on the left side of the biome - for (int x = biomeStart + 20; x <= biomeStart + (Main.maxTilesX / 25); x++) - { - for (int y = Main.maxTilesY - 130; y <= Main.maxTilesY - 120; y++) - { - WorldGen.digTunnel(x, y, 0, 1, 30, 3, false); - } - } - - //place lava lakes on the right side of the biome - for (int x = biomeEdge - (Main.maxTilesX / 25); x <= biomeEdge - 20; x++) - { - for (int y = Main.maxTilesY - 130; y <= Main.maxTilesY - 120; y++) - { - // - WorldGen.digTunnel(x, y, 0, 1, 30, 3, false); - } - } - */ - - /* - //place big lava pit in the center - for (int x = biomeStart + (Main.maxTilesX / 25); x <= biomeEdge - (Main.maxTilesX / 25); x++) - { - for (int y = Main.maxTilesY - 135; y <= Main.maxTilesY - 5; y++) - { - if (Main.rand.Next(20) == 0 || Main.tile[x, y].TileType == ModContent.TileType()) - { - //this needs to be fixed a lot, it looks absolutely ugly due to how small it is - //also make an island of brimstone slag in the center to be like a brimstone elemental arena - LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(0, 15), new Point16(-25, 25), - new Point16(-55, 55), 10f, 10, 0, false, true); - runner.Start(); - } - } - } - */ - - //clean up any lava above a certain threshold to prevent the biome's surface from being flooded with lava - for (int x = biomeStart + (Main.maxTilesX / 25); x <= biomeEdge - (Main.maxTilesX / 25); x++) - { - for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 115; y++) - { - Main.tile[x, y].LiquidAmount = 0; - } - } - - //final tile cleanup - for (int x = biomeStart + (Main.maxTilesX / 25); x <= biomeEdge - (Main.maxTilesX / 25); x++) + //tile cleanup + for (int x = biomeStart; x <= biomeEdge; x++) { for (int y = Main.maxTilesY - 140; y <= Main.maxTilesY - 5; y++) { @@ -158,22 +121,123 @@ namespace CalamityMod.World Tile tileRight = Main.tile[x + 1, y]; //place tiles under random slag tiles that are sticking out and look weird - if (tile.TileType == ModContent.TileType() && !tileUp.HasTile && !tileDown.HasTile) + if (tile.TileType == ModContent.TileType() && !tileDown.HasTile) { WorldGen.PlaceTile(x, y + 1, (ushort)ModContent.TileType()); } + //same as above, but for scorched remains + if (tile.TileType == ModContent.TileType() && !tileDown.HasTile) + { + WorldGen.PlaceTile(x, y + 1, (ushort)ModContent.TileType()); + } + //place more walls behind slag so theres not just a box of walls from the initial rectangle - if (tile.TileType == ModContent.TileType() && tileDown.TileType == ModContent.TileType() && tileDown2.TileType == ModContent.TileType()) + if (tile.HasTile && tileDown.HasTile && tileDown2.HasTile && Main.tile[x, y + 5].HasTile) { Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); } + + if (tile.LiquidType == LiquidID.Water && tile.LiquidAmount > 0) + { + tile.ClearEverything(); + tile.LiquidType = LiquidID.Lava; + tile.LiquidAmount = 255; + } + } + } + + //place lava throughout the biome + for (int x = biomeStart; x <= biomeEdge; x++) + { + //cooldown before another lava pit can be placed + if (lavaLakeBigPlaceDelay > 0) + { + lavaLakeBigPlaceDelay--; + } + + //surface lava lakes and pits + if (lavaLakeBigPlaceDelay == 0) + { + LavaTileRunner runner1 = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 110), new Vector2(0, 5), new Point16(-150, 150), + new Point16(250, 500), 15f, WorldGen.genRand.Next(200, 300), 0, true, true); + runner1.Start(); + + LavaTileRunner runner2 = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 110), new Vector2(0, 5), new Point16(-150, 150), + new Point16(250, 500), 15f, WorldGen.genRand.Next(200, 300), 0, true, true); + runner2.Start(); + + LavaTileRunner runner3 = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-20, 20), + new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 400), 0, true, true); + runner3.Start(); + + lavaLakeBigPlaceDelay = 240; //set lava lake delay so it cant just spam lava lakes everywhere + } + } + + //place underground lava veins + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 20; y++) + { + if (WorldGen.genRand.Next(750) == 0) + { + LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(-5, 5), new Point16(-1000, 1000), + new Point16(-100, 100), 15f, WorldGen.genRand.Next(12, 25), 0, true, true); + runner.Start(); + } + } + } + + //clean up any lava above a certain threshold to prevent the biome's surface from being flooded + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 125; y++) + { + Main.tile[x, y].LiquidAmount = 0; + } + } + + //spread grass on all scorched remains + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) + { + Tile tile = Main.tile[x, y]; + Tile tileUp = Main.tile[x, y - 1]; + + if (tile.TileType == ModContent.TileType() && !tileUp.HasTile && tileUp.LiquidAmount == 0) + { + tile.TileType = (ushort)ModContent.TileType(); + } + + Tile.SmoothSlope(x, y, true); + } + } + + //charred ore + for (int i = 0; i < (int)((double)(Main.maxTilesX * Main.maxTilesY * 27) * 10E-05); i++) + { + int x = WorldGen.genRand.Next(5, Main.maxTilesX - 5); + int y = WorldGen.genRand.Next(5, Main.maxTilesY - 5); + + 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() && (tileUp.LiquidAmount > 0 || + tileDown.LiquidAmount > 0 || tileLeft.LiquidAmount > 0 || tileRight.LiquidAmount > 0)) + { + WorldGen.TileRunner(x + WorldGen.genRand.Next(-45, 45), y + WorldGen.genRand.Next(-45, 45), + WorldGen.genRand.Next(8, 22), WorldGen.genRand.Next(8, 22), ModContent.TileType(), false, 0f, 0f, false, true); } } } //place a circular clump of tiles - public static void Circle(int i, int j, int size, int tileType, bool killTile) + public static void NaturalCircle(int i, int j, int size, int tileType) { int BaseRadius = size; int radius = BaseRadius; @@ -186,7 +250,10 @@ namespace CalamityMod.World { Tile tile = Framing.GetTileSafely(x, y); - WorldGen.KillTile(x, y); + //if (tile.TileType != ModContent.TileType()) + //{ + WorldGen.KillTile(x, y); + //} WorldGen.PlaceTile(x, y, tileType); tile.Slope = 0; } @@ -196,10 +263,9 @@ namespace CalamityMod.World } } - public static void GenCrags(int StartX) + public static void GenCrags() { - ClearArea(StartX); - BasicCragTerrain(StartX); + CragsTerrain(); } } } \ No newline at end of file diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index d36b139fbf..04e0763276 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -314,6 +314,7 @@ namespace CalamityMod.World Tile tile = Main.tile[x, y]; Tile tileUp = Main.tile[x, y - 1]; Tile tileDown = Main.tile[x, y + 1]; + Tile tileDown2 = Main.tile[x, y + 2]; Tile tileLeft = Main.tile[x - 1, y]; Tile tileRight = Main.tile[x + 1, y]; @@ -360,6 +361,30 @@ namespace CalamityMod.World } } + //place a circular clump of tiles + public static void NaturalCircle(int i, int j, int size, int tileType, bool killTile) + { + int BaseRadius = size; + int radius = BaseRadius; + + for (int y = j - radius; y <= j + radius; y++) + { + for (int x = i - radius; x <= i + radius + 1; x++) + { + if ((int)Vector2.Distance(new Vector2(x, y), new Vector2(i, j)) <= radius && WorldGen.InWorld(x, y)) + { + Tile tile = Framing.GetTileSafely(x, y); + + WorldGen.KillTile(x, y); + WorldGen.PlaceTile(x, y, tileType); + tile.Slope = 0; + } + } + + radius = BaseRadius - WorldGen.genRand.Next(-1, 2); + } + } + // Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits" // Generates sea prism crystals on prism ore and occasionally on navystone private static void AddGeodes(ClusterGroup clusters, Point start, Vector2 terrainApplicationScaleVector, float overallBiomeScale) @@ -509,6 +534,7 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); } + int num3 = i + start.X; int num4 = j + start.Y; Tile tile = Main.tile[num3, num4]; @@ -680,12 +706,12 @@ namespace CalamityMod.World public static bool Place(Point origin) { - for (int y = origin.Y; y >= (Main.maxTilesY / 2) - 45; y--) + for (int y = origin.Y; y >= (int)Main.worldSurface; y--) { //check for the desert biomes walls if (Main.tile[origin.X, y].WallType == WallID.Sandstone || Main.tile[origin.X, y].WallType == WallID.HardenedSand) { - origin.Y = y + 100; //offset so it doesnt generate weird + origin.Y = y + 50; //offset so it doesnt generate weird foundValidPosition = true; break; }