Shimmer Shrine and Shimmer gen position rework.

This commit is contained in:
mountaindrew10 committed 2025-05-25 01:43:36 -05:00
1 parent 28715ce6ba
commit f36684f0ee
6 files changed
+234 -58

No files matched your search

@@ -596,6 +596,7 @@ UnderworldStructures: Remnants of an Azafurian and Demonic war
UnderworldPillars: Constructing Underworld pillars
UnderworldTreesAndGrass: Growing Underworld flora
UnderworldGeyserTraps: Adding an Underworld minefield
ShimmerShrine: Excavating an ancient shimmer well
EvilIslandCorrupt: Adding a putrid floating island
EvilIslandCrimson: Adding a grotesque floating island
AstralChest: Placing an astral chest
+6
View File
@@ -13,6 +13,9 @@ namespace CalamityMod.Schematics
{
public sealed class SchematicManager : ModSystem
{
internal const string ShimmerShrineKey = "Shimmer Shrine Key";
internal const string ShimmerShrineFilename = "Schematics/Shimmer_Shrine.csch";
internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key";
internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch";
@@ -166,6 +169,9 @@ namespace CalamityMod.Schematics
PilePlacementMaps = new Dictionary<string, PilePlacementFunction>();
TileMaps = new Dictionary<string, SchematicMetaTile[,]>
{
// Shimmer Shrine
[ShimmerShrineKey] = CalamitySchematicIO.LoadSchematic(ShimmerShrineFilename),
// Underworld structures
[BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename),
[BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename),
Binary file not shown.
+91 -58
View File
@@ -37,29 +37,53 @@ namespace CalamityMod.Systems
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref double totalWeight)
{
// Better Underworld (similar to Don't Dig Up seed but with some adjustments)
int UnderworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld"));
tasks[UnderworldIndex] = new PassLegacy("Underworld", (progress, config) =>
int underworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld"));
if (underworldIndex != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value;
CustomUnderworld.NewUnderworld();
});
tasks[underworldIndex] = new PassLegacy("Underworld", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value;
CustomUnderworld.NewUnderworld();
});
}
// Replace the shimmer gen to make it place sanely
int shimmerIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shimmer"));
if (shimmerIndex != -1)
{
tasks[shimmerIndex] = new PassLegacy("Shimmer", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterShimmer").Value;
CustomShimmer.NewShimmer();
});
}
// Better Underworld structures after the world has been smoothed
int UnderworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World"));
tasks.Insert(UnderworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) =>
int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World"));
if (underworldStructuresIndex != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value;
CustomUnderworld.NewUnderworldStructures();
tasks.Insert(underworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value;
CustomUnderworld.NewUnderworldStructures();
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value;
CustomUnderworld.NewUnderworldPillars();
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value;
CustomUnderworld.NewUnderworldPillars();
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value;
CustomUnderworld.AshTreesAndGrass();
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value;
CustomUnderworld.AshTreesAndGrass();
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value;
CustomUnderworld.PlaceGeyserTraps();
}));
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value;
CustomUnderworld.PlaceGeyserTraps();
}));
// Generate the Shimmer Shrine directly above the center of the underground Shimmer lake
tasks.Insert(underworldStructuresIndex + 2, new PassLegacy("Shimmer Shrine", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.ShimmerShrine").Value;
ShimmerShrine.PlaceShimmerShrine(GenVars.structures);
}));
}
// Evil Floating Island
int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses"));
@@ -73,47 +97,59 @@ namespace CalamityMod.Systems
}
// Generate the Astral Chest right after the dungeon has finished generating
int DungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon"));
tasks.Insert(DungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) =>
int dungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon"));
if (dungeonIndex != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value;
AstralChestGeneration.PlaceAstralChest();
}));
tasks.Insert(dungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value;
AstralChestGeneration.PlaceAstralChest();
}));
}
// Larger Jungle Temple
int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple"));
tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) =>
int jungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple"));
if (jungleTempleIndex != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value;
CustomTemple.NewJungleTemple();
});
tasks[jungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value;
CustomTemple.NewJungleTemple();
});
// Floral Paradise Biome
tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) =>
{
progress.Message = "Growing a floral paradise underground";
if (FloralParadiseMinibiome.SHOULD_GENERATE)
FloralParadiseMinibiome.GenerateInstances();
}));
// Floral Paradise Biome
tasks.Insert(jungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) =>
{
progress.Message = "Growing a floral paradise underground";
if (FloralParadiseMinibiome.SHOULD_GENERATE)
FloralParadiseMinibiome.GenerateInstances();
}));
}
// Improved Golem Arena
int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple"));
tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) =>
int jungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple"));
if (jungleTempleIndex2 != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value;
Main.tileSolid[162] = false;
Main.tileSolid[226] = true;
CustomTemple.NewJungleTemplePart2();
Main.tileSolid[232] = false;
});
tasks[jungleTempleIndex2] = new PassLegacy("Temple", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value;
Main.tileSolid[162] = false;
Main.tileSolid[226] = true;
CustomTemple.NewJungleTemplePart2();
Main.tileSolid[232] = false;
});
}
// Better Lihzahrd Altar (consistency?)
int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars"));
tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) =>
int lihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars"));
if (lihzahrdAltarIndex != -1)
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value;
CustomTemple.NewJungleTempleLihzahrdAltar();
});
tasks[lihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value;
CustomTemple.NewJungleTempleLihzahrdAltar();
});
}
// Big Hive
int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives"));
@@ -180,12 +216,11 @@ namespace CalamityMod.Systems
}
// Sunken Sea
int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral"));
if (SunkenSeaIndex != -1)
int sunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral"));
if (sunkenSeaIndex != -1)
{
tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) =>
tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) =>
{
int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2;
int sunkenSeaY = Main.maxTilesY / 2;
@@ -221,10 +256,10 @@ namespace CalamityMod.Systems
}
// All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments)
int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup"));
if (FinalIndex != -1)
int finalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup"));
if (finalIndex != -1)
{
int currentFinalIndex = FinalIndex - 1;
int currentFinalIndex = finalIndex - 1;
// Reallocate gems so rarity corresponds to depth
tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) =>
@@ -246,10 +281,10 @@ namespace CalamityMod.Systems
tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids));
// Sulphurous Sea (Step 1)
int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));
if (SulphurIndex != -1)
int sulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));
if (sulphurIndex != -1)
{
tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) =>
tasks.Insert(sulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) =>
{
progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SulphurSea").Value;
@@ -412,9 +447,7 @@ namespace CalamityMod.Systems
// Could just not add/remove gen pass, but that could lead to mod conflicts
// in case whatever mod targets this specific gen pass.
if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework)
{
hardmodeOreT1Pass.Disable();
}
tasks.Insert(announceIndex, hardmodeOreT1Pass);
}
+79
View File
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using CalamityMod.Schematics;
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using static CalamityMod.Schematics.SchematicManager;
namespace CalamityMod.World
{
public class CustomShimmer
{
public static void NewShimmer()
{
// Large = 4, Medium = 3, Small = 2
int worldSize = (int)(Main.maxTilesX / 4200f * 2f);
int minOffsetX = 225;
int maxOffsetX;
switch (worldSize)
{
default:
case 2:
maxOffsetX = 300;
break;
case 3:
maxOffsetX = 400;
break;
case 4:
maxOffsetX = 500;
break;
}
int offset = 50;
int shimmerMinDepth = (int)((Main.worldSurface + Main.rockLayer) * 0.5) + offset;
int shimmerMaxDepth = (int)(((double)((Main.maxTilesY - 250) * 2) + Main.rockLayer) * 0.33);
shimmerMaxDepth = (int)MathHelper.Clamp(shimmerMaxDepth, shimmerMinDepth + 50, Main.maxTilesY - 460);
int shimmerPositionY = WorldGen.genRand.Next(shimmerMinDepth, shimmerMaxDepth);
int shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
int remixSeedShimmerMinDepth = (int)Main.worldSurface + 150;
int remixSeedShimmerMaxDepth = (int)((Main.rockLayer + Main.worldSurface + 200D) * 0.5);
if (remixSeedShimmerMaxDepth <= remixSeedShimmerMinDepth)
remixSeedShimmerMaxDepth = remixSeedShimmerMinDepth + 50;
if (WorldGen.tenthAnniversaryWorldGen)
shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth);
int attempts = 0;
while (!WorldGen.ShimmerMakeBiome(shimmerPositionX, shimmerPositionY))
{
attempts++;
if (WorldGen.tenthAnniversaryWorldGen && attempts < 10000)
{
shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth);
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
}
else if (attempts > 20000)
{
shimmerPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 120, shimmerMaxDepth);
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX * 2, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX * 2));
}
else
{
shimmerPositionY = WorldGen.genRand.Next((int)((Main.worldSurface + Main.rockLayer) * 0.5) + 20, shimmerMaxDepth);
shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX));
}
}
GenVars.shimmerPosition = new Vector2D(shimmerPositionX, shimmerPositionY);
int genArea = 200;
GenVars.structures.AddProtectedStructure(new Rectangle(shimmerPositionX - (int)(genArea * 0.5f), shimmerPositionY - (int)(genArea * 0.5f), genArea, genArea));
}
}
}
+57
View File
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using CalamityMod.Schematics;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.WorldBuilding;
using static CalamityMod.Schematics.SchematicManager;
namespace CalamityMod.World
{
public class ShimmerShrine
{
public static void PlaceShimmerShrine(StructureMap structures)
{
string mapKey = ShimmerShrineKey;
var schematic = TileMaps[mapKey];
int placementPositionX = (int)GenVars.shimmerPosition.X;
int placementPositionY = (int)Main.worldSurface - 200;
int offset = 28;
while (!Main.tile[placementPositionX, placementPositionY].HasTile)
placementPositionY++;
Point placementPoint = new Point(placementPositionX, placementPositionY + offset);
SchematicAnchor anchorType = SchematicAnchor.Center;
bool place = true;
PlaceSchematic(mapKey, placementPoint, anchorType, ref place, new Action<Chest, int, bool>(FillShimmerShrineChest));
Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType);
CalamityUtils.AddProtectedStructure(protectionArea, 30);
}
public static void FillShimmerShrineChest(Chest chest, int Type, bool place)
{
List<ChestItem> contents = new List<ChestItem>()
{
new ChestItem(ItemID.AngelStatue, 1),
new ChestItem(WorldGen.genRand.NextBool() ? ItemID.LifeCrystal : ItemID.ManaCrystal, 1),
new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(5, 16)),
new ChestItem(ItemID.CanOfWorms, WorldGen.genRand.Next(3, 5)),
new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 11)),
new ChestItem(ItemID.LuckPotionGreater, WorldGen.genRand.Next(1, 3)),
new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 7)),
};
for (int i = 0; i < contents.Count; i++)
{
chest.item[i].SetDefaults(contents[i].Type);
chest.item[i].stack = contents[i].Stack;
}
}
}
}