fix(input): abilities no longer die while a movement key is held

BepInEx's KeyboardShortcut.IsDown() ends in ModifierKeyTest, which
requires that no key outside the shortcut is currently held - it only
exempts the mouse buttons. That is right for a config-menu hotkey and
wrong for a game ability: holding W (or any other movement key) made
every bound ability in the mod stop responding, for every race, mouse
bindings included. Vanilla attacks kept working because they go
through ZInput, which is what made it look like a Skadi/dragon bug.

Adds RaceInput.IsDownIgnoringHeldKeys / IsPressedIgnoringHeldKeys -
main key down plus every modifier held, without the blocking rule -
and switches all 27 call sites across Aswid, Dvergar, Fenrir, Skadi,
Trenta and Trol over to them.

Arrived with the rebindable-keybind work that shipped in 1.4.0.
This commit is contained in:
kanym 2026-08-09 12:33:41 +02:00
commit 25795a05e9
9 changed files with 62 additions and 22 deletions

View file

@ -244,9 +244,9 @@ namespace RacesOfValheim
if (!RaceInput.Allowed) return;
int state = BossProgressionManager.GetCurrentProgressionState();
if (SkadiConfig.DrakeFormKey.Value.IsDown()) { TryTransformWithRules(SkadiProgression.GetGKeyRules(state)); return; }
if (SkadiConfig.ModerFormKey.Value.IsDown()) { TryTransformWithRules(SkadiProgression.GetHKeyRules(state)); return; }
if (SkadiConfig.FaderFormKey.Value.IsDown()) { TryTransformWithRules(SkadiProgression.GetJKeyRules(state)); return; }
if (SkadiConfig.DrakeFormKey.Value.IsDownIgnoringHeldKeys()) { TryTransformWithRules(SkadiProgression.GetGKeyRules(state)); return; }
if (SkadiConfig.ModerFormKey.Value.IsDownIgnoringHeldKeys()) { TryTransformWithRules(SkadiProgression.GetHKeyRules(state)); return; }
if (SkadiConfig.FaderFormKey.Value.IsDownIgnoringHeldKeys()) { TryTransformWithRules(SkadiProgression.GetJKeyRules(state)); return; }
// Debug Dump
if (Input.GetKeyDown(KeyCode.F8))
@ -336,7 +336,7 @@ namespace RacesOfValheim
if (isTransformed) return; // Do not cast human spell while in dragon form
// Middle Mouse Button to cast, by default - rebindable via SkadiConfig.ColdSpellKey.
if (SkadiConfig.ColdSpellKey.Value.IsDown())
if (SkadiConfig.ColdSpellKey.Value.IsDownIgnoringHeldKeys())
{
// The improved cast is a burst rather than a rapid-fire, so it waits longer.
float cooldown = rules.ImprovedColdSpell ? IMPROVED_SPELL_COOLDOWN : SPELL_COOLDOWN;