diff --git a/BiomeManagers/AbovegroundAstralBiome.cs b/BiomeManagers/AbovegroundAstralBiome.cs index d3ce06a025..f4f7d708ee 100644 --- a/BiomeManagers/AbovegroundAstralBiome.cs +++ b/BiomeManagers/AbovegroundAstralBiome.cs @@ -9,6 +9,7 @@ namespace CalamityMod.BiomeManagers { public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/AstralWater"); public override ModSurfaceBackgroundStyle SurfaceBackgroundStyle => ModContent.Find("CalamityMod/AstralSurfaceBGStyle"); + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/AstralUndergroundBGStyle"); public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/AbovegroundAstralBiomeIcon"; public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; @@ -30,6 +31,5 @@ namespace CalamityMod.BiomeManagers { player.ManageSpecialBiomeVisuals("CalamityMod:Astral", isActive); } - } } diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 59ef83c5bd..472e568e58 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -62,6 +62,8 @@ namespace CalamityMod.Projectiles.Enemy Projectile.Kill(); } + Projectile.velocity *= 0.98f; + if (Math.Abs(Projectile.velocity.X) > 0f) { Projectile.spriteDirection = -Projectile.direction; diff --git a/Projectiles/Pets/EidolonSnail.cs b/Projectiles/Pets/EidolonSnail.cs index 4ce873dd45..9421f95604 100644 --- a/Projectiles/Pets/EidolonSnail.cs +++ b/Projectiles/Pets/EidolonSnail.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Pets Vector2 center2 = Projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); - if (Projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X))) + if (Projectile.velocity.Y == 0 && ((HoleBelow() && playerDistance > 150f) || (playerDistance > 150f && Projectile.position.X == Projectile.oldPosition.X))) { Projectile.velocity.Y = -8f; } @@ -159,12 +159,12 @@ namespace CalamityMod.Projectiles.Pets Projectile.frameCounter = 0; } //falling frame - if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) + else if (Projectile.velocity.Y > 0.3f && Projectile.position.Y != Projectile.oldPosition.Y) { Projectile.frame = 4; Projectile.frameCounter = 0; } - else + else if (Projectile.velocity.X != 0) { //moving animation Projectile.frameCounter++; diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs index 8a48dfb034..1a9a42f1e8 100644 --- a/Tiles/Abyss/AbyssAmbient/BulbTree.cs +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -35,9 +35,9 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 49f / 255f; - g = 159f / 255f; - b = 242f / 255f; + r = 49f / 500f; + g = 159f / 500f; + b = 242f / 500f; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Crags/Lily/LavaLily1.cs b/Tiles/Crags/Lily/LavaLily1.cs new file mode 100644 index 0000000000..849b8aa9a4 --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily1.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 184), TileOffset.ToWorldCoordinates(), new Vector2(98, 191), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily1.png b/Tiles/Crags/Lily/LavaLily1.png new file mode 100644 index 0000000000..577ffc6c9e Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1.png differ diff --git a/Tiles/Crags/Lily/LavaLily1Glow.png b/Tiles/Crags/Lily/LavaLily1Glow.png new file mode 100644 index 0000000000..aa8417951c Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily1Top.png b/Tiles/Crags/Lily/LavaLily1Top.png new file mode 100644 index 0000000000..6073a6b920 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily1TopGlow.png b/Tiles/Crags/Lily/LavaLily1TopGlow.png new file mode 100644 index 0000000000..12aa31f3ec Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily1TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily2.cs b/Tiles/Crags/Lily/LavaLily2.cs new file mode 100644 index 0000000000..957816f3de --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily2.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily2 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 192, 206), TileOffset.ToWorldCoordinates(), new Vector2(90, 209), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily2.png b/Tiles/Crags/Lily/LavaLily2.png new file mode 100644 index 0000000000..cd908b4f64 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2.png differ diff --git a/Tiles/Crags/Lily/LavaLily2Glow.png b/Tiles/Crags/Lily/LavaLily2Glow.png new file mode 100644 index 0000000000..50fbfbbc5a Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily2Top.png b/Tiles/Crags/Lily/LavaLily2Top.png new file mode 100644 index 0000000000..7ce6a66769 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily2TopGlow.png b/Tiles/Crags/Lily/LavaLily2TopGlow.png new file mode 100644 index 0000000000..ff3ca4083c Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily2TopGlow.png differ diff --git a/Tiles/Crags/Lily/LavaLily3.cs b/Tiles/Crags/Lily/LavaLily3.cs new file mode 100644 index 0000000000..64e7f004af --- /dev/null +++ b/Tiles/Crags/Lily/LavaLily3.cs @@ -0,0 +1,63 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.Crags.Lily +{ + public class LavaLily3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(3, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.StyleWrapLimit = 36; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(153, 100, 176)); + DustType = -1; //idk what dust to put here + } + + internal static void DrawLilyTop(int i, int j, Texture2D tex, Rectangle? source, Vector2? offset = null, Vector2? origin = null, bool Glow = false) + { + Tile tile = Main.tile[i, j]; + Vector2 drawPos = new Vector2(i, j).ToWorldCoordinates() - Main.screenPosition + (offset ?? new Vector2(0, -2)); + Color color = Lighting.GetColor(i, j); + + Main.spriteBatch.Draw(tex, drawPos, source, Glow ? Color.White : color, 0, origin ?? source.Value.Size() / 3f, 1f, SpriteEffects.None, 0f); + } + + public static Vector2 TileOffset => Lighting.LegacyEngine.Mode > 1 ? Vector2.Zero : Vector2.One * 12; + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //draw the glowmask on the lily base + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + spriteBatch.Draw(tex, new Vector2(i * 16, j * 16 + 2) - Main.screenPosition + zero, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), Color.White); + + Texture2D lilyTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Top").Value; + Texture2D glowTex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3TopGlow").Value; + + //draw in the middle of the tile so it doesnt draw more than once + if (Framing.GetTileSafely(i, j).TileFrameX == 36 && Framing.GetTileSafely(i, j).TileFrameY == 18) + { + DrawLilyTop(i, j, lilyTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), false); + DrawLilyTop(i, j, glowTex, new Rectangle(0, 0, 178, 198), TileOffset.ToWorldCoordinates(), new Vector2(98, 199), true); + } + } + } +} \ No newline at end of file diff --git a/Tiles/Crags/Lily/LavaLily3.png b/Tiles/Crags/Lily/LavaLily3.png new file mode 100644 index 0000000000..2287eca150 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3.png differ diff --git a/Tiles/Crags/Lily/LavaLily3Glow.png b/Tiles/Crags/Lily/LavaLily3Glow.png new file mode 100644 index 0000000000..964907ab5b Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3Glow.png differ diff --git a/Tiles/Crags/Lily/LavaLily3Top.png b/Tiles/Crags/Lily/LavaLily3Top.png new file mode 100644 index 0000000000..11a199fa94 Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3Top.png differ diff --git a/Tiles/Crags/Lily/LavaLily3TopGlow.png b/Tiles/Crags/Lily/LavaLily3TopGlow.png new file mode 100644 index 0000000000..d0c8fa7e3e Binary files /dev/null and b/Tiles/Crags/Lily/LavaLily3TopGlow.png differ diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index b10e3feb36..5cd5ecc56d 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -57,12 +57,12 @@ namespace CalamityMod.World while (y < Main.worldSurface) { if (Main.tile[x, y].HasTile && - (Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || - Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType())) + (Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType() || + Main.tile[x, y].TileType == ModContent.TileType() || Main.tile[x, y].TileType == ModContent.TileType())) { astralTileCount++; if (astralTileCount > astralTilesAllowed) @@ -127,7 +127,7 @@ namespace CalamityMod.World { float worldEdgeMargin = (float)Main.maxTilesX * 0.08f; int xLimit = Main.maxTilesX / 2; - int x = Abyss.AtLeftSideOfWorld ? rand.Next(650, xLimit - 200) : rand.Next(xLimit + 200, Main.maxTilesX - 650); + int x = Abyss.AtLeftSideOfWorld ? rand.Next(Main.dungeonX + 200, xLimit - 350) : rand.Next(xLimit + 350, Main.dungeonX - 200); //world surface = 920 large 740 medium 560 small int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 @@ -146,18 +146,27 @@ namespace CalamityMod.World { suitableTiles++; - // Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns + //Avoid floating islands: Clouds and Sunplate both harshly punish attempted meteor spawns if (Main.tile[l, m].TileType == TileID.Cloud || Main.tile[l, m].TileType == TileID.Sunplate) { suitableTiles -= 100; } - // Avoid Sulphurous Sea beach: Cannot be converted by astral + //Avoid the hallowed so it doesnt get demolished by the astral biome + else if (Main.tile[l, m].TileType == TileID.HallowedGrass || Main.tile[l, m].TileType == TileID.Pearlstone) + { + suitableTiles -= 100; + } + //Avoid living trees, doesnt land on them too often but its better to prevent it + else if (Main.tile[l, m].TileType == TileID.LivingWood || Main.tile[l, m].TileType == TileID.LeafBlock) + { + suitableTiles -= 100; + } + //Avoid Sulphurous Sea beach: Cannot be converted by astral else if (Main.tile[l, m].TileType == ModContent.TileType() || Main.tile[l, m].TileType == ModContent.TileType()) { suitableTiles -= 100; } - - // Prevent the Astral biome from overriding or interfering with an AA biome + //Prevent the Astral biome from overriding or interfering with an AA biome else if (ancientsAwakened is not null && aaTilesToAvoid.Contains(Main.tile[l, m].TileType)) { suitableTiles -= 100; diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 90da436b8e..ec9a8883e6 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -1,6 +1,7 @@ using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.Crags.Spike; using CalamityMod.Tiles.Crags.Tree; +using CalamityMod.Tiles.Crags.Lily; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using CalamityMod.Schematics; @@ -28,8 +29,6 @@ namespace CalamityMod.World static int lavaLakeBigPlaceDelay = 0; static int numLavaLakes = 0; - static int TreeDelay = 0; - //all the main crags terrain generation private static void GenCrags() { @@ -98,7 +97,7 @@ namespace CalamityMod.World //scorched remains patches for (int x = biomeStart + 30; x <= biomeEdge - 30; x++) { - if (WorldGen.genRand.Next(150) == 0) + if (WorldGen.genRand.Next(145) == 0) { ScorchedGrassPatches(new Point(x, Main.maxTilesY - 135)); } @@ -221,23 +220,6 @@ namespace CalamityMod.World } } - //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); - } - } - //place clumps of charred ore for (int x = biomeStart; x <= biomeEdge; x++) { @@ -270,11 +252,31 @@ namespace CalamityMod.World for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; + Tile tileAbove = Main.tile[x, y - 1]; + if (tile.LiquidAmount > 0) { tile.LiquidType = LiquidID.Lava; tile.LiquidAmount = 255; } + + //get rid of lava above scorched remains as much as possible + if (tile.TileType == ModContent.TileType() && !tileAbove.HasTile) + { + for (int i = x - 1; i <= x + 1; i++) + { + for (int j = y - 5; j <= y; j++) + { + Tile lavaTile = Main.tile[i, j]; + Tile lavaTileDown = Main.tile[i, j + 1]; + + if (lavaTile.WallType == 0 && lavaTileDown.WallType == 0) + { + lavaTile.LiquidAmount = 0; + } + } + } + } } } @@ -286,6 +288,24 @@ namespace CalamityMod.World Main.tile[x, y].LiquidAmount = 0; } } + + //settle all liquids + CalamityUtils.SettleWater(); + + //spread grass on all scorched remains with no lava above them + for (int x = biomeStart; x <= biomeEdge; x++) + { + for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 110; 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(); + } + } + } } //place ambient objects and other stuff @@ -300,7 +320,8 @@ namespace CalamityMod.World for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 5; y++) { Tile tile = Main.tile[x, y]; - Tile tileUp = Main.tile[x, y - 1]; + + Tile.SmoothSlope(x, y, true); //stalactites and stalagmites if (tile.TileType == ModContent.TileType()) @@ -340,23 +361,67 @@ namespace CalamityMod.World WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); } + } - if (TreeDelay > 0) + //place lillies on scorched remains grass + if (tile.TileType == ModContent.TileType()) + { + //place them decently often since they are pretty big tiles, also dont place them in lava + if (WorldGen.genRand.Next(4) == 0) { - TreeDelay--; + ushort[] Lillies = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Lillies)); } + } + } + //separate y loop so trees dont grow too deep + for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 122; y++) + { + Tile tile = Main.tile[x, y]; + + Tile.SmoothSlope(x, y, true); + + //stalactites and stalagmites + if (tile.TileType == ModContent.TileType()) + { //grow spine tree - if (WorldGen.genRand.Next(3) == 0 && TreeDelay == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.Next(12) == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { - SpineTree.Spawn(x, y - 1, 22, 28, false, -1, false); - TreeDelay = 20; + PlaceTree(x, y - 1, ModContent.TileType()); } } } } } + public static bool PlaceTree(int x, int y, int tileType) + { + int minDistance = 5; + int treeNearby = 0; + + for (int i = x - minDistance; i < x + minDistance; i++) + { + for (int j = y - minDistance; j < y + minDistance; j++) + { + if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == tileType) + { + treeNearby++; + if (treeNearby > 0) + { + return false; + } + } + } + } + + SpineTree.Spawn(x, y, 22, 28, false, -1, false); + + return true; + } + public static void FillBrimstoneChests(Chest chest, int Type, bool firstItem) { /*