Worldgen improvements + Kky fixes

-sunken sea generation fixes and improvements done
-draedon sunken sea lab changes to compensate for the sunken sea new positions
-astral biome now automatically places on ebonstone wall to prevent falling in holes, and also ignores platforms when generating
-also fixed some custom skies not deactivating on the main menu
This commit is contained in:
Mortis3 committed 2023-01-11 14:42:45 -05:00
1 parent 4507b58ee0
commit 12433e3ff8
18 files changed
+163 -50

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

+13
View File
@@ -0,0 +1,13 @@
using Terraria.ModLoader;
namespace CalamityMod.Backgrounds
{
public class SunkenSeaBGStyle : ModUndergroundBackgroundStyle
{
public override void FillTextureArray(int[] textureSlots)
{
for (int i = 0; i <= 3; i++)
textureSlots[i] = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/SunkenSeaBG" + i.ToString());
}
}
}
+1
View File
@@ -8,6 +8,7 @@ namespace CalamityMod.BiomeManagers
public class SunkenSeaBiome : ModBiome
{
public override ModWaterStyle WaterStyle => ModContent.Find<ModWaterStyle>("CalamityMod/SunkenSeaWater");
public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find<ModUndergroundBackgroundStyle>("CalamityMod/SunkenSeaBGStyle");
public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple;
public override SceneEffectPriority Priority => SceneEffectPriority.BiomeHigh;
public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon";
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Skies
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneAstral)
if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu)
Filters.Scene["CalamityMod:Astral"].Deactivate(Array.Empty<object>());
}
}
+1 -1
View File
@@ -64,7 +64,7 @@ namespace CalamityMod.Skies
public override void Update(GameTime gameTime)
{
if (!Main.LocalPlayer.Calamity().ZoneAstral)
if (!Main.LocalPlayer.Calamity().ZoneAstral || Main.gameMenu)
skyActive = false;
if (skyActive && opacity < 1f)
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Skies
public static bool DetermineDrawEligibility()
{
bool useEffect = (BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly;
bool useEffect = ((BossRushEvent.BossRushActive && BossRushEvent.StartTimer > 100) || ShouldDrawRegularly) && !Main.gameMenu;
if (SkyManager.Instance["CalamityMod:BossRush"] != null && useEffect != SkyManager.Instance["CalamityMod:BossRush"].IsActive())
{
+1 -1
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Skies
public static void UpdateDrawEligibility()
{
bool useEffect = NPC.AnyNPCs(ModContent.NPCType<Cryogen>()) || ShouldDrawRegularly;
bool useEffect = (NPC.AnyNPCs(ModContent.NPCType<Cryogen>()) || ShouldDrawRegularly) && !Main.gameMenu;
if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useEffect != SkyManager.Instance["CalamityMod:Cryogen"].IsActive())
{
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Skies
public override void Update(GameTime gameTime)
{
if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1)
if (Main.LocalPlayer.Calamity().monolithAccursedShader < 1 || Main.gameMenu)
skyActive = false;
if (skyActive && opacity < 1f)
+17 -2
View File
@@ -77,14 +77,29 @@ namespace CalamityMod.Systems
});
// Sunken Sea gens after Traps because otherwise boulders spawn in the Sunken Sea :)
int TrapsIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Traps"));
int TrapsIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Settle Liquids Again"));
if (TrapsIndex != -1)
{
tasks.Insert(TrapsIndex + 1, new PassLegacy("Sunken Sea", (progress, config) =>
{
progress.Message = "Partially flooding an overblown desert";
int sunkenSeaX = WorldGen.UndergroundDesertLocation.Left;
int sunkenSeaY = WorldGen.UndergroundDesertLocation.Center.Y;
int sunkenSeaY = 0;
//desert position shennanigans
//start right above hell, then move up until a desert tile is found, and then place the sunken sea
bool foundPosition = false;
for (int y = Main.maxTilesY - 200; y >= (Main.maxTilesY / 2) - 45; y--)
{
if (Main.tile[sunkenSeaX, y].TileType == TileID.Sand || Main.tile[sunkenSeaX, y].TileType == TileID.Sandstone ||
Main.tile[sunkenSeaX, y].TileType == TileID.Sand || Main.tile[sunkenSeaX, y].TileType == TileID.Sandstone)
{
sunkenSeaY = y + 100; //offset so it doesnt generates weird
break;
}
}
SunkenSea.Place(new Point(sunkenSeaX, sunkenSeaY));
}));
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

+2 -1
View File
@@ -133,7 +133,8 @@ namespace CalamityMod.World
int y = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336
while (y < Main.maxTilesY)
{
if (Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType])
//check to place the astral meteor on valid tiles, place automatically on ebonstone walls, and avoid platforms
if (((Main.tile[x, y].HasTile && Main.tileSolid[(int)Main.tile[x, y].TileType]) || Main.tile[x, y].WallType == 3) && !TileID.Sets.Platforms[Main.tile[x, y].TileType])
{
int suitableTiles = 0;
int checkRadius = 15;
+18 -5
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.DraedonMisc;
using CalamityMod.Tiles.SunkenSea;
using CalamityMod.Items.DraedonMisc;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.LabFinders;
@@ -289,7 +290,7 @@ namespace CalamityMod.World
//for now just manually check the area around the lab and replace water with lava, may not be the best permanent fix but it works for now
for (int killWaterX = placementPoint.X - 150; killWaterX <= placementPoint.X + 150; killWaterX++)
{
for (int killWaterY = Main.maxTilesY - 200; killWaterY <= Main.maxTilesY - 6; killWaterY++)
for (int killWaterY = underworldTop; killWaterY <= Main.maxTilesY - 5; killWaterY++)
{
Tile tile = Framing.GetTileSafely(killWaterX, killWaterY);
@@ -361,9 +362,21 @@ namespace CalamityMod.World
else
placementPositionX = WorldGen.genRand.Next(ugDesert.Right - 10, ugDesert.Right + 20) - labWidth;
// Somewhere in the middle third of the Sunken Sea, which itself is in the lower half of the Underground Desert
int sunkenSeaHeight = ugDesert.Height / 4;
int placementPositionY = (int)(ugDesert.Center.Y + Main.rand.NextFloat(0.33f, 0.67f) * sunkenSeaHeight) - labHeight;
int sunkenSeaY = 0;
bool foundPosition = false;
//copied the desert position code from the sunken sea's generation so the lab always generates within the sunken sea properly
for (int y = Main.maxTilesY - 200; y >= (Main.maxTilesY / 2) - 45; y--)
{
if (Main.tile[placementPositionX, y].TileType == ModContent.TileType<Navystone>() ||
Main.tile[placementPositionX, y].TileType == ModContent.TileType<EutrophicSand>())
{
sunkenSeaY = y - 90; //offset so it generates nicely
break;
}
}
int placementPositionY = (int)(sunkenSeaY) - labHeight;
placementPoint = new Point(placementPositionX, placementPositionY);
Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1));
+107 -37
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
@@ -202,6 +203,7 @@ namespace CalamityMod.World
Vector2 totalScale = new Vector2(totalWidth, totalHeight);
Vector2 individualScale = new Vector2(clusters.Width, clusters.Height);
//I was a bit worried about editing anything in this loop too drastically, so i just changed all instances of placing navystone to eutrophic sand
for (int i = -20; i < totalWidth + 20; i++)
{
for (int j = -20; j < totalHeight + 20; j++)
@@ -241,14 +243,14 @@ namespace CalamityMod.World
float num10 = num3 + num5;
Tile tile = Main.tile[num6, num7];
bool flag = num8 >= 0.8f;
if (num10 > 3.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent
if (num10 > 4.5f) //Adjust num10 for all cases if you want different tile frequencies; higher is less frequent, lower is more frequent
{
tile.ClearEverything();
tile.WallType = (ushort)ModContent.WallType<NavystoneWall>();
//tile.WallType = (ushort)ModContent.WallType<NavystoneWall>();
tile.LiquidAmount = 192;
if (num4 % 15 == 2)
if (num4 % 5 == 2)
{
tile.ResetToType((ushort)ModContent.TileType<Navystone>());
tile.ResetToType((ushort)ModContent.TileType<EutrophicSand>());
tile.Get<TileWallWireStateData>().HasTile = true;
tile.LiquidAmount = 0;
}
@@ -260,7 +262,7 @@ namespace CalamityMod.World
tile.LiquidAmount = 192;
if (!flag || tile.HasTile)
{
tile.ResetToType((ushort)ModContent.TileType<Navystone>());
tile.ResetToType((ushort)ModContent.TileType<EutrophicSand>());
tile.Get<TileWallWireStateData>().HasTile = true;
Tile.SmoothSlope(num6, num7, true);
tile.LiquidAmount = 0;
@@ -300,6 +302,69 @@ namespace CalamityMod.World
}
}
}
//seperate loop for biome polish and stuff
for (int i = -20; i < totalWidth + 20; i++)
{
for (int j = start.X + 50; j < Main.maxTilesY - 200; j++)
{
int x = i + start.X;
int y = j + start.Y;
/*
//randomly place navystone chunks on top of exposed sand
if (WorldGen.genRand.Next(50) == 0 && tile.HasTile && tile.TileType == ModContent.TileType<EutrophicSand>() && !tileAbove.HasTile)
{
//todo: change this to be more natural and not a circle, maybe use WorldGen.TileRunner?
BasicCircle(x, y, WorldGen.genRand.Next(3, 12), ModContent.TileType<Navystone>());
}
*/
//randomly kill walls so that the background can show through in some places
if (WorldGen.genRand.Next(50) == 0)
{
//TODO: continue this tomorrow
int radius = (int)(((float)WorldGen.genRand.Next(8, 20)));
float outerRadius = WorldGen.genRand.Next(40, 56) * 0.01f;
ShapeData holeShape = new ShapeData();
WorldUtils.Gen(new Point(x, y), new Shapes.Circle((int)((float)radius * (outerRadius * 0.3f))), Actions.Chain(new GenAction[] //Smallest is 1
{
new Modifiers.Blotches(2, 0.3).Output(holeShape),
new Actions.ClearWall(true), //Clear center
new Actions.SetLiquid(0, 255)
}));
}
}
}
//final cleanup loop
for (int i = -20; i < totalWidth + 20; i++)
{
for (int j = -20; j < totalHeight + 20; j++)
{
int x = i + start.X;
int y = j + start.Y;
Tile tile = Main.tile[x, y];
//lava BEGONE
if (tile.WallType == ModContent.WallType<NavystoneWall>() || tile.WallType == ModContent.WallType<EutrophicSandWall>())
{
if (tile.LiquidType == LiquidID.Lava && tile.LiquidAmount > 0)
{
tile.LiquidType = LiquidID.Water;
tile.LiquidAmount = 255;
}
//also get rid of any annoying leftover obsidian
if (tile.TileType == TileID.Obsidian)
{
WorldGen.KillTile(x, y);
}
}
}
}
}
// Adds tile variation to generated tile clusters and generates open areas with sea prism ore called "Tits"
@@ -475,7 +540,8 @@ namespace CalamityMod.World
int num5 = k + start.X;
int num6 = l + start.Y;
Tile tile2 = Main.tile[num5, num6];
if (tile2.HasTile && (tile2.TileType == ModContent.TileType<SeaPrism>() || tile2.TileType == ModContent.TileType<Navystone>()))
if (tile2.HasTile && (tile2.TileType == ModContent.TileType<SeaPrism>() ||
tile2.TileType == ModContent.TileType<Navystone>() || tile2.TileType == ModContent.TileType<EutrophicSand>()))
{
bool flag = true;
for (int m = -1; m >= -3; m--)
@@ -513,7 +579,8 @@ namespace CalamityMod.World
break;
}
}
if (tile2.TileType == ModContent.TileType<SeaPrism>() || (tile2.TileType == ModContent.TileType<Navystone>() && WorldGen.genRand.Next(8) == 0))
if (tile2.TileType == ModContent.TileType<SeaPrism>() || ((tile2.TileType == ModContent.TileType<Navystone>() ||
tile2.TileType == ModContent.TileType<EutrophicSand>()) && WorldGen.genRand.Next(8) == 0))
{
if (flag3 ^ flag4)
{
@@ -553,41 +620,44 @@ namespace CalamityMod.World
}
}
}
if (tile2.TileType == ModContent.TileType<Navystone>() || tile2.TileType == ModContent.TileType<EutrophicSand>())
{
if (WorldGen.genRand.Next(5) == 0)
{
PlaceTit(num5, num6 + 1, (ushort)ModContent.TileType<SunkenSeaStalactite>());
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<BrainCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(5) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<SmallBrainCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(10) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<FanCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<TubeCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(5) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<SmallTubeCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6 - 1, (ushort)ModContent.TileType<SeaAnemone>(), true, false, -1, 0);
}
}
if (!tile2.HasTile)
{
if (tile2.WallType == ModContent.WallType<NavystoneWall>() || tile2.WallType == ModContent.WallType<EutrophicSandWall>())
if (tile2.TileType == ModContent.TileType<Navystone>() || tile2.WallType == ModContent.WallType<EutrophicSandWall>())
{
if (WorldGen.genRand.Next(5) == 0)
{
PlaceTit(num5, num6, (ushort)ModContent.TileType<SunkenSeaStalactite>());
}
if (WorldGen.genRand.Next(8) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<BrainCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<SmallBrainCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(10) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<FanCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<SeaAnemone>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(8) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<TubeCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(6) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<SmallTubeCoral>(), true, false, -1, 0);
}
if (WorldGen.genRand.Next(4) == 0)
{
WorldGen.PlaceTile(num5, num6, (ushort)ModContent.TileType<TableCoral>(), true, false, -1, 0);
WorldGen.PlaceTile(num5, num6 + 1, (ushort)ModContent.TileType<TableCoral>(), true, false, -1, 0);
}
}
}