From 8bb98101c06af4fbf92f131dc205caaf4d1c2a91 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 12:04:55 -0500 Subject: [PATCH 1/9] New Keybind system for accessories/held items --- CalPlayer/CalamityPlayer.cs | 27 +-- CalamityKeybinds.cs | 197 +++++++++++++++--- Items/Accessories/AngelicAlliance.cs | 3 +- Items/Accessories/AscendantInsignia.cs | 2 +- Items/Accessories/BlazingCore.cs | 3 +- Items/Accessories/BlunderBooster.cs | 7 +- Items/Accessories/DeadshotBrooch.cs | 4 +- Items/Accessories/FlameLickedShell.cs | 3 +- Items/Accessories/InterstellarStompers.cs | 2 +- Items/Accessories/PlaguedFuelPack.cs | 7 +- Items/Accessories/PlanebreakersPouch.cs | 4 +- Items/Accessories/SpectralVeil.cs | 2 +- Items/Accessories/SpringStool.cs | 14 +- Items/Accessories/ThePointer.cs | 5 +- Items/Accessories/TheTransformer.cs | 2 +- .../en-US/Mods.CalamityMod.Keybinds.hjson | 18 +- .../en-US/Mods.CalamityMod.Misc.hjson | 1 + Systems/Collections/CalamityItemSets.cs | 5 + Utilities/ItemUtils.cs | 19 ++ 19 files changed, 243 insertions(+), 82 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 76ca7d151f..c6bb3f1b97 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -956,7 +956,7 @@ namespace CalamityMod.CalPlayer public bool procDodgeEffects = false; public bool nanotech = false; public int nanotechHitCooldown = 0; - public bool deadshotBrooch = false; + public Item ammoCycleItem = null; public bool shadowMinions = false; public bool statisMinions = false; public bool alchFlask = false; @@ -1067,6 +1067,7 @@ namespace CalamityMod.CalPlayer public bool thiefsDime = false; public bool dynamoStemCells = false; public bool etherealExtorter = false; + public Item AccessoryParryItem = null; public bool blazingCore = false; public int blazingCoreParry = 0; public int blazingCoreSuccessfulParry = 0; @@ -1110,7 +1111,7 @@ namespace CalamityMod.CalPlayer public bool spectralVeil = false; public int spectralVeilImmunity = 0; /// Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped. - public bool hasJetpack = false; + public Item rogueDashItem = null; public bool hasEngineDash = false; public bool plaguedFuelPack = false; public bool blunderBooster = false; @@ -2395,7 +2396,7 @@ namespace CalamityMod.CalPlayer v8000Engine = false; nanotech = false; nanotechHitCooldown = 0; - deadshotBrooch = false; + ammoCycleItem = null; tesla = false; teslaVisuals = true; ascendantInsignia = false; @@ -2473,6 +2474,7 @@ namespace CalamityMod.CalPlayer thiefsDime = false; dynamoStemCells = false; etherealExtorter = false; + AccessoryParryItem = null; blazingCore = false; voltaicJelly = false; jellyChargedBattery = false; @@ -2612,7 +2614,7 @@ namespace CalamityMod.CalPlayer filthyGlove = false; sandCloak = false; spectralVeil = false; - hasJetpack = false; + rogueDashItem = null; hasEngineDash = false; plaguedFuelPack = false; blunderBooster = false; @@ -3467,7 +3469,7 @@ namespace CalamityMod.CalPlayer if (Player.dead) return; - if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) + if (ascendantInsignia && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && ascendantInsigniaCooldown <= 0) { var source = Player.GetSource_Accessory(FindAccessory()); Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType(), 0, 0f); @@ -3477,7 +3479,7 @@ namespace CalamityMod.CalPlayer } int numOfBlobs = Player.ownedProjectileCounts[ProjectileType()]; - if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && CalamityKeybinds.TransformerHotKey.JustPressed && transformerCooldown <= 0 && true) // Add check if projectiles are active + if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && transformerCooldown <= 0 && true) // Add check if projectiles are active { // Go fire all the blobs int cooldownTime = 300; @@ -3504,7 +3506,8 @@ namespace CalamityMod.CalPlayer } //Only increment the slam if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset slam time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.JustPressed && gSabatonHotkeyFallWindup < 0) + + if (gSabaton && FindAccessory().JustPressedKeybind() && gSabatonHotkeyFallWindup < 0) gSabatonHotkeyFallWindup = 0; if (gSabaton && gSabatonHotkeyFallWindup >= 0 && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { @@ -3550,7 +3553,7 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityKeybinds.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) + if (angelicAlliance && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) { Player.AddBuff(BuffType(), AngelicAlliance.DivineBlessDuration, false); SoundEngine.PlaySound(AngelicAlliance.ActivationSound, Player.Center); @@ -3577,7 +3580,7 @@ namespace CalamityMod.CalPlayer Player.HealPlayer(AngelicAlliance.HealPerAngelSpawned); } } - if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (spectralVeil && Main.myPlayer == Player.whoAmI && FindAccessory().JustPressedKeybind() && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0) { if (!Player.chaosState) @@ -3623,7 +3626,7 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityKeybinds.BoosterDashHotKey.JustPressed && hasJetpack && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && + if (rogueDashItem != null && Main.myPlayer == Player.whoAmI && rogueDashItem.JustPressedKeybind() && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(RogueBooster.ID) && !Player.mount.Active) { jetPackDash = blunderBooster ? 15 : 10; @@ -3634,7 +3637,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item34, Player.Center); } - if (CalamityKeybinds.AmmoCycleHotkey.JustPressed && deadshotBrooch) + if (ammoCycleItem != null && ammoCycleItem.JustPressedKeybind()) { SoundEngine.PlaySound(SoundID.Item149, Player.Center); @@ -3733,7 +3736,7 @@ namespace CalamityMod.CalPlayer else ArmorSetBonusKeyHeldTimer = 0; - if (CalamityKeybinds.AccessoryParryHotKey.JustPressed) + if (AccessoryParryItem != null && AccessoryParryItem.JustPressedKeybind()) { if (blazingCore && blazingCoreParry == 0 && blazingCoreSuccessfulParry == 0) { diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 62b5f44039..56fd1f6497 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -1,72 +1,207 @@ -using Terraria.ModLoader; +using System; +using System.Linq; +using CalamityMod.Systems.Collections; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod { public class CalamityKeybinds : ModSystem { - public static ModKeybind AccessoryParryHotKey { get; private set; } public static ModKeybind AdrenalineHotKey { get; private set; } - public static ModKeybind AmmoCycleHotkey { get; private set; } - public static ModKeybind AngelicAllianceHotKey { get; private set; } public static ModKeybind ArmorSetBonusHotKey { get; private set; } - public static ModKeybind AscendantInsigniaHotKey { get; private set; } - public static ModKeybind BoosterDashHotKey { get; private set; } public static ModKeybind DashHotkey { get; private set; } public static ModKeybind ExoChairSlowdownHotkey { get; private set; } public static ModKeybind GodSlayerDashHotKey { get; private set; } - public static ModKeybind GravistarSabatonHotkey { get; private set; } public static ModKeybind NormalityRelocatorHotKey { get; private set; } public static ModKeybind RageHotKey { get; private set; } - public static ModKeybind SpectralVeilHotKey { get; private set; } - public static ModKeybind SpringStoolJumpHotKey { get; private set; } - public static ModKeybind TransformerHotKey { get; private set; } - public static ModKeybind SwitchGravityHotkey {get; private set;} + public static ModKeybind SwitchGravityHotkey { get; private set; } public static ModKeybind ExpandDebuffInfo { get; private set; } - public static ModKeybind ThePointerLock {get; private set;} + + + public static ModKeybind HeldItem { get; private set; } + public static ModKeybind Accessory1 { get; private set; } + public static ModKeybind Accessory2 { get; private set; } + public static ModKeybind Accessory3 { get; private set; } + public static ModKeybind Accessory4 { get; private set; } + public static ModKeybind Accessory5 { get; private set; } + public static ModKeybind Accessory6 { get; private set; } + public static ModKeybind Accessory7 { get; private set; } + + public static ModKeybind[] AccessoryKeybinds = []; public override void Load() { // Register keybinds - AccessoryParryHotKey = KeybindLoader.RegisterKeybind(Mod, "ActivateAccessoryParry", "N"); AdrenalineHotKey = KeybindLoader.RegisterKeybind(Mod, "AdrenalineMode", "B"); - AmmoCycleHotkey = KeybindLoader.RegisterKeybind(Mod, "AmmoCycle", "Mouse3"); - AngelicAllianceHotKey = KeybindLoader.RegisterKeybind(Mod, "AngelicAllianceBlessing", "G"); ArmorSetBonusHotKey = KeybindLoader.RegisterKeybind(Mod, "ArmorSetBonus", "Y"); - AscendantInsigniaHotKey = KeybindLoader.RegisterKeybind(Mod, "AscendantInsigniaHotKey", "K"); - BoosterDashHotKey = KeybindLoader.RegisterKeybind(Mod, "BoosterDash", "Q"); DashHotkey = KeybindLoader.RegisterKeybind(Mod, "DashDoubleTapOverride", "F"); ExoChairSlowdownHotkey = KeybindLoader.RegisterKeybind(Mod, "ExoChairSlowDown", "RightShift"); GodSlayerDashHotKey = KeybindLoader.RegisterKeybind(Mod, "GodSlayerDash", "H"); - GravistarSabatonHotkey = KeybindLoader.RegisterKeybind(Mod, "GravistarSabatonHotkey", "X"); NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z"); RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V"); - SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z"); - SpringStoolJumpHotKey = KeybindLoader.RegisterKeybind(Mod, "SpringStoolJumpHotKey", "U"); - TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K"); SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T"); ExpandDebuffInfo = KeybindLoader.RegisterKeybind(Mod, "ExpandDebuffInfo", "LeftControl"); - ThePointerLock = KeybindLoader.RegisterKeybind(Mod, "ThePointerLock", "N"); + + HeldItem = KeybindLoader.RegisterKeybind(Mod, "HeldItem", "NumPad0"); + Accessory1 = KeybindLoader.RegisterKeybind(Mod, "Accessory1", "NumPad1"); + Accessory2 = KeybindLoader.RegisterKeybind(Mod, "Accessory2", "NumPad2"); + Accessory3 = KeybindLoader.RegisterKeybind(Mod, "Accessory3", "NumPad3"); + Accessory4 = KeybindLoader.RegisterKeybind(Mod, "Accessory4", "NumPad4"); + Accessory5 = KeybindLoader.RegisterKeybind(Mod, "Accessory5", "NumPad5"); + Accessory6 = KeybindLoader.RegisterKeybind(Mod, "Accessory6", "NumPad6"); + Accessory7 = KeybindLoader.RegisterKeybind(Mod, "Accessory7", "NumPad7"); + + AccessoryKeybinds = [ + Accessory1, + Accessory2, + Accessory3, + Accessory4, + Accessory5, + Accessory6, + Accessory7 + ]; } public override void Unload() { - AccessoryParryHotKey = null; AdrenalineHotKey = null; - AmmoCycleHotkey = null; - AngelicAllianceHotKey = null; ArmorSetBonusHotKey = null; - AscendantInsigniaHotKey = null; - BoosterDashHotKey = null; DashHotkey = null; ExoChairSlowdownHotkey = null; GodSlayerDashHotKey = null; - GravistarSabatonHotkey = null; NormalityRelocatorHotKey = null; RageHotKey = null; - SpectralVeilHotKey = null; - SpringStoolJumpHotKey = null; - TransformerHotKey = null; ExpandDebuffInfo = null; + + Accessory1 = null; + Accessory2 = null; + Accessory3 = null; + Accessory4 = null; + Accessory5 = null; + Accessory6 = null; + Accessory1 = null; + Accessory7 = null; + + AccessoryKeybinds = null; + } + } + + public static class CalamityKeybindsExtensions + { + /// + /// Gets if the Calamity keybind for the given item was just pressed.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool JustPressedKeybind(this Item item) + { + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.JustPressed; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + + int keybindToUse = 0; + + for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + { + if (Main.LocalPlayer.armor[i].type == item.type) + break; + if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) + keybindToUse++; + } + return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustPressed; + } + + /// + /// Gets if the Calamity keybind for the given item was just released.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool JustReleasedKeybind(this Item item) + { + + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.JustReleased; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + + int keybindToUse = 0; + + for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + { + if (Main.LocalPlayer.armor[i].type == item.type) + break; + if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) + keybindToUse++; + } + + return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustReleased; + } + + + /// + /// Gets if the Calamity keybind for the given item is currently held down.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static bool CurrentlyPressingKeybind(this Item item) + { + if (item == Main.LocalPlayer.HeldItem) + return CalamityKeybinds.HeldItem.Current; + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + throw new InvalidOperationException("Item is not marked as having a Calamity keybind in the HasAccessoryKeybind item set"); + + int keybindToUse = 0; + + for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + { + if (Main.LocalPlayer.armor[i].type == item.type) + break; + if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) + keybindToUse++; + } + + return CalamityKeybinds.AccessoryKeybinds[keybindToUse].Current; + } + + + /// + /// Gets the Calamity keybind for the given item.
+ /// Automatically adjusts between Held Item and Accessory Ability keybinds based on if the item is held and equip order of accessories + ///
+ /// + /// + /// + public static ModKeybind? GetDynamicModHotkey(this Item item) + { + + if (!CalamityItemSets.HasAccessoryKeybind[item.type]) + return CalamityKeybinds.HeldItem; + + if (!Main.LocalPlayer.armor.Any(x => x.type == item.type)) + return null; + + int keybindToUse = 0; + + for (var i = 0; i < Main.LocalPlayer.armor.Length; i++) + { + if (Main.LocalPlayer.armor[i].type == item.type) + break; + if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) + keybindToUse++; + } + + return CalamityKeybinds.AccessoryKeybinds[keybindToUse]; } } } diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index aca8d30b28..4d26811f71 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.Audio; @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Accessories Item.Calamity().devItem = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AngelicAllianceHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index cd3b024632..9a38c4ae96 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories public static int AbilityCooldown = CalamityUtils.SecondsToFrames(40); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoost.ToPercent(), MoveSpeedBoost.ToPercent(), (1f + AccelerationBoost).Round(), AbilityDuration.FramesToSeconds(), AbilityCooldown.FramesToSeconds()); - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AscendantInsigniaHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void SetDefaults() { Item.width = 46; diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index 87edf334c1..6082a7d1ae 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories ItemID.Sets.AnimatesAsSoul[Type] = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Main.LocalPlayer.Calamity().AccessoryParryItem != null ? Main.LocalPlayer.Calamity().AccessoryParryItem : Item); public override void SetDefaults() { Item.width = 42; @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().blazingCore = true; + player.Calamity().AccessoryParryItem = Item; player.noKnockback = true; } diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 1a1b2bac13..19e94e34f6 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -18,12 +18,9 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - // TODO -- Check if its trying to replace the other rogue jetpack. If its the case, return true. - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().hasJetpack; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().hasJetpack = true; + player.Calamity().rogueDashItem = Item; player.GetDamage() += 0.12f; player.Calamity().rogueVelocity += 0.15f; player.Calamity().blunderBooster = true; @@ -32,7 +29,7 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.BoosterDashHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index 16e3459913..5c3497351d 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().deadshotBrooch = true; + player.Calamity().ammoCycleItem = Item; player.Calamity().ammoCost *= 0.8f; player.GetDamage() += 0.12f; player.GetCritChance() += 7; } - public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 53f57e9697..244eddd3d0 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; internal const int flameLickedParry = 30; - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AccessoryParryHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Main.LocalPlayer.Calamity().AccessoryParryItem != null ? Main.LocalPlayer.Calamity().AccessoryParryItem : Item); public override void SetStaticDefaults() { CalamityItemSets.ExtraDebuffTooltip_Enemy[Type] = [ModContent.BuffType()]; @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.flameLickedShell = true; + modPlayer.AccessoryParryItem = Item; player.noKnockback = true; } diff --git a/Items/Accessories/InterstellarStompers.cs b/Items/Accessories/InterstellarStompers.cs index 2f82b292fb..0991544716 100644 --- a/Items/Accessories/InterstellarStompers.cs +++ b/Items/Accessories/InterstellarStompers.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories Item.expert = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.GravistarSabatonHotkey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 7ba1dcb02f..6af7b7c0ad 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -17,12 +17,9 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - // TODO -- Check if the slot contains the other rogue jetpack, in which case, let the player swap accs - public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().hasJetpack; - public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().hasJetpack = true; + player.Calamity().rogueDashItem = Item; player.GetDamage() += 0.08f; player.Calamity().rogueVelocity += 0.15f; player.Calamity().plaguedFuelPack = true; @@ -30,6 +27,6 @@ namespace CalamityMod.Items.Accessories player.Calamity().stealthGenMoving += 0.1f; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.BoosterDashHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); } } diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 30445b7dcc..3d14c9d991 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Items.Accessories player.GetCritChance() += 7; player.magicQuiver = true; CalamityPlayer modPlayer = player.Calamity(); - modPlayer.deadshotBrooch = true; + modPlayer.ammoCycleItem = Item; modPlayer.ammoCost *= 0.8f; } - public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override void AddRecipes() { diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index 3cc01929cb..d0d9b60bef 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories Item.expert = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpectralVeilHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/SpringStool.cs b/Items/Accessories/SpringStool.cs index b3c39d4ca4..9d9ac064f9 100644 --- a/Items/Accessories/SpringStool.cs +++ b/Items/Accessories/SpringStool.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Accessories public class SpringStool : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpringStoolJumpHotKey); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs((JumpCooldown).FramesToSeconds(), (CritRateBoostAboveTargets)); public static int JumpCooldown = CalamityUtils.SecondsToFrames(20); @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.GetModPlayer().springStool = true; + player.GetModPlayer().springStoolItem = Item; } public override void AddRecipes() @@ -48,7 +49,8 @@ namespace CalamityMod.Items.Accessories public class SpringStoolPlayer : ModPlayer { - public bool springStool = false; + public bool springStool { get => springStoolItem != null; } + public Item springStoolItem = null; public int springStoolTimer = 0; public bool hasGroundedSinceJump = true; @@ -73,7 +75,7 @@ namespace CalamityMod.Items.Accessories public override void PostUpdateEquips() { // Ensures the special jump initiates only works when unmounted, not grappled to a surface, and the ability is off cooldown - if (CalamityKeybinds.SpringStoolJumpHotKey.JustPressed && springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && !Player.mount.Active && hasGroundedSinceJump && !(Player.grappling[0] >= 0)) + if (springStool && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Stooldown.ID) && springStoolItem.JustPressedKeybind() && !Player.mount.Active && hasGroundedSinceJump && !(Player.grappling[0] >= 0)) { springStoolTimer = 12; @@ -214,13 +216,13 @@ namespace CalamityMod.Items.Accessories public override void ResetEffects() { - springStool = false; + springStoolItem = null; springStoolTimer = 0; } public override void UpdateDead() { - springStool = false; + springStoolItem = null; springStoolTimer = 0; hasGroundedSinceJump = true; } diff --git a/Items/Accessories/ThePointer.cs b/Items/Accessories/ThePointer.cs index cbf05e1b17..7d09678505 100644 --- a/Items/Accessories/ThePointer.cs +++ b/Items/Accessories/ThePointer.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -23,12 +24,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ThePointerLock); + public override void ModifyTooltips(List list) => list.IntegrateDynamicHotkey(Item); public override void UpdateAccessory(Player player, bool hideVisual) { LockOnHelper.ForceUsability = true; - if (CalamityKeybinds.ThePointerLock.JustPressed) + if (Item.JustPressedKeybind()) { LockOnHelper.Toggle(); if (LockOnHelper.AimedTarget != null) diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index fb3ba3f541..9491464ebb 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal"))); - list.IntegrateHotkey(CalamityKeybinds.TransformerHotKey); + list.IntegrateDynamicHotkey(Item); } public override void SetStaticDefaults() { diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index b139893fdb..1d7f6b5baf 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -1,19 +1,17 @@ -ActivateAccessoryParry.DisplayName: Activate Accessory Parry AdrenalineMode.DisplayName: Adrenaline Mode -AmmoCycle.DisplayName: Ammo Cycle Hotkey -AngelicAllianceBlessing.DisplayName: Angelic Alliance Blessing ArmorSetBonus.DisplayName: Armor Set Bonus -AscendantInsigniaHotKey.DisplayName: Ascendant Insignia Flight -BoosterDash.DisplayName: Booster Dash DashDoubleTapOverride.DisplayName: Dash Double Tap Override ExoChairSlowDown.DisplayName: Exo Chair Slow Down GodSlayerDash.DisplayName: Dimensional Drive -GravistarSabatonHotkey.DisplayName: Interstellar Stompers Slam NormalityRelocator.DisplayName: Normality Relocator RageMode.DisplayName: Rage Mode -SpectralVeilTeleport.DisplayName: Spectral Veil Teleport -TransformerHotKey.DisplayName: Transformer Hot Key GravitySwapOverride.DisplayName: Gravity Swap Override ExpandDebuffInfo.DisplayName: See Debuff Information -ThePointerLock.DisplayName: The Pointer Lock On -SpringStoolJumpHotKey.DisplayName: Spring Stool Jump Hotkey +HeldItem.DisplayName: Held Item Ability +Accessory1.DisplayName: Accessory Ability 1 +Accessory2.DisplayName: Accessory Ability 2 +Accessory3.DisplayName: Accessory Ability 3 +Accessory4.DisplayName: Accessory Ability 4 +Accessory5.DisplayName: Accessory Ability 5 +Accessory6.DisplayName: Accessory Ability 6 +Accessory7.DisplayName: Accessory Ability 7 diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 873189767c..a7c5075c8c 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -128,3 +128,4 @@ GFBRougeUppercase: Rouge GFBRogueLowercase: rogue GFBRougeLowercase: rouge HotkeyNotBound: "[None]" +HotkeyNotEquipped: an Accessory Ability hotkey diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs index 5abf9646f5..43d08c5de4 100644 --- a/Systems/Collections/CalamityItemSets.cs +++ b/Systems/Collections/CalamityItemSets.cs @@ -168,5 +168,10 @@ namespace CalamityMod.Systems.Collections .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + public static bool[] HasAccessoryKeybind = Factory.CreateNamedSet("HasAccessoryKeybind") + .Description("Counts this item as having an accessory keybind. Used to detect which keybind goes to which accessory") + .RegisterBoolSet(ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(),ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 848c00118a..d04a35ceae 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -109,6 +109,25 @@ namespace CalamityMod tooltips.FindAndReplace("[KEY]", finalKey); } + /// + /// Shortcut for automatically placing one keybind within a tooltip. Requires the "[KEY]" string to be replaced. + /// + /// The tooltip list provided to a ModifyTooltips TML hook. + /// The ModKeybind to integrate into the tooltip. + public static void IntegrateDynamicHotkey(this List tooltips, Item item) + { + if (Main.dedServ) + return; + + var mhk = item.GetDynamicModHotkey(); + + string finalKey = GetText("Misc.HotkeyNotEquipped").Value; + if (mhk is not null) + finalKey = mhk.TooltipHotkeyString(); + + tooltips.FindAndReplace("[KEY]", finalKey); + } + /// /// Shortcut method for adding "You have already consumed this item" tooltip /// From 4cafe9149a61d83c054add706673bc90c79a6b16 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 12:07:01 -0500 Subject: [PATCH 2/9] won't break with extra slot mods --- CalamityKeybinds.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index 56fd1f6497..a12d354a07 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -113,6 +113,8 @@ namespace CalamityMod if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) keybindToUse++; } + if (keybindToUse > 6) + return false; return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustPressed; } @@ -142,6 +144,8 @@ namespace CalamityMod keybindToUse++; } + if (keybindToUse > 6) + return false; return CalamityKeybinds.AccessoryKeybinds[keybindToUse].JustReleased; } @@ -170,6 +174,8 @@ namespace CalamityMod if (CalamityItemSets.HasAccessoryKeybind[Main.LocalPlayer.armor[i].type]) keybindToUse++; } + if (keybindToUse > 6) + return false; return CalamityKeybinds.AccessoryKeybinds[keybindToUse].Current; } @@ -201,6 +207,9 @@ namespace CalamityMod keybindToUse++; } + if (keybindToUse > 6) + return null; + return CalamityKeybinds.AccessoryKeybinds[keybindToUse]; } } From cb14075d779f100957db908d02dd692e8bbc20b4 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 12:49:25 -0500 Subject: [PATCH 3/9] Dash Hotkey + Hotkey Tooltips now support controller --- ILEditing/MechanicILChanges.cs | 2 +- Utilities/ItemUtils.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index f7466891f6..754ead76f4 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -251,7 +251,7 @@ namespace CalamityMod.ILEditing return; } - if (CalamityKeybinds.DashHotkey.GetAssignedKeysOrEmpty().Count == 0) + if (CalamityKeybinds.DashHotkey.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count == 0) orig(self, out dir, out dashing, dashStartAction); else { diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index d04a35ceae..de041faf9f 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -12,6 +12,7 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Systems.Collections; +using Terraria.GameInput; namespace CalamityMod { @@ -54,7 +55,7 @@ namespace CalamityMod if (Main.dedServ || mhk is null) return ""; - List keys = mhk.GetAssignedKeysOrEmpty(); + List keys = mhk.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode); if (keys.Count == 0) return GetText("Misc.HotkeyNotBound").Value; else From 3542a6194f3db46780a1ca7ab128bd43f8c05e8f Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 13:24:40 -0500 Subject: [PATCH 4/9] small fixes + new util --- CalamityKeybinds.cs | 11 +++++++++++ Utilities/MiscUtils.cs | 2 ++ 2 files changed, 13 insertions(+) diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index a12d354a07..7e5079007d 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -1,7 +1,9 @@ using System; using System.Linq; using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameInput; using Terraria.ModLoader; namespace CalamityMod @@ -212,5 +214,14 @@ namespace CalamityMod return CalamityKeybinds.AccessoryKeybinds[keybindToUse]; } + + public static bool HasBoundDynamicHotkey(this Item item) + { + var h = item.GetDynamicModHotkey(); + if (h == null) return false; + if (h?.GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count() == 0) + return false; + return true; + } } } diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index d1eab75448..40cebbd5b7 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -314,6 +314,8 @@ namespace CalamityMod try { + if (mode == InputMode.Mouse) + mode = InputMode.Keyboard; return keybind.GetAssignedKeys(mode); } catch From 4b1c9da13bac9efb80b7e979f3527366302f90e7 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 14:02:44 -0500 Subject: [PATCH 5/9] Big Rip now can use Held Item keybind when bound instead of double-click --- Items/Weapons/Melee/ArkoftheCosmos.cs | 29 ++++++++++++++++++- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index c119913376..d7936458ea 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -10,6 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameInput; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -68,9 +69,14 @@ namespace CalamityMod.Items.Weapons.Melee var blastTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[BLAST]") && x.Mod == "Terraria"); if (blastTooltip != null) { - blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); + var key = Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode); + if (key.Count > 0) + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfoKeybind")); + else + blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); blastTooltip.OverrideColor = Color.Lerp(Color.HotPink, Color.Crimson, 0.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.625f); } + tooltips.IntegrateDynamicHotkey(Item); } public override void SetDefaults() @@ -108,6 +114,25 @@ namespace CalamityMod.Items.Weapons.Melee if (Combo == 4) Item.channel = true; + + if (Main.myPlayer == player.whoAmI && Item.CurrentlyPressingKeybind() && Charge > 0) + { + Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); + + if (blast == null) + { + float speed = Item.shootSpeed; + int dmg = (int)player.GetTotalDamage(Item.DamageType).ApplyTo(Item.damage); + Vector2 pos = player.Center; + int shoot = Item.shoot; + float kb = Item.knockBack; + var velocity = player.DirectionTo(Main.MouseWorld) * Item.shootSpeed; + PlayerLoader.ModifyShootStats(player, Item, ref pos, ref velocity, ref shoot, ref dmg, ref kb); + float angle = velocity.ToRotation(); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(dmg * BlastDamageMultiplier), 0, player.whoAmI, Charge); + Charge = 0; + } + } } public override bool CanUseItem(Player player) @@ -124,6 +149,8 @@ namespace CalamityMod.Items.Weapons.Melee { // If it has been less than N frames since the last alt function use, this is a double right click. bool rightMouseDoubleClick = rmbFrames > 0; + if (Item.HasBoundDynamicHotkey()) + rightMouseDoubleClick = Item.CurrentlyPressingKeybind(); // Check if a parry holdout or blast is already present. Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 43d0904593..238de17fde 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -87,6 +87,7 @@ ArkoftheCosmos: { Parrying will empower the next 16 swings of the sword ''' BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfoKeybind: Press [KEY] with charges available to cause a Big Rip in spacetime and consume all charges } ArkoftheElements: { From 2ec489b2c3e5d273c00fe57622bb1f65fc28a253 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Wed, 1 Jul 2026 16:07:14 -0500 Subject: [PATCH 6/9] Halley's Inferno Scope Keybind Halley's can press Held Item Ability to toggle on/off a stronger Sniper Scope effect Also some rebalancing. Starbursts fire faster with slightly lower damage, cost less per shot, travel faster, and restore less on successful hit. --- CalPlayer/CalamityPlayer.cs | 15 +++++++++++++++ Items/Weapons/Ranged/HalleysInferno.cs | 11 +++++++---- .../Mods.CalamityMod.Items.Weapons.Ranged.hjson | 1 + Projectiles/Ranged/HalleysInfernoHoldout.cs | 8 ++++---- Projectiles/Ranged/HalleysStarburst.cs | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c6bb3f1b97..500e1b659d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2978,6 +2978,9 @@ namespace CalamityMod.CalPlayer #endregion #region Screen Position Movements + + float HalleyScopeLerp = 0; + bool HalleyToggle = false; public override void ModifyScreenPosition() { // CIT 08FEB2025: Photosensitivity config also disables screenshake @@ -2987,6 +2990,18 @@ namespace CalamityMod.CalPlayer Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); + + if (Player.HeldItem.type != ModContent.ItemType()) + HalleyToggle = false; + else if (Player.HeldItem.JustPressedKeybind()) + HalleyToggle = !HalleyToggle; + + HalleyScopeLerp = MathHelper.Clamp(HalleyScopeLerp + (HalleyToggle ? 0.05f : -0.05f), 0, 1); + if (HalleyScopeLerp > 0) + { + Vector2 center = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + Main.screenPosition -= (center - Main.MouseWorld) / Main.GameZoomTarget * 0.66f * MathHelper.SmoothStep(0,1,HalleyScopeLerp); + } } #endregion diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index 791aaa307d..baf7cbfcfe 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; @@ -20,13 +21,13 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/HalleysInfernoShoot") { Volume = 0.68f }; public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/HalleysInfernoHit") { Volume = 0.75f }; public static float MaxStarburstPerComet => 1; - public static float MaxStarburstPerStar => 0.5f; + public static float MaxStarburstPerStar => 0.25f; public static float LostAccuracyPerMiss => 4; public static float MaxAccuracy => 50; - public static float StarburstDmgMult => 2.5f; + public static float StarburstDmgMult => 2f; - public static float StarburstVelMult => 0.75f; + public static float StarburstVelMult => 1f; public override void SetDefaults() { Item.width = 84; @@ -59,6 +60,8 @@ namespace CalamityMod.Items.Weapons.Ranged ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); + public override void HoldItem(Player player) { if (player.mount.Type == MountID.Drill) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 6239730850..a90286b15b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -547,6 +547,7 @@ HalleysInferno: { Fires a burst of intensely concentrated lunar fire jets to rapid-fire Starbursts that inflict [cbuff:CalamityMod/Voidfrost] Generates Starbursts when hitting enemies, depending on your accuracy + Press [KEY] to toggle long-range scope mode Uses gel for ammo 'Halley arrived sooner than expected' ''' diff --git a/Projectiles/Ranged/HalleysInfernoHoldout.cs b/Projectiles/Ranged/HalleysInfernoHoldout.cs index 9d09b629f1..c76f38e264 100644 --- a/Projectiles/Ranged/HalleysInfernoHoldout.cs +++ b/Projectiles/Ranged/HalleysInfernoHoldout.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged { if (ShotTimer <= 0 && Owner.Calamity().AvaliableStarburst > 1) { - ShotTimer = 4; + ShotTimer = 3; var spawnpos = Projectile.Center; var dir = spawnpos.DirectionTo(Main.MouseWorld); var color = Main.rand.Next(1, 7); @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Ranged for (var i = 0; i < 5; i++) GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(spawnpos + dir * 36, (dir * Halley.shootSpeed).RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f, 1.5f), false, 7, 0.02f, drawColor, new Vector2(0.5f, 1f))); if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 16,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); - Owner.Calamity().StratusStarburst -= 2; + Projectile.NewProjectile(Owner.GetSource_ItemUse_WithPotentialAmmo(Halley, AmmoID.Gel), spawnpos + dir * 8 + dir.RotatedByRandom(MathHelper.TwoPi)*4,dir * Halley.shootSpeed * HalleysInferno.StarburstVelMult, ModContent.ProjectileType(), (int)(Owner.GetDamage(DamageClass.Ranged).ApplyTo(Halley.damage) * HalleysInferno.StarburstDmgMult), Halley.knockBack, Projectile.owner, color); + Owner.Calamity().StratusStarburst -= 1; SoundEngine.PlaySound(HalleysInferno.ShootSound); - RecoilAmount = 4; + RecoilAmount = 16; } } RecoilAmount *= 0.75f; diff --git a/Projectiles/Ranged/HalleysStarburst.cs b/Projectiles/Ranged/HalleysStarburst.cs index 41e48151e3..afde077a30 100644 --- a/Projectiles/Ranged/HalleysStarburst.cs +++ b/Projectiles/Ranged/HalleysStarburst.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; - Projectile.MaxUpdates = 6; + Projectile.MaxUpdates = 9; Projectile.timeLeft = 60 * Projectile.MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; From 1c1449e75a963d1e64639899fa8d0352b153f21d Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 16 Jul 2026 18:28:44 -0500 Subject: [PATCH 7/9] Vanguard, Exaltation, VEM Shift-Right-Click -> Hotkey --- Items/Weapons/Summon/IgneousExaltation.cs | 23 +++++++-------- Items/Weapons/Summon/ViridVanguard.cs | 23 +++++++-------- Items/Weapons/Summon/VoidEaterMarionette.cs | 29 +++++++++++-------- ...ods.CalamityMod.Items.Weapons.Summon.hjson | 8 +++-- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 3b829ede05..eedd2bb6f4 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -61,20 +62,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); - } - - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 9cd7b0a4d1..a1d77569ae 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.Summon; +using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; @@ -92,21 +93,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } - - public override bool CanRightClick() + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; - if (Main.netMode != NetmodeID.SinglePlayer) - ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + if (Main.myPlayer == player.whoAmI && Item.JustPressedKeybind()) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { diff --git a/Items/Weapons/Summon/VoidEaterMarionette.cs b/Items/Weapons/Summon/VoidEaterMarionette.cs index f74c703f3c..4f82049c2c 100644 --- a/Items/Weapons/Summon/VoidEaterMarionette.cs +++ b/Items/Weapons/Summon/VoidEaterMarionette.cs @@ -1,6 +1,8 @@ -using System.Linq; +using System.Collections.Generic; +using System.Linq; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Systems.Collections; @@ -41,22 +43,25 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.shootSpeed = 8; } - public override bool CanRightClick() + + public override void HoldItem(Player player) { - if (!Main.keyState.PressingShift()) - return false; - return true; - } - public override void RightClick(Player player) - { - if (player.ownedProjectileCounts[Item.shoot] > 0) + if (Main.myPlayer == player.whoAmI && player.ownedProjectileCounts[Item.shoot] > 0) { var p = Main.projectile.First(x => x.active && x.type == Item.shoot && x.owner == player.whoAmI); - p.ModProjectile().FocusOnFetching = !p.ModProjectile().FocusOnFetching; - p.netUpdate = true; + if (p.ModProjectile is VoidEaterMarionetteProjectile vem) + { + + vem.FocusOnFetching = !vem.FocusOnFetching; + p.netUpdate = true; + if (vem.FocusOnFetching) + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchStart"),true); + else + CombatText.NewText(player.Hitbox, Color.White, this.GetLocalizedValue("FetchEnd"), true); + } } } - public override bool ConsumeItem(Player player) => false; + public override void ModifyTooltips(List tooltips) => tooltips.IntegrateDynamicHotkey(Item); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.ownedProjectileCounts[type] > 0) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index ed0fa8eb78..6fcc05116f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -496,7 +496,7 @@ IgneousExaltation: { Summons an Igneous blade that orbits around you When your minion slots are full, again to launch all blades towards the cursor This ability has a two-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press {0} while holding this item to change the rotation direction ''' } @@ -856,7 +856,7 @@ ViridVanguard: { All weapons inflict [cbuff:CalamityMod/SagePoison], which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item - Shift- this item in your inventory to change the rotation direction + Press {0} while holding this item to change the rotation direction ''' } @@ -880,8 +880,10 @@ VoidEaterMarionette: { Repeated summons increase the length and power of the Devourer The Devourer attacks with [ceffect/dog:Divinity Devourer], [ceffect/dog:Faith Incinerator] and [ceffect/dog:Ultracosmic Maelstrom] Can play fetch with dropped items - Shift- this item in your inventory when the Devourer has been spawned to prioritize fetching + Press {0} while holding this item when the Devourer has been spawned to prioritize fetching ''' + FetchStart: Go fetch! + FetchEnd: Get 'em! } WarloksMoonFist: { From 32187dfe5fe0e8f2fc9a824983c639571df1959c Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 16 Jul 2026 18:38:23 -0500 Subject: [PATCH 8/9] Ark double-click removed If keybind is unbound, the first right-click with charges does Big Rip If keybind is bound, keybind does big rip and right click can ONLY parry --- Items/Weapons/Melee/ArkoftheCosmos.cs | 27 +++---------------- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 +- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index d7936458ea..528419da7f 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -23,11 +23,6 @@ namespace CalamityMod.Items.Weapons.Melee public float Combo = 0f; public float Charge = 0f; - // Frame window for double right click to snip. - // The right click item activation takes 3 frames, so the frame window is frame 3 to frame 11. - public static int DoubleRightClickFrames = 11; - private int rmbFrames = 0; - public static float NeedleDamageMultiplier = 0.7f; //Damage on the non-homing needle projectile public static float MaxThrowReach = 760; public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap @@ -106,9 +101,6 @@ namespace CalamityMod.Items.Weapons.Melee { player.Calamity().mouseWorldListener = true; - if (rmbFrames > 0) - --rmbFrames; - if (CanUseItem(player) && Combo != 4) Item.channel = false; @@ -147,17 +139,16 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - // If it has been less than N frames since the last alt function use, this is a double right click. - bool rightMouseDoubleClick = rmbFrames > 0; - if (Item.HasBoundDynamicHotkey()) - rightMouseDoubleClick = Item.CurrentlyPressingKeybind(); // Check if a parry holdout or blast is already present. Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); Projectile blast = Main.projectile.FirstOrDefault(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType(), null); - bool canExecuteBlast = rightMouseDoubleClick && Charge > 0 && blast is null; + bool canExecuteBlast = Charge > 0 && blast is null; bool canExecuteParry = parrier is null && !canExecuteBlast; + //Disable blast usage if hotkey is bound + if (Item.GetDynamicModHotkey().GetAssignedKeysOrEmpty(PlayerInput.CurrentInputMode).Count > 0) + canExecuteBlast = false; // The blast is checked first, so that it overrides the first right click triggering a parry. Blasts delete any active parry holdouts on use. if (canExecuteBlast) @@ -166,13 +157,6 @@ namespace CalamityMod.Items.Weapons.Melee float angle = velocity.ToRotation(); Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * BlastDamageMultiplier), 0, player.whoAmI, Charge); Charge = 0; - - // If the parry holdout has existed for very few frames, just delete it. - if (parrier is not null && parrier.timeLeft > ArkoftheCosmosParryHoldout.MaxTime - DoubleRightClickFrames) - { - parrier.active = false; - parrier.netUpdate = true; - } } // If the blast cannot be executed, then the parry is executed, assuming no existing holdout is present. @@ -189,9 +173,6 @@ namespace CalamityMod.Items.Weapons.Melee if (!anyArkParryExists) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); } - - // Regardless of what transpires from the right click, set the double right click frames appropriately. - rmbFrames = DoubleRightClickFrames; return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 238de17fde..4157a33935 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -86,7 +86,7 @@ ArkoftheCosmos: { You can also parry projectiles to make them deal 120 less damage for a short period Parrying will empower the next 16 swings of the sword ''' - BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges + BlastInfo: with charges available to cause a Big Rip in spacetime and consume all charges BlastInfoKeybind: Press [KEY] with charges available to cause a Big Rip in spacetime and consume all charges } From b13750ff9770c0df6d2a59021512e8a52db93899 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 20 Jul 2026 19:37:36 -0500 Subject: [PATCH 9/9] fixes --- CalPlayer/CalamityPlayer.cs | 5 +++-- Items/Weapons/Summon/VoidEaterMarionette.cs | 2 +- .../en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 500e1b659d..1753a94b89 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2999,8 +2999,9 @@ namespace CalamityMod.CalPlayer HalleyScopeLerp = MathHelper.Clamp(HalleyScopeLerp + (HalleyToggle ? 0.05f : -0.05f), 0, 1); if (HalleyScopeLerp > 0) { - Vector2 center = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; - Main.screenPosition -= (center - Main.MouseWorld) / Main.GameZoomTarget * 0.66f * MathHelper.SmoothStep(0,1,HalleyScopeLerp); + var screenSize = new Vector2(Main.screenWidth, Main.screenHeight); + Vector2 center = Main.screenPosition + screenSize * 0.5f; + Main.screenPosition -= (Vector2.Clamp((center - Main.MouseWorld) / screenSize, new(-0.5f), new(0.5f)) / Main.GameZoomTarget * MathHelper.SmoothStep(0, 1, HalleyScopeLerp)) * new Vector2(1920, 1200) * 0.9f; } } #endregion diff --git a/Items/Weapons/Summon/VoidEaterMarionette.cs b/Items/Weapons/Summon/VoidEaterMarionette.cs index 4f82049c2c..e3266817a6 100644 --- a/Items/Weapons/Summon/VoidEaterMarionette.cs +++ b/Items/Weapons/Summon/VoidEaterMarionette.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void HoldItem(Player player) { - if (Main.myPlayer == player.whoAmI && player.ownedProjectileCounts[Item.shoot] > 0) + if (Main.myPlayer == player.whoAmI && player.ownedProjectileCounts[Item.shoot] > 0 && Item.JustPressedKeybind()) { var p = Main.projectile.First(x => x.active && x.type == Item.shoot && x.owner == player.whoAmI); if (p.ModProjectile is VoidEaterMarionetteProjectile vem) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index 6fcc05116f..f49d100b63 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -496,7 +496,7 @@ IgneousExaltation: { Summons an Igneous blade that orbits around you When your minion slots are full, again to launch all blades towards the cursor This ability has a two-second cooldown that requires holding this item - Press {0} while holding this item to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -856,7 +856,7 @@ ViridVanguard: { All weapons inflict [cbuff:CalamityMod/SagePoison], which becomes more powerful the more weapons are summoned When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor This ability has a five-second cooldown that requires holding this item - Press {0} while holding this item to change the rotation direction + Press [KEY] while holding this item to change the rotation direction ''' } @@ -880,10 +880,10 @@ VoidEaterMarionette: { Repeated summons increase the length and power of the Devourer The Devourer attacks with [ceffect/dog:Divinity Devourer], [ceffect/dog:Faith Incinerator] and [ceffect/dog:Ultracosmic Maelstrom] Can play fetch with dropped items - Press {0} while holding this item when the Devourer has been spawned to prioritize fetching + Press [KEY] while holding this item when the Devourer has been spawned to prioritize fetching ''' - FetchStart: Go fetch! - FetchEnd: Get 'em! + FetchStart: Go fetch! + FetchEnd: Get 'em! } WarloksMoonFist: {