scp-fs2open / fs2open.github.com

Origin Repository for SCP FreeSpace 2 Open
https://www.hard-light.net/
Other
407 stars 163 forks source link

FR: Vectorize custom keybindings #4523

Open EatThePath opened 2 years ago

EatThePath commented 2 years ago

apologies if this is already a component of another project, I couldn't find anything on search. Mods really ought not to be restricted on custom keybind count.

MjnMixael commented 2 years ago

A challenge here will also be strings.tbl. I think that has a limited number of strings and custom keybinds use strings (not tstrings). IIRC I had to work to find unused string xstrs I could use for the 5 existing keybinds. Would need an additional string for each custom keybind added and/or switch custom keybinds to using tstrings which is not limited.

z64555 commented 2 years ago

The controls code is already vectorized to allow new controls added. There should be a LUA hook somewhere to define them, or possibly within the controlconfigdefaults.tbl.

As MjnMixael stated, an issue with custome keybinds added this way is localization support, which is an issue I hadn't come up with a design for yet.

z64555 commented 2 years ago

Ok, correction. Mod-added controls is a planned feature but hasn't been implemented yet, since we haven't come up with a good design to cover the issues of where controls should be added (via .tbl or LUA), how to hook into them, localization.

@BMagnu has done some work with LUA hooks on the controls code, but I don't remember how far he got with them.

MjnMixael commented 1 year ago

I dunno why I didn't see this before but Localization is technically already taken care of. The $Text field accepts an XSTR into tstrings (not strings) which means the control localizations are already not limited by strings.tbl as long as an XSTR is passed here with no $Has XStr entry.

However, if XSTR is used in this way, then the controls don't work. Probably because the code looks for controls by string name somewhere.