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

View File

@@ -344,7 +344,7 @@ CREATE TABLE `ss13_player_preferences` (
`current_character` int(11) NULL DEFAULT NULL,
`toggles` int(11) DEFAULT '0',
`UI_style_color` text NULL DEFAULT NULL,
`UI_style_alpha` int(11) NULL DEFAULT NULL,
`UI_style_alpha` int(11) NULL DEFAULT '255',
`asfx_togs` int(11) DEFAULT '0',
`lastmotd` text NULL DEFAULT NULL,
`lastmemo` text NULL DEFAULT NULL,
@@ -531,7 +531,7 @@ CREATE TABLE `ss13_character_incidents` (
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `UID_char_id` (`char_id`, `UID`),
UNIQUE INDEX `UID_char_id` (`char_id`, `UID`)
) COLLATE='utf8_bin' ENGINE=InnoDB;
CREATE TABLE `discord_channels` (
@@ -553,7 +553,7 @@ CREATE TABLE `ss13_ccia_actions` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `ss13_ccia_action_char` (
`action_id` int(10) unsigned NOT NULL,
@@ -572,4 +572,14 @@ CREATE TABLE `ss13_ccia_general_notice_list` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `ss13_player_pai` (
`ckey` VARCHAR(32) NOT NULL,
`name` VARCHAR(50) NULL DEFAULT NULL,
`description` TEXT NULL DEFAULT NULL,
`role` TEXT NULL DEFAULT NULL,
`comments` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`ckey`),
CONSTRAINT `player_pai_fk_ckey` FOREIGN KEY (`ckey`) REFERENCES `ss13_player` (`ckey`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

View File

@@ -35,9 +35,6 @@ var/global/list/additional_antag_types = list()
var/event_delay_mod_moderate // Modifies the timing of random events.
var/event_delay_mod_major // As above.
// #TODO-MERGE: Check where uplink shit is hidden now.
/datum/game_mode/New()
..()
// Enforce some formatting.

View File

@@ -1,8 +1,6 @@
/******************** Requests Console ********************/
/** Originally written by errorage, updated by: Carn, needs more work though. I just added some security fixes */
// #TODO-MERGE: RC alerts to PDA aaand forms for RCs
//Request Console Department Types
#define RC_ASSIST 1 //Request Assistance
#define RC_SUPPLY 2 //Request Supplies

View File

@@ -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),

View File

@@ -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))

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)

View File

@@ -124,6 +124,8 @@ datum/preferences
// OOC Metadata:
var/metadata = ""
var/list/pai = list() // A list for holding pAI related data.
var/client/client = null
var/savefile/loaded_preferences
@@ -387,7 +389,7 @@ datum/preferences
character.underwear = underwear
character.undershirt = undershirt
character.socks = socks
if(backbag > 5 || backbag < 1)

View File

@@ -44,7 +44,7 @@
var/list/speech_sounds // A list of sounds to potentially play when speaking.
var/list/speech_chance // The likelihood of a speech sound playing.
var/num_alternate_languages = 0 // How many secondary languages are available to select at character creation
var/name_language = "Galactic Common" // The language to use when determining names for this species, or null to use the first name/last name generator
var/name_language = "Ceti Basic" // The language to use when determining names for this species, or null to use the first name/last name generator
// Combat vars.
var/total_health = 100 // Point at which the mob will enter crit.
@@ -360,7 +360,6 @@
/datum/species/proc/get_vision_flags(var/mob/living/carbon/human/H)
return vision_flags
// #TODO-MERGE: Search for blind.layer refs, change to blind.invisibility
/datum/species/proc/handle_vision(var/mob/living/carbon/human/H)
H.update_sight()
H.sight |= get_vision_flags(H)
@@ -382,7 +381,7 @@
H.eye_blind = max(H.eye_blind, 1)
if(H.blind)
H.blind.layer = (H.eye_blind ? 18 : 0)
H.blind.invisibility = (H.eye_blind ? 18 : 0)
if(!H.client)//no client, no screen to update
return 1

View File

@@ -143,9 +143,9 @@
if(blind)
if(eye_blind)
blind.layer = 18
blind.invisibility = 18
else
blind.layer = 0
blind.invisibility = 0
if (disabilities & NEARSIGHTED)
client.screen += global_hud.vimpaired
if (eye_blurry)

View File

@@ -75,9 +75,15 @@ var/datum/paiController/paiController // Global handler for pAI candidates
candidate.comments = sanitize(t)
if("save")
candidate.savefile_save(usr)
if (config.sql_saves)
usr.client.prefs.save_preferences()
else
candidate.savefile_save(usr)
if("load")
candidate.savefile_load(usr)
if (config.sql_saves)
usr.client.prefs.load_preferences()
else
candidate.savefile_load(usr)
//In case people have saved unsanitized stuff.
if(candidate.name)
candidate.name = sanitizeSafe(candidate.name, MAX_NAME_LEN)
@@ -96,7 +102,10 @@ var/datum/paiController/paiController // Global handler for pAI candidates
p.alertUpdate()
usr << browse(null, "window=paiRecruit")
return
candidate.savefile_save(usr)
if (config.sql_saves)
usr.client.prefs.save_preferences()
else
candidate.savefile_save(usr)
recruitWindow(usr, href_list["allow_submit"] != "0")
/datum/paiController/proc/recruitWindow(var/mob/M as mob, allowSubmit = 1)
@@ -111,7 +120,12 @@ var/datum/paiController/paiController // Global handler for pAI candidates
candidate.key = M.key
pai_candidates.Add(candidate)
candidate.savefile_load(M)//Load the pAI config before displaying the window
// Load the data before displaying.
if (!config.sql_saves)
candidate.savefile_load(M)
else
M.client.prefs.load_preferences()
var/dat = ""
dat += {"
<style type="text/css">

View File

@@ -35,7 +35,6 @@
/mob/living/silicon/New()
silicon_mob_list |= src
..()
// #TODO-MERGE: Search for all isntances of Galactic Common and REPLACE THE FUCK OUT OF THEM!
add_language("Ceti Basic")
init_id()
@@ -382,5 +381,3 @@
if (!underdoor)
spawn(3)//A slight delay to let us finish walking out from under the door
layer = initial(layer)

View File

@@ -140,27 +140,6 @@
if (!self_served)
src.show_message(self_message, 1, blind_message, 2)
// #TODO-MERGE: Check visible_message original define.
// Show a message to all mobs in sight of this atom
// Use for objects performing visible actions
// message is output to anyone who can see, e.g. "The [src] does something!"
// blind_message (optional) is what blind people will hear e.g. "You hear something!"
// /atom/proc/visible_message(var/message, var/blind_message)
// var/list/messageturfs = list()//List of turfs we broadcast to.
// var/list/messagemobs = list()//List of living mobs nearby who can hear it, and distant ghosts who've chosen to hear it
// for (var/turf in view(world.view, get_turf(src)))
// messageturfs += turf
//
// for(var/mob/M in player_list)
// if (!M.client || istype(M, /mob/new_player))
// continue
// if(get_turf(M) in messageturfs)
// messagemobs += M
//
// for(var/mob/M in messagemobs)
// M.show_message( message, 1, blind_message, 2)
// Returns an amount of power drawn from the object (-1 if it's not viable).
// If drain_check is set it will not actually drain power, just return a value.
// If surge is set, it will destroy/damage the recipient and not return any power.