mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-04 14:01:22 +00:00
* keybind signal support, ported from TGMC * Thank you linter * remove unused and extra defines * move signal defines up and fix emote keybind runtimes * Apply suggestions * Update keybinding.dm * Missed this one in the upstream merge * Ignore keybindings without names * back to the OG * Update living.dm * Update living.dm * got it * trailing newline * Update code/datums/keybinding/living.dm Co-authored-by: Rohesie <rohesie@gmail.com> Co-authored-by: Rohesie <rohesie@gmail.com>
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
/// Creates and sorts all the keybinding datums
|
|
/proc/init_keybindings()
|
|
for(var/KB in subtypesof(/datum/keybinding))
|
|
var/datum/keybinding/keybinding = KB
|
|
if(!initial(keybinding.keybind_signal) || !initial(keybinding.name))
|
|
continue
|
|
add_keybinding(new keybinding)
|
|
init_emote_keybinds()
|
|
|
|
/// Adds an instanced keybinding to the global tracker
|
|
/proc/add_keybinding(datum/keybinding/instance)
|
|
GLOB.keybindings_by_name[instance.name] = instance
|
|
|
|
// Classic
|
|
if(LAZYLEN(instance.classic_keys))
|
|
for(var/bound_key in instance.classic_keys)
|
|
LAZYADD(GLOB.classic_keybinding_list_by_key[bound_key], list(instance.name))
|
|
|
|
// Hotkey
|
|
if(LAZYLEN(instance.hotkey_keys))
|
|
for(var/bound_key in instance.hotkey_keys)
|
|
LAZYADD(GLOB.hotkey_keybinding_list_by_key[bound_key], list(instance.name))
|
|
|
|
/proc/init_emote_keybinds()
|
|
for(var/i in subtypesof(/datum/emote))
|
|
var/datum/emote/faketype = i
|
|
if(!initial(faketype.key))
|
|
continue
|
|
var/datum/keybinding/emote/emote_kb = new
|
|
emote_kb.link_to_emote(faketype)
|
|
add_keybinding(emote_kb)
|