Skip to content

Setting Up Mod Controls API - #93

Merged
jasminegamedev merged 4 commits into
devfrom
setup-controls-api
Jun 25, 2024
Merged

jasminegamedev merged 4 commits into
devfrom
setup-controls-api

Conversation

@jasminegamedev

@jasminegamedev jasminegamedev commented Jun 24, 2024

Copy link
Copy Markdown
Collaborator

This PR adds a new way for mods to create their own virtual buttons and sticks, and add their own default bindings for them. It also reworks how default bindings work in general for more flexibility, and better mod support.

Now, to add virtual buttons, modders just have to add something like this to their mod settings file:

[DefaultBinding(Keys.LeftControl)]
[DefaultBinding(Axes.LeftTrigger, 0.4f, false)]
[SettingName("Crouch")]
public VirtualButton CrouchButton { get; set; } = new VirtualButton("Crouch");

[DefaultStickBinding(StickDirection.Up, Keys.W)]
[DefaultStickBinding(StickDirection.Up, Axes.RightY, 0.0f, true)]
[DefaultStickBinding(StickDirection.Down, Keys.S)]
[DefaultStickBinding(StickDirection.Down, Axes.RightY, 0.0f, false)]
[DefaultStickBinding(StickDirection.Left, Keys.S)]
[DefaultStickBinding(StickDirection.Left, Axes.RightX, 0.0f, true)]
[DefaultStickBinding(StickDirection.Right, Keys.D)]
[DefaultStickBinding(StickDirection.Right, Axes.RightX, 0.0f, false)]
[SettingName("Dash")]
public VirtualStick Dash { get; set; } = new VirtualStick("Dash", VirtualAxis.Overlaps.TakeNewer, 0.35f);

They can add as many default bindings as they want, and support either keyboard or controller.

This PR also makes a new Mod Controller binding menu, which is very similar to the normal controls binding menu. This menu can be found as part of the Mod Settings page for the mod, and players can set separately for keyboard and controller.

This change adds a new menu where players can rebind custom controls from mods. Modders can set up these controls as part of the mod settings object.
@jasminegamedev jasminegamedev self-assigned this Jun 24, 2024
@jasminegamedev jasminegamedev added this to the 0.7.0 blockers milestone Jun 24, 2024
@jasminegamedev
jasminegamedev merged commit 627d743 into dev Jun 25, 2024
@jasminegamedev
jasminegamedev deleted the setup-controls-api branch June 25, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant