Merge pull request #996 from martiandweller/ExposeInputOverride-clean

Add input API method to press a button
This commit is contained in:
Jesse Plamondon-Willard
2025-12-28 19:04:44 -05:00
committed by GitHub
2 changed files with 20 additions and 0 deletions
@@ -46,6 +46,12 @@ internal class InputHelper : BaseHelper, IInputHelper
return this.CurrentInputState().IsSuppressed(button);
}
/// <inheritdoc />
public void Press(SButton button)
{
this.CurrentInputState().OverrideButton(button, setDown: true);
}
/// <inheritdoc />
public void Suppress(SButton button)
{
+14
View File
@@ -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>