From 3cd3eb63eb066f234ae3f61dea16b843554e02cb Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Tue, 31 Oct 2023 22:04:20 -0600 Subject: [PATCH] Made Luminite planetoids generate more consistently and fixed a bug that impeded the generation of them if you generated them before in another world in the same session. Increased the area where all planetoid types can generate as well, to give more space for the luminite ones. Increased the amount of luminite planetoids a bit but reduced their radius; tbh at least 5 are gonna be blocked by platforms anyways --- Systems/MiscWorldStateSystem.cs | 2 ++ World/Planets/LuminitePlanet.cs | 10 ++++++---- World/Planets/Planetoid.cs | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Systems/MiscWorldStateSystem.cs b/Systems/MiscWorldStateSystem.cs index 49d5b8757d..43ec425658 100644 --- a/Systems/MiscWorldStateSystem.cs +++ b/Systems/MiscWorldStateSystem.cs @@ -71,6 +71,8 @@ namespace CalamityMod armageddon = false; AcidRainEvent.AcidRainEventIsOngoing = false; AcidRainEvent.CountdownUntilForcedAcidRain = 0; + + HasGeneratedLuminitePlanetoids = false; //Allow generating planetoids in other worlds } #endregion diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index 5a57634236..b4a5b1d977 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -22,12 +22,13 @@ namespace CalamityMod.World.Planets GenVars.structures = new StructureMap(); var config = WorldGenConfiguration.FromEmbeddedPath("Terraria.GameContent.WorldBuilding.Configuration.json"); - int totalPlanetoidsToGenerate = Main.maxTilesX / 1500 + 2; + int totalPlanetoidsToGenerate = Main.maxTilesX / 1200 + 2; + Main.NewText("Tiles total: " + Main.maxTilesX); for (int i = 0; i < totalPlanetoidsToGenerate; i++) { - for (int tries = 0; tries < 6000; tries++) + for (int tries = 0; tries < 15000; tries++) { - Point planetoidOrigin = new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 800, Main.maxTilesX / 2 + 800), WorldGen.genRand.Next(75, 125)); + Point planetoidOrigin = new Point(WorldGen.genRand.Next((int)(Main.maxTilesX*0.15), (int)(Main.maxTilesX*0.85)), WorldGen.genRand.Next(75, 125)); if (WorldGen.genRand.NextBool(2)) { if (config.CreateBiome().Place(planetoidOrigin, GenVars.structures)) @@ -38,13 +39,14 @@ namespace CalamityMod.World.Planets if (config.CreateBiome().Place(planetoidOrigin, GenVars.structures)) break; } + Main.NewText("Success"); } } } public override bool Place(Point origin, StructureMap structures) { - int radius = _random.Next(16, 21); + int radius = _random.Next(14, 18); if (!CheckIfPlaceable(origin, radius, structures)) return false; diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index d492cf7d09..5e48fd729d 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -36,7 +36,7 @@ namespace CalamityMod.World.Planets i = 0; while (LCPlanetoidCount > 0 && i < CrystalHeartPlanetoidAttempts) { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15), (int)(Main.maxTilesX * 0.85)); int y = WorldGen.genRand.Next(70, 101); bool placed = config2.CreateBiome().Place(new Point(x, y), GenVars.structures); @@ -50,7 +50,7 @@ namespace CalamityMod.World.Planets i = 0; while (GrassPlanetoidCount > 0 && i < GrassPlanetoidAttempts) { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.25), (int)(Main.maxTilesX * 0.75)); int y = WorldGen.genRand.Next(100, 131); @@ -65,7 +65,7 @@ namespace CalamityMod.World.Planets i = 0; while (MudPlanetoidCount > 0 && i < MudPlanetoidAttempts) { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.25f), (int)(Main.maxTilesX * 0.75f)); int y = WorldGen.genRand.Next(100, 131); bool placed = config2.CreateBiome().Place(new Point(x, y), GenVars.structures); @@ -124,7 +124,7 @@ namespace CalamityMod.World.Planets public bool CheckIfPlaceable(Point origin, int radius, StructureMap structures) { //Fluff is used to create padding between the planets. this is the minimum distance between planets (they can't be within "fluff" blocks) - int fluff = 10; + int fluff = 12; int myRadius = radius + fluff; int diameter = myRadius * 2; _area = new Rectangle(origin.X - myRadius, origin.Y - myRadius, diameter, diameter);