More Merge Fixes (#1304)

* Fixes SQL saving of hex numbers
* Removes completed TODO-MERGE notes
* Changes one instance of Galactic Common to Ceti Basic
* Renames instances of blind.layer to blind.invisibility (as is proper)
* Fixes the SQL schema some more
* Implements pAI saving
This commit is contained in:
skull132
2016-12-26 02:34:29 +02:00
committed by GitHub
parent b66d6eab36
commit 22c43472ae
14 changed files with 78 additions and 58 deletions
@@ -84,13 +84,13 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
/datum/category_item/player_setup_item/general/body/gather_save_parameters()
return list(":species" = pref.species,
":hair_colour" = "#" + num2hex(pref.r_hair) + num2hex(pref.g_hair) + num2hex(pref.b_hair),
":facial_colour" = "#" + num2hex(pref.r_facial) + num2hex(pref.g_facial) + num2hex(pref.b_facial),
":hair_colour" = "#" + num2hex(pref.r_hair, 2) + num2hex(pref.g_hair, 2) + num2hex(pref.b_hair, 2),
":facial_colour" = "#" + num2hex(pref.r_facial, 2) + num2hex(pref.g_facial, 2) + num2hex(pref.b_facial, 2),
":skin_tone" = pref.s_tone,
":skin_colour" = "#" + num2hex(pref.r_skin) + num2hex(pref.g_skin) + num2hex(pref.b_skin),
":skin_colour" = "#" + num2hex(pref.r_skin, 2) + num2hex(pref.g_skin, 2) + num2hex(pref.b_skin, 2),
":hair_style" = pref.h_style,
":facial_style" = pref.f_style,
":eyes_colour" = "#" + num2hex(pref.r_eyes) + num2hex(pref.g_eyes) + num2hex(pref.b_eyes),
":eyes_colour" = "#" + num2hex(pref.r_eyes, 2) + num2hex(pref.g_eyes, 2) + num2hex(pref.b_eyes, 2),
":b_type" = pref.b_type,
":disabilities" = pref.disabilities,
":organs_data" = list2params(pref.organ_data),
@@ -24,7 +24,7 @@
return list("ss13_player_preferences" = list("UI_style", "UI_style_color", "UI_style_alpha", "ooccolor", "ckey" = 1))
/datum/category_item/player_setup_item/player_global/ui/gather_save_parameters()
return list(":ckey" = pref.client.ckey, ":UI_style" = pref.UI_style, ":UI_style_alpha" = pref.UI_style_alpha, ":UI_style_color" = pref.UI_style_color, ":ooccolor" = pref.ooccolor)
return list(":ckey" = pref.client.ckey, ":UI_style_alpha" = pref.UI_style_alpha, ":UI_style_color" = pref.UI_style_color, ":UI_style" = pref.UI_style, ":ooccolor" = pref.ooccolor)
/datum/category_item/player_setup_item/player_global/ui/sanitize_preferences()
pref.UI_style = sanitize_inlist(pref.UI_style, all_ui_styles, initial(pref.UI_style))
@@ -14,7 +14,7 @@
/datum/category_item/player_setup_item/player_global/language/gather_load_parameters()
return list(":ckey" = pref.client.ckey)
/datum/category_item/player_setup_item/player_global/ui/gather_save_query()
/datum/category_item/player_setup_item/player_global/language/gather_save_query()
return list("ss13_player_preferences" = list("language_prefixes", "ckey" = 1))
/datum/category_item/player_setup_item/player_global/language/gather_save_parameters()
@@ -4,17 +4,20 @@
var/datum/paiCandidate/candidate
/datum/category_item/player_setup_item/player_global/pai/New()
..()
candidate = new()
/datum/category_item/player_setup_item/player_global/pai/load_preferences(var/savefile/S)
if(!candidate)
candidate = new()
return
if(!preference_mob())
return
candidate.savefile_load(preference_mob())
// #TODO-MERGE: Figure out how to handle pAI saving on SQL.
/datum/category_item/player_setup_item/player_global/pai/save_preferences(var/savefile/S)
if(!candidate)
return
@@ -24,6 +27,28 @@
candidate.savefile_save(preference_mob())
/datum/category_item/player_setup_item/player_global/pai/gather_load_query()
return list("ss13_player_pai" = list("vars" = list("name" = "pai/name", "description" = "pai/description", "role" = "pai/role", "comments" = "pai/comments"), "args" = list("ckey")))
/datum/category_item/player_setup_item/player_global/pai/gather_load_parameters()
return list(":ckey" = pref.client.ckey)
/datum/category_item/player_setup_item/player_global/pai/gather_save_query()
return list("ss13_player_pai" = list("name", "description", "role", "comments", "ckey" = 1))
/datum/category_item/player_setup_item/player_global/pai/gather_save_parameters()
if (!candidate)
return list()
return list(":ckey" = pref.client.ckey, ":name" = candidate.name, ":description" = candidate.description, ":role" = candidate.role, ":comments" = candidate.comments)
/datum/category_item/player_setup_item/player_global/pai/sanitize_preferences(var/sql_load = 0)
if (sql_load && candidate && pref.pai.len)
candidate.name = pref.pai["name"]
candidate.description = pref.pai["description"]
candidate.role = pref.pai["role"]
candidate.comments = pref.pai["comments"]
/datum/category_item/player_setup_item/player_global/pai/content(var/mob/user)
if(!candidate)
candidate = new()
@@ -148,8 +148,9 @@
for (var/datum/category_item/player_setup_item/PI in items)
PI.save_character(S)
else
if (modified && sql_role == SQL_CHARACTER)
handle_sql_saving(SQL_CHARACTER)
if (modified)
// No save here, because this is only called from the menu and needs to save /everything/.
handle_sql_saving(0)
modified = 0
/datum/category_group/player_setup_category/proc/load_preferences(var/savefile/S)
@@ -157,8 +158,7 @@
for (var/datum/category_item/player_setup_item/PI in items)
PI.load_preferences(S)
else
if (sql_role == SQL_PREFERENCES)
handle_sql_loading(SQL_PREFERENCES)
handle_sql_loading(SQL_PREFERENCES)
for (var/datum/category_item/player_setup_item/PI in items)
PI.sanitize_preferences(config.sql_saves)
@@ -171,8 +171,7 @@
for (var/datum/category_item/player_setup_item/PI in items)
PI.save_preferences(S)
else
if (sql_role == SQL_PREFERENCES)
handle_sql_saving(SQL_PREFERENCES)
handle_sql_saving(SQL_PREFERENCES)
/datum/category_group/player_setup_category/proc/update_setup(var/savefile/preferences, var/savefile/character)
for(var/datum/category_item/player_setup_item/PI in items)