summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Events/EventArgsInput.cs6
2 files changed, 7 insertions, 0 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 16ed9af5..02e75f3d 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,6 +1,7 @@
# Release notes
## 2.3
* For modders:
+ * Added `IsSuppressed` to input events so mods can optionally avoid handling a key another mod already handled.
* Fixed error when using the reflection API accesses with a property with either `get` and `set` missing.
* Fixed issue where a mod could change the cursor position reported to other mods.
diff --git a/src/SMAPI/Events/EventArgsInput.cs b/src/SMAPI/Events/EventArgsInput.cs
index ee15fd27..a5325b76 100644
--- a/src/SMAPI/Events/EventArgsInput.cs
+++ b/src/SMAPI/Events/EventArgsInput.cs
@@ -28,6 +28,9 @@ namespace StardewModdingAPI.Events
/// <summary>Whether the input should use tools on the affected tile.</summary>
public bool IsUseToolButton { get; }
+ /// <summary>Whether a mod has indicated the key was already handled.</summary>
+ public bool IsSuppressed { get; private set; }
+
/*********
** Public methods
@@ -55,6 +58,9 @@ namespace StardewModdingAPI.Events
/// <param name="button">The button to suppress.</param>
public void SuppressButton(SButton button)
{
+ if (button == this.Button)
+ this.IsSuppressed = true;
+
// keyboard
if (button.TryGetKeyboard(out Keys key))
Game1.oldKBState = new KeyboardState(Game1.oldKBState.GetPressedKeys().Union(new[] { key }).ToArray());