replace OverrideButton with Press to match existing API, expand docs

This commit is contained in:
Jesse Plamondon-Willard
2025-12-28 12:20:58 -05:00
parent 2ee9a7ba4e
commit 5acfa91438
2 changed files with 20 additions and 11 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)
{
@@ -85,10 +91,4 @@ internal class InputHelper : BaseHelper, IInputHelper
{
return this.CurrentInputState().GetState(button);
}
/// <inheritdoc />
public void OverrideButton(SButton button, bool setDown)
{
this.CurrentInputState().OverrideButton(button, setDown);
}
}
+14 -5
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>
@@ -30,9 +44,4 @@ public interface IInputHelper : IModLinked
/// <summary>Get the state of a button.</summary>
/// <param name="button">The button to check.</param>
SButtonState GetState(SButton button);
/// <summary>Override the state of a button.</summary>
/// <param name="button">The button to override.</param>
/// <param name="setDown">A new button state.</param>
void OverrideButton(SButton button, bool setDown);
}