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
This commit is contained in:
Storm2103 committed 2023-10-31 22:04:20 -06:00
1 parent 4af92cc56e
commit 3cd3eb63eb
3 files changed
+12 -8

No files matched your search

+2
View File
@@ -71,6 +71,8 @@ namespace CalamityMod
armageddon = false;
AcidRainEvent.AcidRainEventIsOngoing = false;
AcidRainEvent.CountdownUntilForcedAcidRain = 0;
HasGeneratedLuminitePlanetoids = false; //Allow generating planetoids in other worlds
}
#endregion
+6 -4
View File
@@ -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<LuminitePlanet>().Place(planetoidOrigin, GenVars.structures))
@@ -38,13 +39,14 @@ namespace CalamityMod.World.Planets
if (config.CreateBiome<LuminitePlanet2>().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;
+4 -4
View File
@@ -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<HeartPlanet>().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<MudPlanet>().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);