summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI/Framework/ModHelpers/InputHelper.cs14
-rw-r--r--src/SMAPI/IInputHelper.cs6
2 files changed, 20 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);
diff --git a/src/SMAPI/IInputHelper.cs b/src/SMAPI/IInputHelper.cs
index e9768c24..2b907b0d 100644
--- a/src/SMAPI/IInputHelper.cs
+++ b/src/SMAPI/IInputHelper.cs
@@ -1,3 +1,5 @@
+using StardewModdingAPI.Utilities;
+
namespace StardewModdingAPI
{
/// <summary>Provides an API for checking and changing input state.</summary>
@@ -18,6 +20,10 @@ namespace StardewModdingAPI
/// <param name="button">The button to suppress.</param>
void Suppress(SButton button);
+ /// <summary>Suppress the keybinds which are currently down.</summary>
+ /// <param name="keybindList">The keybind list whose active keybinds to suppress.</param>
+ void SuppressActiveKeybinds(KeybindList keybindList);
+
/// <summary>Get the state of a button.</summary>
/// <param name="button">The button to check.</param>
SButtonState GetState(SButton button);