diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 6b3749fdfb..c0529a346c 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -116,11 +116,11 @@ namespace CalamityMod.CalPlayer { VerticalGodslayerDashTimer++; if (VerticalGodslayerDashTimer >= 25) - { + { Player.dashDelay = dashDelayToApply; - // Stop the player from going flying - Player.velocity *= 0.2f; - } + // Stop the player from going flying + Player.velocity *= 0.2f; + } } if (HasCustomDash) @@ -205,11 +205,20 @@ namespace CalamityMod.CalPlayer { direction = DashDirection.Directionless; bool justDashed = false; - bool pressedManualHotkey = CalamityKeybinds.DashHotkey.JustPressed; - bool left = (Player.controlRight && Player.releaseRight && !CalamityKeybinds.DashHotkey.HasValidBinding()) || (pressedManualHotkey && Player.direction == 1); - bool right = (Player.controlLeft && Player.releaseLeft && !CalamityKeybinds.DashHotkey.HasValidBinding()) || (pressedManualHotkey && Player.direction == -1); - if (left) + // If the manual hotkey is bound, standard Terraria dashes cannot be triggered by double tapping. + bool manualHotkeyBound = CalamityKeybinds.DashHotkey.GetAssignedKeys().Count > 0; + bool pressedManualHotkey = CalamityKeybinds.DashHotkey.JustPressed; + + bool vanillaRightDashInput = Player.controlRight && Player.releaseRight && !manualHotkeyBound; + bool manualRightDashInput = pressedManualHotkey && Player.direction == 1; + bool executeRightDash = vanillaRightDashInput || manualRightDashInput; + + bool vanillaLeftDashInput = Player.controlLeft && Player.releaseLeft && !manualHotkeyBound; + bool manualLeftDashInput = pressedManualHotkey && Player.direction == -1; + bool executeLeftDash = vanillaLeftDashInput || manualLeftDashInput; + + if (executeRightDash) { if (dashTimeMod > 0 || pressedManualHotkey) { @@ -220,7 +229,7 @@ namespace CalamityMod.CalPlayer else dashTimeMod = 15; } - else if (right) + else if (executeLeftDash) { if (dashTimeMod < 0 || pressedManualHotkey) { diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 855a158c45..fe94af5494 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -268,7 +268,7 @@ namespace CalamityMod.ILEditing return; } - if (!CalamityKeybinds.DashHotkey.HasValidBinding()) + if (CalamityKeybinds.DashHotkey.GetAssignedKeys().Count == 0) orig(self, out dir, out dashing, dashStartAction); else { diff --git a/Utilities/InputUtils.cs b/Utilities/InputUtils.cs deleted file mode 100644 index abd75f33fb..0000000000 --- a/Utilities/InputUtils.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using Terraria.GameInput; -using Terraria.ModLoader; - -namespace CalamityMod -{ - public static partial class CalamityUtils - { - internal static readonly FieldInfo KeybindName = typeof(ModKeybind).GetField("uniqueName", BindingFlags.Instance | BindingFlags.NonPublic); - - public static bool HasValidBinding(this ModKeybind key) - { - // Copypasted stuff from vanilla. This should not be as complicated as it is. - static string genInput(List list) - { - if (list.Count == 0) - return ""; - - string text = list[0]; - for (int j = 1; j < list.Count; j++) - text = text + "/" + list[j]; - return text; - } - - List list = PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus[(string)KeybindName.GetValue(key)]; - string text = genInput(list); - return !string.IsNullOrEmpty(text); - } - } -}