keybindings save file fix

This commit is contained in:
Coul
2019-11-15 03:46:31 -05:00
parent 61e70bf67c
commit 0b4d5918b9
2 changed files with 8 additions and 21 deletions
+3 -12
View File
@@ -27,7 +27,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/UI_style = null
var/buttons_locked = FALSE
var/hotkeys = FALSE
var/hotkeys = TRUE
// Custom Keybindings
var/list/key_bindings = list()
@@ -128,7 +128,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
return
//we couldn't load character data so just randomize the character appearance + name
random_character() //let's create a random character then - rather than a fat, bald and naked man.
addtimer(CALLBACK(src, .proc/load_default_keybindings, C), 5 SECONDS)
key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key) // give them default keybinds and update their movement keys
C.update_movement_keys()
real_name = pref_species.random_name(gender,1)
if(!loaded_preferences_successfully)
save_preferences()
@@ -136,16 +137,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
menuoptions = list()
return
/datum/preferences/proc/load_default_keybindings(client/C)
if(QDELETED(C))
return
to_chat(C, "Empty keybindings, setting default to hotkey mode")
hotkeys = TRUE
key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key)
C.update_movement_keys()
save_preferences()
#define APPEARANCE_CATEGORY_COLUMN "<td valign='top' width='14%'>"
#define MAX_MUTANT_ROWS 4
+5 -9
View File
@@ -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 28
#define SAVEFILE_VERSION_MAX 29
/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
@@ -42,7 +42,10 @@ 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)
return
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()
to_chat(parent, "<span class='userdanger'>Empty keybindings, setting default to [hotkeys ? "Hotkeys" : "Classic"] mode</span>")
/datum/preferences/proc/update_character(current_version, savefile/S)
if(current_version < 19)
@@ -126,9 +129,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["hair_style_name"] >> hairstyle
if(S["facial_style_name"])
S["facial_style_name"] >> facial_hairstyle
if(current_version < 28)
WRITE_FILE(S["key_bindings"], null)
/datum/preferences/proc/load_path(ckey,filename="preferences.sav")
if(!ckey)
@@ -220,10 +220,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color))
key_bindings = sanitize_islist(key_bindings, list())
if(!length(key_bindings))
key_bindings = (hotkeys) ? deepCopyList(GLOB.hotkey_keybinding_list_by_key) : deepCopyList(GLOB.classic_keybinding_list_by_key)
parent.update_movement_keys()
addtimer(CALLBACK(src, .proc/load_default_keybindings, parent), 5 SECONDS)
return TRUE