diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index c9cac9c1..9f634f45 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -46,6 +46,12 @@ internal class InputHelper : BaseHelper, IInputHelper return this.CurrentInputState().IsSuppressed(button); } + /// + public void Press(SButton button) + { + this.CurrentInputState().OverrideButton(button, setDown: true); + } + /// public void Suppress(SButton button) { @@ -85,10 +91,4 @@ internal class InputHelper : BaseHelper, IInputHelper { return this.CurrentInputState().GetState(button); } - - /// - public void OverrideButton(SButton button, bool setDown) - { - this.CurrentInputState().OverrideButton(button, setDown); - } } diff --git a/src/SMAPI/IInputHelper.cs b/src/SMAPI/IInputHelper.cs index dbcf1350..fdcd383f 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. @@ -30,9 +44,4 @@ public interface IInputHelper : IModLinked /// Get the state of a button. /// The button to check. SButtonState GetState(SButton button); - - /// Override the state of a button. - /// The button to override. - /// A new button state. - void OverrideButton(SButton button, bool setDown); }