From eb075ffc593d1a25d0b5c9d80ae20ce68af0d577 Mon Sep 17 00:00:00 2001 From: skoglol Date: Sun, 16 Feb 2020 14:29:37 +0100 Subject: [PATCH] Sets more sane default keybinds --- code/datums/keybinding/carbon.dm | 3 +-- code/datums/keybinding/mob.dm | 11 ++--------- code/datums/keybinding/movement.dm | 4 ---- code/modules/client/preferences.dm | 12 ++++++++++++ code/modules/client/preferences_savefile.dm | 10 ++++------ 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/code/datums/keybinding/carbon.dm b/code/datums/keybinding/carbon.dm index e8059da5dd3..abf84c9aadf 100644 --- a/code/datums/keybinding/carbon.dm +++ b/code/datums/keybinding/carbon.dm @@ -6,8 +6,7 @@ return iscarbon(user.mob) /datum/keybinding/carbon/toggle_throw_mode - hotkey_keys = list("R") - classic_keys = list("Southwest") // END + hotkey_keys = list("R", "Southwest") // END name = "toggle_throw_mode" full_name = "Toggle throw mode" description = "Toggle throwing the current item or not." diff --git a/code/datums/keybinding/mob.dm b/code/datums/keybinding/mob.dm index 693b740513c..f194c7fd2fe 100644 --- a/code/datums/keybinding/mob.dm +++ b/code/datums/keybinding/mob.dm @@ -5,7 +5,6 @@ /datum/keybinding/mob/face_north hotkey_keys = list("CtrlW", "CtrlNorth") - classic_keys = list("CtrlNorth") name = "face_north" full_name = "Face North" description = "" @@ -18,7 +17,6 @@ /datum/keybinding/mob/face_east hotkey_keys = list("CtrlD", "CtrlEast") - classic_keys = list("CtrlEast") name = "face_east" full_name = "Face East" description = "" @@ -31,7 +29,6 @@ /datum/keybinding/mob/face_south hotkey_keys = list("CtrlS", "CtrlSouth") - classic_keys = list("CtrlSouth") name = "face_south" full_name = "Face South" description = "" @@ -43,7 +40,6 @@ /datum/keybinding/mob/face_west hotkey_keys = list("CtrlA", "CtrlWest") - classic_keys = list("CtrlWest") name = "face_west" full_name = "Face West" description = "" @@ -55,7 +51,6 @@ /datum/keybinding/mob/stop_pulling hotkey_keys = list("H", "Delete") - classic_keys = list("Delete") name = "stop_pulling" full_name = "Stop pulling" description = "" @@ -91,8 +86,7 @@ return TRUE /datum/keybinding/mob/swap_hands - hotkey_keys = list("X") - classic_keys = list("Northeast") // PAGEUP + hotkey_keys = list("X", "Northeast") // PAGEUP name = "swap_hands" full_name = "Swap hands" description = "" @@ -103,8 +97,7 @@ return TRUE /datum/keybinding/mob/activate_inhand - hotkey_keys = list("Z") - classic_keys = list("Southeast") // PAGEDOWN + hotkey_keys = list("Z", "Southeast") // PAGEDOWN name = "activate_inhand" full_name = "Activate in-hand" description = "Uses whatever item you have inhand" diff --git a/code/datums/keybinding/movement.dm b/code/datums/keybinding/movement.dm index c021ca928ed..ca199b5eb4d 100644 --- a/code/datums/keybinding/movement.dm +++ b/code/datums/keybinding/movement.dm @@ -4,28 +4,24 @@ /datum/keybinding/movement/north hotkey_keys = list("W", "North") - classic_keys = list("North") name = "North" full_name = "Move North" description = "Moves your character north" /datum/keybinding/movement/south hotkey_keys = list("S", "South") - classic_keys = list("South") name = "South" full_name = "Move South" description = "Moves your character south" /datum/keybinding/movement/west hotkey_keys = list("A", "West") - classic_keys = list("West") name = "West" full_name = "Move West" description = "Moves your character left" /datum/keybinding/movement/east hotkey_keys = list("D", "East") - classic_keys = list("East") name = "East" full_name = "Move East" description = "Moves your character east" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 14509f250cf..b27e33cc063 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1815,3 +1815,15 @@ GLOBAL_LIST_EMPTY(preferences_datums) return else custom_names[name_id] = sanitized_name + +//Used in savefile update 32, can be removed once that is no longer relevant. +/datum/preferences/proc/force_reset_keybindings() + var/choice = tgalert(parent.mob, "Your basic keybindings need to be reset, emotes will remain as before. Would you prefer 'hotkey' or 'classic' mode?", "Reset keybindings", "Hotkey", "Classic") + hotkeys = (choice != "Classic") + var/list/oldkeys = key_bindings + key_bindings = (hotkeys) ? deepCopyList(GLOB.hotkey_keybinding_list_by_key) : deepCopyList(GLOB.classic_keybinding_list_by_key) + + for(var/key in oldkeys) + if(!key_bindings[key]) + key_bindings[key] = oldkeys[key] + parent.update_movement_keys() diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 6231006c5bb..b458d28841f 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 31 +#define SAVEFILE_VERSION_MAX 32 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -42,11 +42,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car //if your savefile is 3 months out of date, then 'tough shit'. /datum/preferences/proc/update_preferences(current_version, savefile/S) - if(current_version < 29) - key_bindings = (hotkeys) ? deepCopyList(GLOB.hotkey_keybinding_list_by_key) : deepCopyList(GLOB.classic_keybinding_list_by_key) - parent.update_movement_keys(src) - to_chat(parent, "Empty keybindings, setting default to [hotkeys ? "Hotkey" : "Classic"] mode") - if(current_version < 30) if(clientfps == 0) clientfps = 60 @@ -55,6 +50,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(clientfps == 60) clientfps = 0 + if(current_version < 32) //If you remove this, remove force_reset_keybindings() too. + addtimer(CALLBACK(src, .proc/force_reset_keybindings), 30) //No mob available when this is run, timer allows user choice. + /datum/preferences/proc/update_character(current_version, savefile/S) if(current_version < 19) pda_style = "mono"