Valheim-Modding / Jotunn

Jötunn, the Valheim Library.
https://valheim-modding.github.io/Jotunn/
MIT License
123 stars 40 forks source link

[FEATURE] Configure custom key bindings via in-game settings #330

Closed joeyparrish closed 2 years ago

joeyparrish commented 2 years ago

User Story As a developer, I want to enable users to customize my mod's key bindings using the in-game settings menu so that they do not have to edit config files.

Envisioned Solution I'd like to be able to modify this dialog to include mod-specific key bindings: valheim-settings

Looking at the decompiled source of Valheim, it doesn't look especially easy. :-/

The Settings class has a list called m_keys, but each item has a hard-coded RectTransform with a button. I would guess that those might need to be moved and/or the dialog expanded to make room for any new settings.

Alternate solution: Would it be possible to add another tab to the settings dialog, and put mod-specific configs there?

sirskunkalot commented 2 years ago

Hey,

if you click on this: grafik

you will notice it's all in there already, including key binds ;) grafik

sirskunkalot commented 2 years ago

If you don't see your mod in there (or no mod settings at all), you probably did not use the default Config member of BaseUnityPlugin to create your config file.

sirskunkalot commented 2 years ago

PS: If you did not use the default Config member, you really should do that. It comes with even more perks: https://valheim-modding.github.io/Jotunn/tutorials/config.html

sirskunkalot commented 2 years ago

PPS: If you just don't see your key in the mod settings, you probably did not define a ButtonConfig for it and added that to the InputManager: https://valheim-modding.github.io/Jotunn/tutorials/inputs.html

joeyparrish commented 2 years ago

Okay, thanks. That's very helpful.