Calamity now edits the Master Mode worldgen description to mention boss changes

This commit is contained in:
CongratsIsTrash committed 2024-11-17 15:42:49 -05:00
1 parent 4fc623990b
commit 7eca945ed4
3 files changed
+26 -1

No files matched your search

+1
View File
@@ -181,6 +181,7 @@ namespace CalamityMod.ILEditing
IL_WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits;
IL_UIWorldCreation.SetDefaultOptions += ChangeDefaultWorldSize;
IL_UIWorldCreation.AddWorldSizeOptions += SwapSmallDescriptionKey;
IL_UIWorldCreation.AddWorldDifficultyOptions += SwapMasterModeDescriptionKey;
Terraria.IO.On_WorldFile.ClearTempTiles += ClearModdedTempTiles;
On_WorldGen.MakeDungeon += LimitDungeonEntranceXPosition;
IL_WorldGen.DungeonHalls += LimitDungeonHallsXPosition;
+23 -1
View File
@@ -161,7 +161,7 @@ namespace CalamityMod.ILEditing
}
#endregion
#region Change Small World Description
#region Change World Generation Descriptions
/// <summary>
/// Changes the description of Small worlds to serve as a warning.
/// </summary>
@@ -181,6 +181,28 @@ namespace CalamityMod.ILEditing
// Emit our new string "Mods.CalamityMod.UI.SmallWorldWarning".
c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning");
}
/// <summary>
/// Changes the description of Master Mode to mention boss changes.
/// </summary>
private static void SwapMasterModeDescriptionKey(ILContext il)
{
// Swap vanilla's Master Mode description string (UI.WorldDescriptionMaster) with Calamity's edited version (Mods.CalamityMod.UI.WorldMaster).
var cursor = new ILCursor(il);
// Move to after the string.
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdstr("UI.WorldDescriptionMaster")))
{
LogFailure("Change Master Mode Description", "Could not match string \"UI.WorldDescriptionMaster\".");
return;
}
// Pop this value off, then replace it with Calamity's new string.
cursor.EmitPop();
cursor.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.WorldMaster");
}
#endregion
@@ -1,4 +1,6 @@
// Vanilla UI edits
SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]"
WorldMaster: Game over man, game over! (Brutally hard boss changes, for the truly brave)
// Main UI Elements
Adrenaline: Adrenaline
Nanomachines: Nanomachines