Files
Bubberstation/code/datums/hotkeys_help.dm
Tastyfish 9e9ef99c74 Moves help menu to end, fixes Hotkeys Help (#65295)
About The Pull Request

    Moves the Help menu to the end of the menu bar, like every app that has ever had a Help menu.

image

    Makes Hotkeys Help actually do something, given the verb that menu item calls was removed 3 years ago.
        It now show all of your hotkeys, as set in preferences, in a TGUI table. They're in Binding sort order, as opposed to the preferences window, which may be of use to people.

image
Why It's Good For The Game

halp how do i standup
Changelog

cl
add: Re-added the Hotkeys-Help verb, and linked the Hotkeys menu item to it.
qol: Move Help menu to the end of the menu bar.
/cl
2022-04-01 09:44:22 +13:00

41 lines
1.0 KiB
Plaintext

/datum/hotkeys_help
var/static/list/hotkeys = list()
/datum/hotkeys_help/ui_state()
return GLOB.always_state
/datum/hotkeys_help/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "HotkeysHelp")
ui.open()
// Not static data since user could rebind keys.
/datum/hotkeys_help/ui_data(mob/user)
// List every keybind to chat.
var/list/keys_list = list()
// Show them in alphabetical order by key
var/list/key_bindings_by_key = user.client.prefs.key_bindings_by_key.Copy()
sortTim(key_bindings_by_key, cmp = /proc/cmp_text_asc)
for(var/key in key_bindings_by_key)
// Get the full names
var/list/binding_names = list()
for(var/kb_name in key_bindings_by_key[key])
var/datum/keybinding/binding = GLOB.keybindings_by_name[kb_name]
binding_names += list(list(
"name" = binding.full_name,
"desc" = binding.description
))
// Add to list
keys_list += list(list(
"key" = key,
"bindings" = binding_names
))
return list(
"hotkeys" = keys_list
)