diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-19 23:50:46 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-19 23:50:46 -0500 |
commit | e40483aab1f6dbcb89f3a1fd1639fc732fe987fc (patch) | |
tree | 4c9cb86e9fba7216fbb50eae6052154845ce5215 /src/SMAPI/Framework/ModHelpers | |
parent | f251f0d06c2942b53dfd69bb79bf12b16a227503 (diff) | |
download | SMAPI-e40483aab1f6dbcb89f3a1fd1639fc732fe987fc.tar.gz SMAPI-e40483aab1f6dbcb89f3a1fd1639fc732fe987fc.tar.bz2 SMAPI-e40483aab1f6dbcb89f3a1fd1639fc732fe987fc.zip |
add method to suppress active keybindings (#744)
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/InputHelper.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index e1317544..88caf4c3 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -1,5 +1,6 @@ using System; using StardewModdingAPI.Framework.Input; +using StardewModdingAPI.Utilities; namespace StardewModdingAPI.Framework.ModHelpers { @@ -50,6 +51,19 @@ namespace StardewModdingAPI.Framework.ModHelpers } /// <inheritdoc /> + public void SuppressActiveKeybinds(KeybindList keybindList) + { + foreach (Keybind keybind in keybindList.Keybinds) + { + if (!keybind.GetState().IsDown()) + continue; + + foreach (SButton button in keybind.Buttons) + this.Suppress(button); + } + } + + /// <inheritdoc /> public SButtonState GetState(SButton button) { return this.CurrentInputState().GetState(button); |