diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index 8713cc483..9f634f458 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -46,6 +46,12 @@ public bool IsSuppressed(SButton button) return this.CurrentInputState().IsSuppressed(button); } + /// + public void Press(SButton button) + { + this.CurrentInputState().OverrideButton(button, setDown: true); + } + /// public void Suppress(SButton button) { diff --git a/src/SMAPI/IInputHelper.cs b/src/SMAPI/IInputHelper.cs index 053c371e4..fdcd383fa 100644 --- a/src/SMAPI/IInputHelper.cs +++ b/src/SMAPI/IInputHelper.cs @@ -16,8 +16,22 @@ public interface IInputHelper : IModLinked /// The button. bool IsSuppressed(SButton button); + /// Mark a button as pressed. + /// The button to press. + /// + /// For both mods and the base game, this is equivalent to the button being physically pressed by the player. It will be released on the next input tick by default; it can be pressed again each tick to hold it down. + /// + /// See for the inverse. + /// + void Press(SButton button); + /// Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event. /// The button to suppress. + /// + /// If the button is being held, it'll remain suppressed until the player releases it or until is called for the same button. + /// + /// See for the inverse. + /// void Suppress(SButton button); /// Suppress the immediate change to a scroll wheel value.