Hey everyone! The new hotkey system is looking wonderful! I’ve been digging through the code to see what it can do, and I have a certain capability in mind that I feel should be implemented, but I cannot seem to do it myself, so any advice would be appreciated.
Submenus Hotkeys
Take, for instance, the mine tool. Currently, that button is contained in the harvest menu, but any time you hit the “M” key, it will pop straight to the mine tool.
With submenuing capability, you could define a hotkey as something like: “category:harvest>keym” and this would require you to have the harvest menu open, then hit the “M” key to activate the mining tool. This is much like how traditional RTS hotkeys will have, say, a “Build” button that opens a menu with the actual building options, each with their own hotkey.
My current issue …
- In hotkey_manager.js _eventMatchesCombo (e, combo) function, I cannot seem to find a way to attach custom fields to the e object that I have defines in hotkeys.json. For instance, my hotkeys,json object may look like:
“harvest:mine” : {
“display_name” : “i18n(stonehearth:ui.shell.settings.controls_tab.key_binding_names.harvest_mine)”,
“category” : “harvest”,
“ordinal” : 20,
“combo1” : “keym”,
“combo2” : “”,
“require_category_menu”: true
}
but “require_category_menu” never gets attached to e, and I don’t understand how radiant.call() works, nor where to find ‘radiant:get_hotkey_definitions’ function. What’s more, is hotkey_manager.js even the right class to modify? Or should it be handled in the hotkey_service.lua? input_service.lua perhaps?
Additionally, I have this annoyance when using Decoda where if Im watching a variable, let’s say the KeyboardEvent e, if I specify “e” on the watchlist, all it will tell me is that is a [KeyboardEvent] object, not what variables and functions it has, is there any way to expose this info?
Thanks!