Fixes so far (I have not tested them yet)
This commit is contained in:
1 parent
bae4ccb89b
commit
cc72eaca80
2 files changed
+42
-2
No files matched your search
@@ -357,7 +357,7 @@ namespace CalamityMod.World
|
||||
for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++)
|
||||
{
|
||||
Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y);
|
||||
if (ShouldAvoidLocation(new Point(x, y)))
|
||||
if (ShouldAvoidLocation(new Point(x, y), false))
|
||||
canGenerateInLocation = false;
|
||||
|
||||
//The granite geode is supposed to fully float in free air. No tile replacements
|
||||
|
||||
+41
-1
@@ -18,7 +18,30 @@ namespace CalamityMod.World
|
||||
var schematic = TileMaps[mapKey];
|
||||
|
||||
int placementPositionX = WorldGen.genRand.Next(GenVars.tLeft, GenVars.tRight);
|
||||
int placementPositionY = GenVars.tTop < Main.rockLayer - 10 ? GenVars.tBottom + 120 : GenVars.tTop - 120;
|
||||
|
||||
//initialPlacementPositionY is the exact same variable as placementPositionY, but it is used to store the original starting position of the vernal pass
|
||||
//this is to prevent any cases of infinite looping in the loop below when the vernal pass y-position is increased/decreased to move away from the temple and find a valid position
|
||||
int initialPlacementPositionY = GenVars.tTop < Main.maxTilesY / 2 ? GenVars.tBottom + 150 : GenVars.tTop - 150;
|
||||
int placementPositionY = GenVars.tTop < Main.maxTilesY / 2 ? GenVars.tBottom + 150 : GenVars.tTop - 150;
|
||||
|
||||
//attempt to find a valid position for the biome to place in
|
||||
bool foundValidPosition = false;
|
||||
int attempts = 0;
|
||||
|
||||
//continously place up/down until it is far enough from the temple to not destroy it
|
||||
while (!foundValidPosition && attempts++ < 100000)
|
||||
{
|
||||
while (!NoTempleNearby(startPosX, startPosY))
|
||||
{
|
||||
//increase the actual y-position the vernal pass will place at based on the starting location, if the jungle temple is too close to the initial starting location
|
||||
placementPositionY += (initialPlacementPositionY < (Main.maxTilesX / 2) ? -10 : 10);
|
||||
}
|
||||
if (NoTempleNearby(startPosX, startPosY))
|
||||
{
|
||||
foundValidPosition = true;
|
||||
}
|
||||
}
|
||||
|
||||
Point placementPoint = new Point(placementPositionX, placementPositionY);
|
||||
|
||||
Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1));
|
||||
@@ -65,5 +88,22 @@ namespace CalamityMod.World
|
||||
chest.item[i].stack = contents[i].Stack;
|
||||
}
|
||||
}
|
||||
|
||||
//determine if theres no snow blocks nearby so the biome doesnt place in the snow biome
|
||||
public static bool NoTempleNearby(int X, int Y)
|
||||
{
|
||||
for (int i = X - 200; i < X + 200; i++)
|
||||
{
|
||||
for (int j = Y - 200; j < Y + 200; j++)
|
||||
{
|
||||
if (Main.tile[i, j].HasTile && Main.tile[i, j].TileType == TileID.LihzahrdBrick)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user