diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 9cbfa9d1e4..01b7c9ccba 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -220,10 +220,10 @@ namespace CalamityMod.NPCs.Abyss Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 vector = center - screenPos; vector -= new Vector2((float)ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value.Width, (float)(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value.Height / Main.npcFrameCount[NPC.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Cyan); + vector += vector11 * 1f + new Vector2(0f, NPC.gfxOffY); + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.White); Main.spriteBatch.Draw(ModContent.Request("CalamityMod/NPCs/Abyss/GiantSquidGlow").Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); + new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, vector11, 1f, spriteEffects, 0f); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 44a61d307e..92a9ef1e63 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1127,7 +1127,7 @@ namespace CalamityMod.NPCs.HiveMind { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - CalamityUtils.SpawnAerialiteOre(); + AerialiteOreGen.Generate(true); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index e0eb40538e..e1866fe2c4 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -521,7 +521,7 @@ namespace CalamityMod.NPCs.Perforator { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - CalamityUtils.SpawnAerialiteOre(); + AerialiteOreGen.Generate(true); CalamityUtils.DisplayLocalizedText(key, messageColor); } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 64f2ea0b42..515bfd4b91 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -184,6 +184,14 @@ namespace CalamityMod.Systems UndergroundShrines.PlaceSurfaceShrine(WorldGen.structures); })); + //aerialite + //this MUST generate after the evil island, otherwise the ores keep getting painted from the evil island gen + tasks.Insert(++currentFinalIndex, new PassLegacy("Aerialite", (progress, config) => + { + progress.Message = "Hiding wyvern's gold in plain sight"; + AerialiteOreGen.Generate(false); + })); + // Draedon Labs tasks.Insert(++currentFinalIndex, new PassLegacy("Draedon Structures", (progress, config) => { diff --git a/Tiles/Abyss/AbyssFossilTile.png b/Tiles/Abyss/AbyssFossilTile.png index 642a908547..a9ba92d6d7 100644 Binary files a/Tiles/Abyss/AbyssFossilTile.png and b/Tiles/Abyss/AbyssFossilTile.png differ diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs index e0c6fb18fc..5ab0eb0212 100644 --- a/Tiles/Crags/Tree/SpineTree.cs +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -159,11 +159,11 @@ namespace CalamityMod.Tiles.Crags.Tree { Framing.GetTileSafely(i, j - k).TileFrameX = 3 * 18; } - else if (numSegments < 5) + if (numSegments < 6 && numSegments > 2) { Framing.GetTileSafely(i, j - k).TileFrameX = 4 * 18; } - else if (numSegments > 5) + if (numSegments > 6) { Framing.GetTileSafely(i, j - k).TileFrameX = 5 * 18; } @@ -371,8 +371,8 @@ namespace CalamityMod.Tiles.Crags.Tree Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 60, 14); Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14); - DrawTreeSegments(i, j, leftBranchTex, new Rectangle(50 * frame, 0, 48, 52), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); - DrawTreeSegments(i, j, rightBranchTex, new Rectangle(50 * frame, 0, 48, 52), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); + DrawTreeSegments(i, j, leftBranchTex, new Rectangle(50 * frame, 0, 50, 54), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); + DrawTreeSegments(i, j, rightBranchTex, new Rectangle(50 * frame, 0, 50, 54), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); //draw segments DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); @@ -390,8 +390,8 @@ namespace CalamityMod.Tiles.Crags.Tree Vector2 leftBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 80, 14); Vector2 rightBranchOffset = new Vector2((xOff * 2) - (frameOff / 2) + 4, 14); - DrawTreeSegments(i, j, leftBranchTex, new Rectangle(62 * frame, 0, 60, 58), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); - DrawTreeSegments(i, j, rightBranchTex, new Rectangle(62 * frame, 0, 60, 58), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); + DrawTreeSegments(i, j, leftBranchTex, new Rectangle(62 * frame, 0, 62, 60), TileOffset.ToWorldCoordinates(), leftBranchOffset, false); + DrawTreeSegments(i, j, rightBranchTex, new Rectangle(62 * frame, 0, 62, 60), TileOffset.ToWorldCoordinates(), rightBranchOffset, false); //draw segments DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); @@ -404,6 +404,9 @@ namespace CalamityMod.Tiles.Crags.Tree int frame = tile.TileFrameY / 18; DrawTreeSegments(i, j, topTex, new Rectangle(26 * frame, 0, 24, 24), TileOffset.ToWorldCoordinates(), topSegmentOffset, false); + + //draw segments + DrawTreeSegments(i, j, segmentTex, new Rectangle(34 * frame, 0, 32, 20), TileOffset.ToWorldCoordinates(), treeSegmentOffset, false); } return false; diff --git a/Tiles/DraedonStructures/OnyxExcavatorTile.cs b/Tiles/DraedonStructures/OnyxExcavatorTile.cs index 49025f1347..47849e331d 100644 --- a/Tiles/DraedonStructures/OnyxExcavatorTile.cs +++ b/Tiles/DraedonStructures/OnyxExcavatorTile.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileSpelunker[Type] = true; + 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 }; diff --git a/Tiles/Ores/AerialiteOreDisenchanted.cs b/Tiles/Ores/AerialiteOreDisenchanted.cs index 0cbca61082..d039fa547a 100644 --- a/Tiles/Ores/AerialiteOreDisenchanted.cs +++ b/Tiles/Ores/AerialiteOreDisenchanted.cs @@ -1,5 +1,4 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; @@ -10,11 +9,8 @@ namespace CalamityMod.Tiles.Ores { public class AerialiteOreDisenchanted : ModTile { - internal static Texture2D GlowTexture; public override void SetStaticDefaults() { - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/Tiles/Ores/AerialiteOreDisenchantedGlow", AssetRequestMode.ImmediateLoad).Value; Main.tileOreFinderPriority[Type] = 445; Main.tileBlockLight[Type] = true; Main.tileSolid[Type] = true; @@ -58,7 +54,7 @@ namespace CalamityMod.Tiles.Ores } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - TileFraming.CustomMergeFrame(i, j, Type, ModContent.TileType()); + TileFraming.CustomMergeFrame(i, j, Type, TileID.Cloud); return false; } public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) @@ -151,115 +147,7 @@ namespace CalamityMod.Tiles.Ores } frameXOffset = uniqueAnimationFrameX * animationFrameWidth; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - if (GlowTexture is null) - return; - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - int xOffset = 0; - int relativeXPos = i % 4; - int relativeYPos = j % 4; - switch (relativeXPos) - { - case 0: - switch (relativeYPos) - { - case 0: - xOffset = 0; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 1: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 2; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 2: - switch (relativeYPos) - { - case 0: - xOffset = 2; - break; - case 1: - xOffset = 0; - break; - case 2: - xOffset = 1; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - case 3: - switch (relativeYPos) - { - case 0: - xOffset = 1; - break; - case 1: - xOffset = 2; - break; - case 2: - xOffset = 0; - break; - case 3: - xOffset = 2; - break; - default: - xOffset = 2; - break; - } - break; - } - xOffset *= 288; - xPos += xOffset; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(75, 75, 75, 50)); - Tile trackTile = Main.tile[i, j]; - - if (!trackTile.IsHalfBlock && trackTile.Slope == 0) - { - Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else if (trackTile.IsHalfBlock) - { - Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } private Color GetDrawColour(int i, int j, Color colour) { int colType = Main.tile[i, j].TileColor; diff --git a/Tiles/Ores/AerialiteOreDisenchanted.png b/Tiles/Ores/AerialiteOreDisenchanted.png index 16d571fa76..e227f92d3b 100644 Binary files a/Tiles/Ores/AerialiteOreDisenchanted.png and b/Tiles/Ores/AerialiteOreDisenchanted.png differ diff --git a/Tiles/Ores/AerialiteOreDisenchantedGlow.png b/Tiles/Ores/AerialiteOreDisenchantedGlow.png deleted file mode 100644 index 66cdc7b4ef..0000000000 Binary files a/Tiles/Ores/AerialiteOreDisenchantedGlow.png and /dev/null differ diff --git a/Tiles/Ores/AerialiteOreGlow.png b/Tiles/Ores/AerialiteOreGlow.png index 111537e2b3..be59ed0610 100644 Binary files a/Tiles/Ores/AerialiteOreGlow.png and b/Tiles/Ores/AerialiteOreGlow.png differ diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index 38ddfa3c41..b2d0e4a3fe 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -65,38 +65,6 @@ namespace CalamityMod } } - //for some reason orerunner wasnt working with clouds, so just have a seperate thing for aerialite here - public static void SpawnAerialiteOre() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int x = 5; x < Main.maxTilesX - 5; x++) - { - for (int y = 5; y < 300; y++) - { - if (WorldGen.genRand.Next(365) == 0 && Main.tile[x, y].TileType == TileID.Cloud) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - - int outerRadius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); - - WorldUtils.Gen(new Point(x, y), new Shapes.Circle(outerRadius), 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()) - })); - } - } - } - } - } - /// /// Settles all liquids in the world. /// diff --git a/World/Abyss.cs b/World/Abyss.cs index 9acc0666ba..83fe3baaa0 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -39,8 +39,11 @@ namespace CalamityMod.World int abyssChasmX = AtLeftSideOfWorld ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135); //2100 - 1965 = 135 : 2100 + 1965 = 4065 bool plantyMushSide = true; + if (abyssChasmX < genLimit) + { plantyMushSide = false; + } if (AtLeftSideOfWorld) { @@ -49,13 +52,20 @@ namespace CalamityMod.World for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) { Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + bool canConvert = tile.HasTile && tile.TileType < TileID.Count && tile.TileType != TileID.DyePlants && tile.TileType != TileID.Trees && tile.TileType != TileID.PalmTree && tile.TileType != TileID.Sand && tile.TileType != TileID.Containers && tile.TileType != TileID.Coral && tile.TileType != TileID.BeachPiles && tile.TileType != ModContent.TileType() && tile.TileType != ModContent.TileType(); if (abyssIndex2 > rockLayer - WorldGen.genRand.Next(30)) { - if (abyssIndex > abyssChasmX + 75 - WorldGen.genRand.Next(30)) + if (abyssIndex > abyssChasmX + 75) { if (WorldGen.genRand.NextBool(4)) { @@ -164,6 +174,13 @@ namespace CalamityMod.World for (int abyssIndex2 = 0; abyssIndex2 < abyssChasmY; abyssIndex2++) { Tile tile = Framing.GetTileSafely(abyssIndex, abyssIndex2); + + if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0) + { + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + bool canConvert = tile.HasTile && tile.TileType < TileID.Count && tile.TileType != TileID.DyePlants && tile.TileType != TileID.Trees && tile.TileType != TileID.PalmTree && tile.TileType != TileID.Sand && tile.TileType != TileID.Containers && tile.TileType != TileID.Coral && tile.TileType != TileID.BeachPiles && tile.TileType != ModContent.TileType() && tile.TileType != ModContent.TileType(); @@ -276,10 +293,15 @@ namespace CalamityMod.World MiscWorldgenRoutines.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, AbyssChasmBottom, true); int maxAbyssIslands = 11; //Small World + if (y > 2100) + { maxAbyssIslands = 20; //Large World + } else if (y > 1500) + { maxAbyssIslands = 16; //Medium World + } // Place the Terminus shrine. UndergroundShrines.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), @@ -292,14 +314,18 @@ namespace CalamityMod.World while (!placedFossil) { //make sure it places at the very bottom, below where the terminus shrine is - for (int fossilCheckY = AbyssChasmBottom + 30; fossilCheckY < AbyssChasmBottom + 100; fossilCheckY++) + for (int fossilCheckY = AbyssChasmBottom + 30; fossilCheckY < AbyssChasmBottom + 75; fossilCheckY++) { - if (Main.tile[abyssChasmX, fossilCheckY].HasTile && Main.tile[abyssChasmX, fossilCheckY].TileType == ModContent.TileType()) + Tile tile = Main.tile[abyssChasmX, fossilCheckY]; + Tile tileleft = Main.tile[abyssChasmX - 1, fossilCheckY]; + Tile tileRight = Main.tile[abyssChasmX + 1, fossilCheckY]; + + if (tile.HasTile || tileleft.HasTile || tileRight.HasTile) { realFossilY = fossilCheckY; //place a box of voidstone for the fossil to spawn on - for (int fossilX = abyssChasmX - 3; fossilX <= abyssChasmX + 3; fossilX++) + for (int fossilX = abyssChasmX - 12; fossilX <= abyssChasmX + 12; fossilX++) { for (int fossilY = realFossilY - 2; fossilY <= realFossilY + 3; fossilY++) { @@ -307,6 +333,15 @@ namespace CalamityMod.World } } + //kill any tiles in a small area above to prevent the fossil from not placing correctly + for (int fossilX = abyssChasmX - 2; fossilX <= abyssChasmX + 2; fossilX++) + { + for (int fossilY = realFossilY - 3; fossilY <= realFossilY - 8; fossilY++) + { + WorldGen.KillTile(fossilX, fossilY); + } + } + WorldGen.PlaceObject(abyssChasmX, realFossilY - 3, (ushort)ModContent.TileType()); placedFossil = true; @@ -316,6 +351,7 @@ namespace CalamityMod.World int islandLocationOffset = 30; int islandLocationY = rockLayer; + for (int islands = 0; islands < maxAbyssIslands; islands++) { int islandLocationX = abyssChasmX; @@ -363,6 +399,27 @@ namespace CalamityMod.World break; } + //place some islands lining the walls in layer 4 + for (int voidIslandY = (int)(rockLayer + y * 0.262); voidIslandY <= AbyssChasmBottom; voidIslandY++) + { + if (WorldGen.genRand.NextBool(8)) + { + int randomIsland = WorldGen.genRand.Next(2); //0 1 + switch (randomIsland) + { + case 0: + AbyssIsland(abyssChasmX + 42, voidIslandY, 55, 75, 35, 45, false, true, true); + break; + case 1: + AbyssIsland(abyssChasmX - 42, voidIslandY, 55, 75, 35, 45, false, true, true); + break; + } + + //increase y value so islands cant be spammed on top of each other + voidIslandY += WorldGen.genRand.Next(10, 20); + } + } + AbyssItemArray = CalamityUtils.ShuffleArray(AbyssItemArray); for (int abyssHouse = 0; abyssHouse < TotalPlacedIslandsSoFar; abyssHouse++) //11 15 19 { @@ -375,6 +432,88 @@ namespace CalamityMod.World } } + //clean up + if (AtLeftSideOfWorld) + { + for (int abyssIndex = 5; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 + { + for (int abyssIndex2 = 5; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Main.tile[abyssIndex, abyssIndex2]; + Tile tileUp = Main.tile[abyssIndex, abyssIndex2 - 1]; + Tile tileDown = Main.tile[abyssIndex, abyssIndex2 + 1]; + Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; + Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + //slope tiles + Tile.SmoothSlope(abyssIndex, abyssIndex2, true); + + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + { + WorldGen.KillTile(abyssIndex, abyssIndex2); + } + } + + if (!tile.HasTile && (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType())) + { + //fill up any air pockets with water + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + + //kill obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(abyssIndex, abyssIndex2); + } + } + } + } + else + { + for (int abyssIndex = abyssChasmX - 80; abyssIndex < x - 5; abyssIndex++) //3965 + { + for (int abyssIndex2 = 5; abyssIndex2 < abyssChasmY; abyssIndex2++) + { + Tile tile = Main.tile[abyssIndex, abyssIndex2]; + Tile tileUp = Main.tile[abyssIndex, abyssIndex2 - 1]; + Tile tileDown = Main.tile[abyssIndex, abyssIndex2 + 1]; + Tile tileLeft = Main.tile[abyssIndex - 1, abyssIndex2]; + Tile tileRight = Main.tile[abyssIndex + 1, abyssIndex2]; + + if (tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType()) + { + //slope tiles + Tile.SmoothSlope(abyssIndex, abyssIndex2, true); + + //kill any individual floating tiles + if (!tileUp.HasTile && !tileDown.HasTile && !tileLeft.HasTile && !tileRight.HasTile) + { + WorldGen.KillTile(abyssIndex, abyssIndex2); + } + } + + if (!tile.HasTile && (tile.WallType == ModContent.WallType() || tile.WallType == ModContent.WallType())) + { + //fill up any air pockets with water + tile.LiquidType = LiquidID.Water; + tile.LiquidAmount = 255; + } + + //kill obsidian + if (tile.TileType == TileID.Obsidian) + { + WorldGen.KillTile(abyssIndex, abyssIndex2); + } + } + } + } + if (AtLeftSideOfWorld) { for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs new file mode 100644 index 0000000000..43734d8122 --- /dev/null +++ b/World/AerialiteOreGen.cs @@ -0,0 +1,60 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.GameContent.Generation; +using Terraria.WorldBuilding; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using System.Collections.Generic; +using CalamityMod.DataStructures; + +namespace CalamityMod.World +{ + public class AerialiteOreGen + { + public static void Generate(bool Convert) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + for (int y = 5; y < 300; y++) + { + if (!Convert) + { + if (WorldGen.genRand.Next(365) == 0 && Main.tile[x, y].TileType == TileID.Cloud && Main.tile[x, y].HasTile) + { + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + + int outerRadius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); + + WorldUtils.Gen(new Point(x, y), new Shapes.Circle(outerRadius), 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()) + })); + } + } + + if (Convert) + { + if (Main.tile[x, y].TileType == ModContent.TileType()) + { + Main.tile[x, y].TileType = (ushort)ModContent.TileType(); + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 59bcac1dd0..3c77b19d1e 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -170,16 +170,8 @@ namespace CalamityMod.World //the reason theres three different runners being used is so that a shallow lava pit is placed above each lava pit if (lavaLakeBigPlaceDelay == 0) { - LavaTileRunner runner1 = new LavaTileRunner(new Vector2(x - 10, 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 + 10, 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(-500, 500), - new Point16(250, 1000), 15f, WorldGen.genRand.Next(300, 400), 0, true, true); + 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 diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index 98a25103b4..f1fd87cec4 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -22,15 +22,16 @@ namespace CalamityMod.World int archiveX = 0; int archiveY = 0; - bool continueLooping = true; bool placedArchive = false; - bool actuallyPlaced = false; bool foundValidPosition = false; int dungeonArchiveColor = 0; //0 = blue, 1 = green, 2 = pink int heightLimit = (Main.maxTilesY / 2) + (Main.maxTilesY / 7); - for (int x = 5; x <= Main.maxTilesX - 5; x++) + int xMin = WorldGen.dungeonSide == -1 ? 5 : (Main.maxTilesX / 2) + 5; + int xMax = WorldGen.dungeonSide == -1 ? (Main.maxTilesX / 2) - 5 : Main.maxTilesX - 5; + + for (int x = xMin; x <= xMax; x++) { for (int y = Main.maxTilesY - 5; y >= heightLimit; y--) { @@ -69,12 +70,12 @@ namespace CalamityMod.World } } - //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 check height before the loop ends + //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 >= Main.maxTilesX - 5 && y <= heightLimit + 5 && !foundValidPosition) { - x = 5; + x = xMin; y = Main.maxTilesY - 5; heightLimit = heightLimit - 2; @@ -82,7 +83,7 @@ namespace CalamityMod.World } } - if (foundValidPosition && !actuallyPlaced) + if (foundValidPosition && !placedArchive) { bool firstItem = false; @@ -102,7 +103,7 @@ namespace CalamityMod.World ref firstItem, new Action(FillArchiveChests)); } - actuallyPlaced = true; + placedArchive = true; } } @@ -130,6 +131,7 @@ namespace CalamityMod.World new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(5, 10)), }; + //this is normally not a good idea with separate items lists, but both lists are the same size so it is fine here for (int i = 0; i < contents1.Count; i++) { if (!firstItem) diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 6bc609d0fb..3004e10393 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -31,25 +31,12 @@ namespace CalamityMod.World { public static bool GrowLivingJungleTree(Point origin) { - if (!WorldGen.drunkWorldGen || WorldGen.genRand.Next(50) > 0) - { - Dictionary dictionary = new Dictionary(); - WorldUtils.Gen(new Point(origin.X - 25, origin.Y - 25), new Shapes.Rectangle(50, 50), new Actions.TileScanner(0, 59, 60, 147, 1).Output(dictionary)); - int num = dictionary[0] + dictionary[1]; - int num2 = dictionary[59] + dictionary[60]; - if (dictionary[147] > num2 || num > num2 || num2 < 50) - { - return false; - } - } - int treeHeight = (int)Main.worldSurface - (Main.maxTilesY / 10); //start here to not touch floating islands - bool validheightFound = false; + bool validHeightFound = false; int attempts = 0; - while (!validheightFound && attempts++ < 100000) + while (!validHeightFound && attempts++ < 100000) { - while (!WorldGen.SolidTile(origin.X, treeHeight)) { treeHeight++; @@ -57,13 +44,13 @@ namespace CalamityMod.World if (Main.tile[origin.X, treeHeight].HasTile || Main.tile[origin.X, treeHeight].WallType > 0) { - validheightFound = true; + validHeightFound = true; } } int extraWidth = 0; - while (validheightFound) + while (validHeightFound) { //place the roots first so the bottom of the hole doesnt look strange for (int k = 0; k < 6; k++) @@ -76,6 +63,7 @@ namespace CalamityMod.World for (int y = treeHeight - 50; y <= origin.Y - 30; y++) { + //increase extra width to make the tree wider as it goes down if (y % 35 == 0) { extraWidth++; @@ -194,8 +182,6 @@ namespace CalamityMod.World FrameOutAllHiveContents(origin, 50); - GrowLivingJungleTree(new Point(origin.X, origin.Y)); - for (int k = 0; k < num; k++) { int num4 = array[k]; @@ -226,6 +212,8 @@ namespace CalamityMod.World } } + GrowLivingJungleTree(new Point(origin.X, origin.Y)); + CreateStandForLarva(larvaLocation); // Generate a second larva stand