diff --git a/BiomeManagers/SunkenSeaBiome.cs b/BiomeManagers/SunkenSeaBiome.cs index ed3c069dc4..e787148e6c 100644 --- a/BiomeManagers/SunkenSeaBiome.cs +++ b/BiomeManagers/SunkenSeaBiome.cs @@ -9,7 +9,7 @@ namespace CalamityMod.BiomeManagers { public override ModWaterStyle WaterStyle => ModContent.Find("CalamityMod/SunkenSeaWater"); public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); - public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh; public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; // Placeholder until we get a dedicated Sunken Sea background diff --git a/Dusts/CinderBlossomDust.png b/Dusts/CinderBlossomDust.png index e15ea39c59..aeb183ae75 100644 Binary files a/Dusts/CinderBlossomDust.png and b/Dusts/CinderBlossomDust.png differ diff --git a/Items/Placeables/BrimstoneSlab.cs b/Items/Placeables/BrimstoneSlab.cs index 3c6aec3eda..8a544d76bd 100644 --- a/Items/Placeables/BrimstoneSlab.cs +++ b/Items/Placeables/BrimstoneSlab.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables public override void AddRecipes() { CreateRecipe(25). - AddIngredient(ModContent.ItemType()). - AddTile(TileID.HeavyWorkBench). - Register(); + AddIngredient(ModContent.ItemType()). + AddTile(TileID.HeavyWorkBench). + Register(); } - } } diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 49f8414d4c..35f2d9dac9 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.Abyss { if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water && NPC.CountNPCS(ModContent.NPCType()) < 3) { - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.5f; } return 0f; } diff --git a/NPCs/Abyss/BobbitWormSegment.cs b/NPCs/Abyss/BobbitWormSegment.cs index 017d858680..7274f48a2c 100644 --- a/NPCs/Abyss/BobbitWormSegment.cs +++ b/NPCs/Abyss/BobbitWormSegment.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.Abyss if (spawnInfo.Player.Calamity().ZoneAbyssLayer4 && spawnInfo.Water) { if (CalamityGlobalNPC.bobbitWormBottom.Contains(-1)) - return SpawnCondition.CaveJellyfish.Chance * 0.3f; + return SpawnCondition.CaveJellyfish.Chance * 0.85f; } return 0f; } diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index 170f211391..e207bfb575 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -319,7 +319,7 @@ namespace CalamityMod.Systems if (tileType == ModContent.TileType() && !DownedBossSystem.downedCalamitasClone) return false; - int minDistanceFromOtherTiles = 6; + int minDistanceFromOtherTiles = 10; int sameTilesNearby = 0; for (int i = x - minDistanceFromOtherTiles; i < x + minDistanceFromOtherTiles; i++) { diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs new file mode 100644 index 0000000000..91512d672d --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.cs @@ -0,0 +1,76 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(76, 72, 35)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 233f / 255f; + g = 144f / 255f; + b = 30f / 255f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").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); + } + } + + //just clone the first one its literally the same size + public class AbyssGiantKelp2 : AbyssGiantKelp1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").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); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png new file mode 100644 index 0000000000..ee7a7eee5e Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png new file mode 100644 index 0000000000..fd9d167e72 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png new file mode 100644 index 0000000000..f77d5bf9da Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png new file mode 100644 index 0000000000..50f8d69f9b Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs new file mode 100644 index 0000000000..f6939534ba --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp3 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(1, 3); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(76, 72, 35)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 233f / 255f; + g = 144f / 255f; + b = 30f / 255f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").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); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png new file mode 100644 index 0000000000..d69f3d5445 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png new file mode 100644 index 0000000000..d3e69df07e Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs new file mode 100644 index 0000000000..9dee8245d8 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.cs @@ -0,0 +1,63 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssGiantKelp4 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(76, 72, 35)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 233f / 255f; + g = 144f / 255f; + b = 30f / 255f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").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); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png new file mode 100644 index 0000000000..fc436a8341 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png new file mode 100644 index 0000000000..e484deb6f4 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs new file mode 100644 index 0000000000..758f576d96 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/AbyssKelp.cs @@ -0,0 +1,55 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.GameContent.Metadata; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class AbyssKelp : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = true; + Main.tileFrameImportant[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Plant"]); + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.addTile(Type); + AddMapEntry(new Color(76, 72, 35)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + + base.SetStaticDefaults(); + } + + public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + { + offsetY = -12; + height = 32; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameX >= 72) + { + r = 233f / 350f; + g = 144f / 350f; + b = 30f / 350f; + } + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/AbyssKelp.png b/Tiles/Abyss/AbyssAmbient/AbyssKelp.png new file mode 100644 index 0000000000..7534a84571 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/AbyssKelp.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree.cs b/Tiles/Abyss/AbyssAmbient/BulbTree.cs new file mode 100644 index 0000000000..8a48dfb034 --- /dev/null +++ b/Tiles/Abyss/AbyssAmbient/BulbTree.cs @@ -0,0 +1,81 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Abyss.AbyssAmbient +{ + public class BulbTree1 : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.Table | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.WaterDeath = false; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(52, 124, 153)); + DustType = 33; + + base.SetStaticDefaults(); + } + + 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; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 2; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").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); + } + } + + public class BulbTree2 : BulbTree1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").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); + } + } + + public class BulbTree3 : BulbTree1 + { + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").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); + } + } +} diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree1.png b/Tiles/Abyss/AbyssAmbient/BulbTree1.png new file mode 100644 index 0000000000..d2bd2967ca Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree1.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png new file mode 100644 index 0000000000..3b203f5be1 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree1Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree2.png b/Tiles/Abyss/AbyssAmbient/BulbTree2.png new file mode 100644 index 0000000000..04e4bb54f3 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree2.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png new file mode 100644 index 0000000000..692bb9a5c8 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree2Glow.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree3.png b/Tiles/Abyss/AbyssAmbient/BulbTree3.png new file mode 100644 index 0000000000..d93e936775 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree3.png differ diff --git a/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png b/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png new file mode 100644 index 0000000000..ebe3d5f087 Binary files /dev/null and b/Tiles/Abyss/AbyssAmbient/BulbTree3Glow.png differ diff --git a/Tiles/Abyss/AbyssFossilTile.cs b/Tiles/Abyss/AbyssFossilTile.cs index 8428cb4f76..d493dc9d62 100644 --- a/Tiles/Abyss/AbyssFossilTile.cs +++ b/Tiles/Abyss/AbyssFossilTile.cs @@ -11,9 +11,8 @@ namespace CalamityMod.Tiles.Abyss { public override void SetStaticDefaults() { - Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 797ff326c9..fbe7d4d4b9 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -38,6 +39,30 @@ namespace CalamityMod.Tiles.Abyss { num = fail ? 1 : 3; } + + 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]; + + //place kelp + if (WorldGen.genRand.Next(8) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //7 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { diff --git a/Tiles/Abyss/LumenylCrystals.cs b/Tiles/Abyss/LumenylCrystals.cs index 1fc5b615ed..772947bc33 100644 --- a/Tiles/Abyss/LumenylCrystals.cs +++ b/Tiles/Abyss/LumenylCrystals.cs @@ -44,9 +44,9 @@ namespace CalamityMod.Tiles.Abyss Tile leftTile = Main.tile[i - 1, j]; if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || - (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || - (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || - (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) + (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || + (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || + (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) return true; return false; @@ -75,6 +75,7 @@ namespace CalamityMod.Tiles.Abyss { Main.tile[i, j].TileFrameY = 54; } + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index a8f155029b..459056b6aa 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -1,4 +1,5 @@ -using CalamityMod.Walls; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using CalamityMod.Walls; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -49,6 +50,27 @@ namespace CalamityMod.Tiles.Abyss 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]; + + //place kelp + if (WorldGen.genRand.Next(5) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //7 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + int num8 = WorldGen.genRand.Next((int)Main.rockLayer, (int)(Main.rockLayer + (double)Main.maxTilesY * 0.143)); if (Main.tile[i, j + 1] != null) { diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 88e1f5b766..0b9ee5d29d 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Tiles.Abyss.AbyssAmbient; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -43,6 +44,30 @@ namespace CalamityMod.Tiles.Abyss return false; } + 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]; + + //place kelp + if (WorldGen.genRand.Next(25) == 0 && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + up.TileFrameY = 0; + + //7 different frames, choose a random one + up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } + } + public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { int uniqueAnimationFrameX = 0; diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 0fcc3addc1..301ffd3361 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.DraedonStructures; @@ -46,7 +47,8 @@ namespace CalamityMod.Tiles TileID.CrimsonPlants, (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType() + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() }; public static List GrowthTiles = new List() diff --git a/Tiles/Crags/ScorchedRemains.cs b/Tiles/Crags/ScorchedRemains.cs index 3e0f379c82..139143f484 100644 --- a/Tiles/Crags/ScorchedRemains.cs +++ b/Tiles/Crags/ScorchedRemains.cs @@ -30,10 +30,12 @@ namespace CalamityMod.Tiles.Crags public override void RandomUpdate(int i, int j) { + Tile up = Main.tile[i, j - 1]; Tile left = Main.tile[i - 1, j]; Tile right = Main.tile[i + 1, j]; - if (WorldGen.genRand.Next(3) == 0 && (left.TileType == ModContent.TileType() || right.TileType == ModContent.TileType())) + if (WorldGen.genRand.Next(3) == 0 && !up.HasTile && (left.TileType == ModContent.TileType() || + right.TileType == ModContent.TileType())) { Main.tile[i, j].TileType = (ushort)ModContent.TileType(); } diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.cs b/Tiles/DraedonStructures/OnyxExcavatorTile.cs index 47849e331d..bffd6762b5 100644 --- a/Tiles/DraedonStructures/OnyxExcavatorTile.cs +++ b/Tiles/DraedonStructures/OnyxExcavatorTile.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Mounts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Enums; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,18 +14,21 @@ namespace CalamityMod.Tiles.DraedonStructures public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileSpelunker[Type] = true; + Main.tileSolid[Type] = false; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.Width = 8; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.addTile(Type); + TileObjectData.newTile.Width = 8; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 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 = 2; + TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Onyx Excavator"); AddMapEntry(new Color(128, 0, 128), name); - TileID.Sets.DisableSmartCursor[Type] = true; } public override void KillMultiTile(int i, int j, int frameX, int frameY) diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index dd79ddb252..e2980996fd 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -1,4 +1,5 @@ using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; @@ -62,6 +63,7 @@ namespace CalamityMod PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantCheckAgainst[ModContent.TileType()] = new int[1] { ModContent.TileType() }; + PlantCheckAgainst[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; VineToGrass = new Dictionary { diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index b2d0e4a3fe..5c1fbcdbf8 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -41,30 +41,6 @@ namespace CalamityMod } } - //place a circular clump of tiles - public static void NaturalCircle(int i, int j, int size, int tileType, bool hasRandomness = false) - { - 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 - (hasRandomness ? WorldGen.genRand.Next(-1, 2) : 0); - } - } - /// /// Settles all liquids in the world. /// diff --git a/World/Abyss.cs b/World/Abyss.cs index 5de4a82dd5..3364142fb6 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -7,13 +7,17 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; using System; +using System.Linq; +using System.Collections.Generic; using Terraria; using Terraria.ID; +using Terraria.IO; using Terraria.ModLoader; namespace CalamityMod.World @@ -65,37 +69,35 @@ namespace CalamityMod.World if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) { + //dithering on the edge of the abyss if (abyssIndex > abyssChasmX + 75) - { - if (WorldGen.genRand.NextBool(4)) - { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } - } - else if (abyssIndex > abyssChasmX + 70) { if (WorldGen.genRand.NextBool(2)) { - if (canConvert) + WorldGen.KillTile(abyssIndex, abyssIndex2); + + if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); } - else if (!tile.HasTile) + else if (abyssIndex2 > (rockLayer + y * 0.140) && WorldGen.genRand.NextBool(3)) { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + else if (abyssIndex2 > (rockLayer + y * 0.145)) + { + if (WorldGen.genRand.NextBool(3)) + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + else + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + } + else + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); } } } @@ -187,37 +189,35 @@ namespace CalamityMod.World if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) { + //dithering on the edge of the abyss if (abyssIndex < abyssChasmX - 75) - { - if (WorldGen.genRand.NextBool(4)) - { - if (canConvert) - { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - else if (!tile.HasTile) - { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); - } - } - } - else if (abyssIndex < abyssChasmX - 70) { if (WorldGen.genRand.NextBool(2)) { - if (canConvert) + WorldGen.KillTile(abyssIndex, abyssIndex2); + + if (abyssIndex2 > (rockLayer + y * 0.262)) { - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); } - else if (!tile.HasTile) + else if (abyssIndex2 > (rockLayer + y * 0.140) && WorldGen.genRand.NextBool(3)) { - tile.Get().HasTile = true; - tile.WallType = (ushort)ModContent.WallType(); - tile.TileType = (ushort)ModContent.TileType(); + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + else if (abyssIndex2 > (rockLayer + y * 0.145)) + { + if (WorldGen.genRand.NextBool(3)) + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + else + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); + } + } + else + { + WorldGen.PlaceTile(abyssIndex, abyssIndex2, (ushort)ModContent.TileType()); } } } @@ -427,7 +427,7 @@ namespace CalamityMod.World } //increase y value so islands cant be spammed on top of each other - voidIslandY += WorldGen.genRand.Next(10, 20); + voidIslandY += WorldGen.genRand.Next(20, 32); } } @@ -525,15 +525,98 @@ namespace CalamityMod.World } } + //clear lava and glowing moss away from the side of the abyss because it ruins immersion + if (AtLeftSideOfWorld) + { + for (int abyssIndex = 0; abyssIndex < abyssChasmX + 155; abyssIndex++) + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Main.tile[abyssIndex, abyssIndex2]; + + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidAmount = 0; + } + + int[] Mosses = { 381, 534, 536, 539, 625, 627 }; + + if (Mosses.Contains(tile.TileType)) + { + tile.TileType = TileID.Stone; + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 155; abyssIndex < x; abyssIndex++) + { + for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Main.tile[abyssIndex, abyssIndex2]; + + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidAmount = 0; + } + + int[] Mosses = { 381, 534, 536, 539, 625, 627 }; + + if (Mosses.Contains(tile.TileType)) + { + tile.TileType = TileID.Stone; + } + } + } + } + + //ambient tiles and pots if (AtLeftSideOfWorld) { for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 { for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) { - //pots if (!Main.tile[abyssIndex, abyssIndex2].HasTile) { + //above the 4th layer + if (abyssIndex2 < (int)(rockLayer + y * 0.262) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + { + //giant kelp, more often in upper layers + if ((WorldGen.genRand.NextBool(18) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) || + (WorldGen.genRand.NextBool(35) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType())) + { + ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); + } + + //bulb trees on voidstone + if (WorldGen.genRand.NextBool(25) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) + { + ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + } + } + + //below 4th layer + if (abyssIndex2 >= (int)(rockLayer + y * 0.262) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + { + //bulb trees on voidstone + if (WorldGen.genRand.NextBool(6) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) + { + ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + } + } + + //pots if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && abyssIndex2 > rockLayer) { if (WorldGen.genRand.NextBool(5)) @@ -542,6 +625,7 @@ namespace CalamityMod.World CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } + //sulphur pots else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && abyssIndex2 < (int)Main.worldSurface) { if (WorldGen.genRand.NextBool(3)) @@ -560,9 +644,45 @@ namespace CalamityMod.World { for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) { - //pots if (!Main.tile[abyssIndex, abyssIndex2].HasTile) { + //above the 4th layer + if (abyssIndex2 < (int)(rockLayer + y * 0.262) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + { + //giant kelp, more often in upper layers + if ((WorldGen.genRand.NextBool(18) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) || + (WorldGen.genRand.NextBool(35) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType())) + { + ushort[] Kelps = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(Kelps)); + } + + //bulb trees on voidstone + if (WorldGen.genRand.NextBool(25) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) + { + ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + } + } + + //below 4th layer + if (abyssIndex2 >= (int)(rockLayer + y * 0.262) && WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1)) + { + //bulb trees on voidstone + if (WorldGen.genRand.NextBool(6) && Main.tile[abyssIndex, abyssIndex2 + 1].TileType == ModContent.TileType()) + { + ushort[] BulbTrees = new ushort[] { (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + WorldGen.PlaceObject(abyssIndex, abyssIndex2, WorldGen.genRand.Next(BulbTrees)); + } + } + + //pots if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && abyssIndex2 > rockLayer) { if (WorldGen.genRand.NextBool(5)) @@ -571,6 +691,7 @@ namespace CalamityMod.World CalamityUtils.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } + //sulphur pots else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && abyssIndex2 < (int)Main.worldSurface) { if (WorldGen.genRand.NextBool(3)) @@ -1027,4 +1148,4 @@ namespace CalamityMod.World } #endregion } -} \ No newline at end of file +} diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 43734d8122..f092bab67c 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -25,7 +25,9 @@ namespace CalamityMod.World { if (!Convert) { - if (WorldGen.genRand.Next(365) == 0 && Main.tile[x, y].TileType == TileID.Cloud && Main.tile[x, y].HasTile) + Tile tile = Main.tile[x, y]; + + if (WorldGen.genRand.Next(365) == 0 && tile.TileType == TileID.Cloud && tile.HasTile) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 3c77b19d1e..bdb7e5e0b9 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -26,14 +26,15 @@ namespace CalamityMod.World static int lavaLakePlaceDelay = 0; static int lavaLakeBigPlaceDelay = 0; + static int numLavaLakes = 0; static int TreeDelay = 0; - //basic terrain (sorry for the excessive amount of loops lmao) + //all the main crags terrain generation private static void GenCrags() { - //set this here so it can properly scale to the worldsize and whatever - //the 25's are there to offset it from the exact edge of the world so no "out of bounds" crashing occurs + //set StartX here so it can properly scale with worldsize (just to be safe) + //the 25's are there to offset it from the exact edge of the world so that no "out of bounds" crashing occurs StartX = WorldGen.dungeonX < Main.maxTilesX / 2 ? 25 : (Main.maxTilesX - (Main.maxTilesX / 5)) - 25; //set these to be able to easily place things in certain locations, like structures @@ -41,7 +42,7 @@ namespace CalamityMod.World int biomeEdge = biomeStart + (Main.maxTilesX / 5); int biomeMiddle = (biomeStart + biomeEdge) / 2; - //clear all blocks and lava in the area + //clear literally everything in the area the biome will generate in for (int x = biomeStart; x <= biomeEdge; x++) { for (int y = Main.maxTilesY - 200; y < Main.maxTilesY - 2; y++) @@ -77,7 +78,19 @@ namespace CalamityMod.World tileDown.TileType != ModContent.TileType() || tileLeft.TileType != ModContent.TileType() || tileRight.TileType != ModContent.TileType())) { - CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 22), ModContent.TileType(), true); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + int radius = WorldGen.genRand.Next(5, 22); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); } } } @@ -91,14 +104,26 @@ namespace CalamityMod.World } } - //place ceiling across the top of the biome + //place ceiling of slag across the top of the biome for (int x = biomeStart; x <= biomeEdge; x++) { for (int y = Main.maxTilesY - 200; y <= Main.maxTilesY - 192; y++) { if (WorldGen.genRand.Next(25) == 0) { - CalamityUtils.NaturalCircle(x, y, WorldGen.genRand.Next(5, 15), ModContent.TileType(), true); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + int radius = WorldGen.genRand.Next(3, 7); + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); } } } @@ -166,15 +191,19 @@ namespace CalamityMod.World lavaLakeBigPlaceDelay--; } - //surface lava lakes and pits - //the reason theres three different runners being used is so that a shallow lava pit is placed above each lava pit + //surface lava pits if (lavaLakeBigPlaceDelay == 0) { - LavaTileRunner runner3 = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-500, 500), - new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 1000), 0, true, true); - runner3.Start(); + //do not place lava in the general middle area of the biome because it keeps flooding the crag bridge + if (numLavaLakes != 2 && numLavaLakes != 3) + { + LavaTileRunner runner3 = new LavaTileRunner(new Vector2(x, Main.maxTilesY - 165), new Vector2(0, 5), new Point16(-500, 500), + new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 1000), 0, true, true); + runner3.Start(); + } - lavaLakeBigPlaceDelay = 240; //set lava lake delay so it cant just spam lava lakes everywhere + numLavaLakes++; + lavaLakeBigPlaceDelay = 200; //set lava lake delay so it cant just spam lava lakes everywhere } } @@ -185,8 +214,8 @@ namespace CalamityMod.World { if (WorldGen.genRand.Next(1200) == 0) { - LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(-20000, 20000), - new Point16(-12, 12), 15f, WorldGen.genRand.Next(12, 25), 0, true, true); + LavaTileRunner runner = new LavaTileRunner(new Vector2(x, y), new Vector2(0, 5), new Point16(0, 5), + new Point16(-12, 12), 15f, WorldGen.genRand.Next(-12, 25), 0, true, true); runner.Start(); } } @@ -209,7 +238,7 @@ namespace CalamityMod.World } } - //charred ore + //place clumps of charred ore for (int x = biomeStart; x <= biomeEdge; x++) { for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 45; y++) @@ -249,7 +278,7 @@ namespace CalamityMod.World } } - //clean up any lava above a certain threshold to prevent the biome's surface from being flooded + //clean up any lava in the biomes surface to prevent it from being obnoxiously flooded for (int x = biomeStart; x <= biomeEdge; x++) { for (int y = Main.maxTilesY - 150; y <= Main.maxTilesY - 122; y++) @@ -276,7 +305,7 @@ namespace CalamityMod.World //stalactites and stalagmites if (tile.TileType == ModContent.TileType()) { - if (WorldGen.genRand.Next(32) == 0) + if (WorldGen.genRand.Next(20) == 0) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -284,7 +313,7 @@ namespace CalamityMod.World WorldGen.PlaceObject(x, y + 2, WorldGen.genRand.Next(Stalactites)); } - if (WorldGen.genRand.Next(10) == 0) + if (WorldGen.genRand.Next(8) == 0) { ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), @@ -312,17 +341,16 @@ namespace CalamityMod.World WorldGen.PlaceObject(x, y - 1, WorldGen.genRand.Next(Stalagmites)); } - //decrease tree delay if (TreeDelay > 0) { TreeDelay--; } //grow spine tree - if (WorldGen.genRand.Next(12) == 0 && TreeDelay == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + if (WorldGen.genRand.Next(3) == 0 && TreeDelay == 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { SpineTree.Spawn(x, y - 1, 22, 28, false, -1, false); - TreeDelay = 15; + TreeDelay = 20; } } } diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index d63bb58129..5c86cd5991 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -19,95 +19,92 @@ namespace CalamityMod.World { public static void PlaceArchive() { - int archiveX = 0; - int archiveY = 0; + int worldThird = Main.maxTilesX / 3; - bool placedArchive = false; - bool foundValidPosition = false; - bool shouldPlaceTheDamnThing = false; int dungeonArchiveColor = 0; //0 = blue, 1 = green, 2 = pink - int heightLimit = (Main.maxTilesY / 2) + (Main.maxTilesY / 8); - - for (int x = WorldGen.dungeonX - 100; x <= WorldGen.dungeonX + 100; x++) + //start much higher above the top of hell so it doesnt get nuked by the crags generation, and so it wont generate too low + for (int j = Main.maxTilesY - 380; j > 0; j--) { - for (int y = Main.maxTilesY - 200; y >= heightLimit; y--) - { - Tile tile = Main.tile[x, y]; - Tile tileUp = Main.tile[x, y - 1]; - Tile tileUp2 = Main.tile[x, y - 2]; - Tile tileUp3 = Main.tile[x, y - 3]; - Tile tileDown = Main.tile[x, y + 1]; + int i = 100; + if (WorldGen.dungeonSide == 1) + { + i = Main.maxTilesX - 100; + } - if ((tile.TileType == 41 || tile.TileType == 43 || tile.TileType == 44 || tile.TileType == 48) && !tileUp.HasTile) + bool shouldContinue = true; + bool placedArchive = false; + int color = 0; + + while (shouldContinue) + { + if (WorldGen.dungeonSide == 1) { - //blue brick walls - if ((tileUp.WallType == 7 || tileUp.WallType == 94 || tileUp.WallType == 95) && - (tileUp2.WallType == 7 || tileUp2.WallType == 94 || tileUp2.WallType == 95) && - (tileUp3.WallType == 7 || tileUp3.WallType == 94 || tileUp3.WallType == 95)) + i--; + if (i < Main.maxTilesX - worldThird) { + shouldContinue = false; + } + } + else + { + i++; + if (i > worldThird) + { + shouldContinue = false; + } + } + + Tile tile = Main.tile[i, j]; + Tile tileUp1 = Main.tile[i, j - 1]; + Tile tileUp2 = Main.tile[i, j - 2]; + Tile tileUp3 = Main.tile[i, j - 3]; + Tile tileUp4 = Main.tile[i, j - 4]; + Tile tileUp5 = Main.tile[i, j - 5]; + + int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 }; + //if (Main.tileDungeon[tile.TileType] && DungeonWalls.Contains(tileUp.WallType) && !tileUp.HasTile) + + if (Main.tileDungeon[tile.TileType] && !tileUp1.HasTile && !tileUp2.HasTile && !tileUp3.HasTile && !tileUp4.HasTile && !tileUp5.HasTile) + { + //i += WorldGen.dungeonSide * -16; + + //determine the archive brick color + if (tile.TileType == TileID.BlueDungeonBrick) dungeonArchiveColor = 0; - archiveX = x; - archiveY = y; - - foundValidPosition = true; - } - //green brick walls - if ((tileUp.WallType == 8 || tileUp.WallType == 98 || tileUp.WallType == 99) && - (tileUp2.WallType == 8 || tileUp2.WallType == 98 || tileUp2.WallType == 99) && - (tileUp3.WallType == 8 || tileUp3.WallType == 98 || tileUp3.WallType == 99)) - { + else if (tile.TileType == TileID.GreenDungeonBrick) dungeonArchiveColor = 1; - archiveX = x; - archiveY = y; - - foundValidPosition = true; - } - //pink brick walls - if ((tileUp.WallType == 9 || tileUp.WallType == 96 || tileUp.WallType == 97) && - (tileUp2.WallType == 9 || tileUp2.WallType == 96 || tileUp2.WallType == 97) && - (tileUp3.WallType == 9 || tileUp3.WallType == 96 || tileUp3.WallType == 97)) - { + else if (tile.TileType == TileID.PinkDungeonBrick) dungeonArchiveColor = 2; - archiveX = x; - archiveY = y; + + placedArchive = true; - foundValidPosition = true; - } + break; } + } - //in order to make sure the archive places at the very bottom of the dungeon - //loop upward a certain amount, and if it doesnt place reset everything and increase the maximum check height before the loop ends - //this way it will keep checking upward so it places nicely and doesnt destroy other parts of the dungeon (or at least not as much) - if (x >= (WorldGen.dungeonX + 100) - 5 && y <= heightLimit + 5 && !foundValidPosition) + if (placedArchive) + { + bool firstItem = false; + + if (dungeonArchiveColor == 0) { - x = WorldGen.dungeonX - 100; - heightLimit -= 1; + SchematicManager.PlaceSchematic(SchematicManager.BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); + } + if (dungeonArchiveColor == 1) + { + SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); + } + if (dungeonArchiveColor == 2) + { + SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + ref firstItem, new Action(FillArchiveChests)); } - } - } - if (foundValidPosition && !placedArchive) - { - bool firstItem = false; - - if (dungeonArchiveColor == 0) - { - SchematicManager.PlaceSchematic(SchematicManager.BlueArchiveKey, new Point(archiveX - 10, archiveY), SchematicAnchor.TopCenter, - ref firstItem, new Action(FillArchiveChests)); + break; } - if (dungeonArchiveColor == 1) - { - SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(archiveX - 10, archiveY), SchematicAnchor.TopCenter, - ref firstItem, new Action(FillArchiveChests)); - } - if (dungeonArchiveColor == 2) - { - SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(archiveX - 10, archiveY), SchematicAnchor.TopCenter, - ref firstItem, new Action(FillArchiveChests)); - } - - placedArchive = true; } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index fed61a2bfc..b827bdb11b 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -372,7 +372,7 @@ namespace CalamityMod.World iceTilesInArea++; } } - if (!canGenerateInLocation || iceTilesInArea < totalTiles * 0.2f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) + if (!canGenerateInLocation || iceTilesInArea < totalTiles * 0.35f || !structures.CanPlace(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y))) { tries++; }