Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/SMAPI/Framework/ModHelpers/InputHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public bool IsSuppressed(SButton button)
return this.CurrentInputState().IsSuppressed(button);
}

/// <inheritdoc />
public void Press(SButton button)
{
this.CurrentInputState().OverrideButton(button, setDown: true);
}

/// <inheritdoc />
public void Suppress(SButton button)
{
Expand Down
14 changes: 14 additions & 0 deletions src/SMAPI/IInputHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ public interface IInputHelper : IModLinked
/// <param name="button">The button.</param>
bool IsSuppressed(SButton button);

/// <summary>Mark a button as pressed.</summary>
/// <param name="button">The button to press.</param>
/// <remarks>
/// <para>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.</para>
///
/// <para>See <see cref="Suppress"/> for the inverse.</para>
/// </remarks>
void Press(SButton button);

/// <summary>Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event.</summary>
/// <param name="button">The button to suppress.</param>
/// <remarks>
/// <para>If the button is being held, it'll remain suppressed until the player releases it or until <see cref="Press"/> is called for the same button.</para>
///
/// <para>See <see cref="Press"/> for the inverse.</para>
/// </remarks>
void Suppress(SButton button);

/// <summary>Suppress the immediate change to a scroll wheel value.</summary>
Expand Down