Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes "Unbound" keybind slots sometimes not being removed #5720

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion code/modules/client/tgui_macro.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ GLOBAL_LIST_EMPTY(ui_data_keybindings)
prefs.save_preferences()
INVOKE_ASYNC(owner, /client/proc/set_macros)
return TRUE

if("clear_keybind")
var/list/kbinds = prefs.key_bindings
var/kb_name = params["keybinding"]
Expand All @@ -111,13 +112,15 @@ GLOBAL_LIST_EMPTY(ui_data_keybindings)
for(var/key in keys)
if(kbinds[key])
kbinds[key] -= kb_name
kbinds["Unbound"] += kb_name
if(!length(kbinds[key]))
kbinds -= key
// Add the keybind name to the 'unbound' list if it's not already in there.
kbinds["Unbound"] |= kb_name

prefs.save_preferences()
INVOKE_ASYNC(owner, /client/proc/set_macros)
return TRUE

if("clear_all_keybinds")
var/choice = tgui_alert(owner, "Would you prefer 'hotkey' or 'classic' defaults?", "Setup keybindings", list("Hotkey", "Classic", "Cancel"))
if(choice == "Cancel")
Expand Down
Loading