diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs new file mode 100644 index 0000000000..8c53155e0a --- /dev/null +++ b/CalamityKeybinds.cs @@ -0,0 +1,63 @@ +using Terraria.ModLoader; + +namespace CalamityMod + +{ + public class CalamityKeybinds : ModSystem + { + public static ModKeybind NormalityRelocatorHotKey { get; private set; } + public static ModKeybind AegisHotKey { get; private set; } + public static ModKeybind TarraHotKey { get; private set; } + public static ModKeybind RageHotKey { get; private set; } + public static ModKeybind AdrenalineHotKey { get; private set; } + public static ModKeybind AstralTeleportHotKey { get; private set; } + public static ModKeybind AstralArcanumUIHotkey { get; private set; } + public static ModKeybind MomentumCapacitatorHotkey { get; private set; } + public static ModKeybind SandCloakHotkey { get; private set; } + public static ModKeybind SpectralVeilHotKey { get; private set; } + public static ModKeybind PlaguePackHotKey { get; private set; } + public static ModKeybind AngelicAllianceHotKey { get; private set; } + public static ModKeybind GodSlayerDashHotKey { get; private set; } + public static ModKeybind ExoChairSpeedupHotkey { get; private set; } + public static ModKeybind ExoChairSlowdownHotkey { get; private set; } + + public override void Load() + { + // Register keybinds + NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "Normality Relocator", "Z"); + RageHotKey = KeybindLoader.RegisterKeybind(Mod, "Rage Mode", "V"); + AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "Adrenaline Mode", "B"); + AegisHotKey = KeybindLoader.RegisterKeybind(Mod, "Elysian Guard", "N"); + TarraHotKey = KeybindLoader.RegisterKeybind(Mod, "Armor Set Bonus", "Y"); + AstralTeleportHotKey = KeybindLoader.RegisterKeybind(Mod, "Astral Teleport", "P"); + AstralArcanumUIHotkey = KeybindLoader.RegisterKeybind(Mod, "Astral Arcanum UI Toggle", "O"); + MomentumCapacitatorHotkey = KeybindLoader.RegisterKeybind(Mod, "Momentum Capacitor Effect", "U"); + SandCloakHotkey = KeybindLoader.RegisterKeybind(Mod, "Sand Cloak Effect", "C"); + SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "Spectral Veil Teleport", "Z"); + PlaguePackHotKey = KeybindLoader.RegisterKeybind(Mod, "Booster Dash", "Q"); + AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "Angelic Alliance Blessing", "G"); + GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "God Slayer Dash", "H"); + ExoChairSpeedupHotkey = KeybindLoader.RegisterKeybind(Mod, "Exo Chair Speed Up", "LeftShift"); + ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "Exo Chair Slow Down", "RightShift"); + } + + public override void Unload() + { + // Not required anymore, but nice nontheless + + NormalityRelocatorHotKey = null; + RageHotKey = null; + AdrenalineHotKey = null; + AegisHotKey = null; + TarraHotKey = null; + AstralTeleportHotKey = null; + AstralArcanumUIHotkey = null; + MomentumCapacitatorHotkey = null; + SandCloakHotkey = null; + SpectralVeilHotKey = null; + PlaguePackHotKey = null; + AngelicAllianceHotKey = null; + GodSlayerDashHotKey = null; + } + } +} \ No newline at end of file diff --git a/CalamityMod.cs b/CalamityMod.cs index 3b851f982a..f04548ea0c 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -79,23 +79,6 @@ namespace CalamityMod // CONSIDER -- I have been advised by Jopo that Mods should never contain static variables // TODO -- 1.4 fixes the crit reforge price calculation bug, so GetWeaponCrit everywhere can go. - // Hotkeys - public static ModHotKey NormalityRelocatorHotKey; - public static ModHotKey AegisHotKey; - public static ModHotKey TarraHotKey; - public static ModHotKey RageHotKey; - public static ModHotKey AdrenalineHotKey; - public static ModHotKey AstralTeleportHotKey; - public static ModHotKey AstralArcanumUIHotkey; - public static ModHotKey MomentumCapacitatorHotkey; - public static ModHotKey SandCloakHotkey; - public static ModHotKey SpectralVeilHotKey; - public static ModHotKey PlaguePackHotKey; - public static ModHotKey AngelicAllianceHotKey; - public static ModHotKey GodSlayerDashHotKey; - public static ModHotKey ExoChairSpeedupHotkey; - public static ModHotKey ExoChairSlowdownHotkey; - // Boss Spawners public static int ghostKillCount = 0; public static int sharkKillCount = 0; @@ -195,21 +178,7 @@ namespace CalamityMod Mount.mounts[Mount.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; Mount.mounts[Mount.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; - NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); - RageHotKey = RegisterHotKey("Rage Mode", "V"); - AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B"); - AegisHotKey = RegisterHotKey("Elysian Guard", "N"); - TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); - AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); - AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); - MomentumCapacitatorHotkey = RegisterHotKey("Momentum Capacitor Effect", "U"); - SandCloakHotkey = RegisterHotKey("Sand Cloak Effect", "C"); - SpectralVeilHotKey = RegisterHotKey("Spectral Veil Teleport", "Z"); - PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); - AngelicAllianceHotKey = RegisterHotKey("Angelic Alliance Blessing", "G"); - GodSlayerDashHotKey = RegisterHotKey("God Slayer Dash", "H"); - ExoChairSpeedupHotkey = RegisterHotKey("Exo Chair Speed Up", "LeftShift"); - ExoChairSlowdownHotkey = RegisterHotKey("Exo Chair Slow Down", "RightShift"); + if (!Main.dedServ) { @@ -358,20 +327,6 @@ namespace CalamityMod thorium = null; varia = null; - NormalityRelocatorHotKey = null; - RageHotKey = null; - AdrenalineHotKey = null; - AegisHotKey = null; - TarraHotKey = null; - AstralTeleportHotKey = null; - AstralArcanumUIHotkey = null; - MomentumCapacitatorHotkey = null; - SandCloakHotkey = null; - SpectralVeilHotKey = null; - PlaguePackHotKey = null; - AngelicAllianceHotKey = null; - GodSlayerDashHotKey = null; - AstralCactusTexture = null; AstralCactusGlowTexture = null; AstralSky = null;