-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
keybindings.dm
29 lines (26 loc) · 915 Bytes
/
keybindings.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/// 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.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
// Hotkey
if(LAZYLEN(instance.hotkey_keys))
for(var/bound_key in instance.hotkey_keys)
if (bound_key == "Unbound")
LAZYADD(GLOB.default_hotkeys[instance.name], list())
else
LAZYADD(GLOB.default_hotkeys[instance.name], list(bound_key))
/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)