From 271705c7a061395d923dda22bd7ee7085fd190cc Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 4 Oct 2020 05:09:27 +0200 Subject: [PATCH] [MIRROR] Keybinding Conflicts now wait 5 seconds before being announced (#1146) * Keybinding Conflicts now wait 5 seconds before being announced (#54152) * Keybinding Conflicts now wait 5 seconds before being announced * Update preferences_savefile.dm Co-authored-by: Couls Co-authored-by: Azarak --- code/modules/client/preferences_savefile.dm | 16 +++++++++------- .../modules/client/preferences_savefile.dm | 17 ++++++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 4893a106c3f..bb3d20910af 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -119,14 +119,16 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(!addedbind) notadded += kb if(length(notadded)) - to_chat(parent, "KEYBINDING CONFLICT!!!\n \ - There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n \ - Or you can click here to go straight to the keybindings page") - for(var/item in notadded) - var/datum/keybinding/conflicted = item - to_chat(parent, "[conflicted.category]: [conflicted.full_name] needs updating") - LAZYADD(key_bindings["Unbound"], conflicted.name) // set it to unbound to prevent this from opening up again in the future + addtimer(CALLBACK(src, .proc/announce_conflict, notadded), 5 SECONDS) +/datum/preferences/proc/announce_conflict(list/notadded) + to_chat(parent, "KEYBINDING CONFLICT!!!\n\ + There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n\ + Or you can click here to go straight to the keybindings page") + for(var/item in notadded) + var/datum/keybinding/conflicted = item + to_chat(parent, "[conflicted.category]: [conflicted.full_name] needs updating") + LAZYADD(key_bindings["Unbound"], conflicted.name) // set it to unbound to prevent this from opening up again in the future diff --git a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm index 74b01c80b57..45d09240484 100644 --- a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm +++ b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm @@ -100,13 +100,16 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(!addedbind) notadded += kb if(length(notadded)) - to_chat(parent, "KEYBINDING CONFLICT!!!\n \ - There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n \ - Or you can click here to go straight to the keybindings page") - for(var/item in notadded) - var/datum/keybinding/conflicted = item - to_chat(parent, "[conflicted.category]: [conflicted.full_name] needs updating") - LAZYADD(key_bindings["Unbound"], conflicted.name) // set it to unbound to prevent this from opening up again in the future + addtimer(CALLBACK(src, .proc/announce_conflict, notadded), 5 SECONDS) + +/datum/preferences/proc/announce_conflict(list/notadded) + to_chat(parent, "KEYBINDING CONFLICT!!!\n\ + There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n\ + Or you can click here to go straight to the keybindings page") + for(var/item in notadded) + var/datum/keybinding/conflicted = item + to_chat(parent, "[conflicted.category]: [conflicted.full_name] needs updating") + LAZYADD(key_bindings["Unbound"], conflicted.name) // set it to unbound to prevent this from opening up again in the future /datum/preferences/proc/load_path(ckey,filename="preferences.sav") if(!ckey)