From b31f38796a0381360dac3a23da057fc5ca9a7e1c Mon Sep 17 00:00:00 2001 From: KasparoVy Date: Fri, 14 Apr 2017 00:54:09 -0400 Subject: [PATCH 1/3] Schema Changes Replaces the old RGB columns with hexcolour columns. The required SQL query to change the current database is this: ALTER TABLE `characters` ADD `hair_colour` varchar(7) NOT NULL AFTER `language`, ADD `secondary_hair_colour` varchar(7) NOT NULL AFTER `hair_blue`, ADD `facial_hair_colour` varchar(7) NOT NULL AFTER `secondary_hair_blue`, ADD `secondary_facial_hair_colour` varchar(7) NOT NULL AFTER `facial_blue`, ADD `skin_colour` varchar(7) NOT NULL AFTER `skin_tone`, ADD `head_accessory_colour` varchar(7) NOT NULL AFTER `marking_colours`, ADD `eye_colour` varchar(7) NOT NULL AFTER `alt_head_name`; UPDATE `characters` SET `hair_colour` = CONCAT("#", LPAD(HEX(`hair_red`), 2,'0'), LPAD(HEX(`hair_green`), 2,'0'), LPAD(HEX(`hair_blue`), 2,'0')), `secondary_hair_colour` = CONCAT("#", LPAD(HEX(`secondary_hair_red`), 2,'0'), LPAD(HEX(`secondary_hair_green`), 2,'0'), LPAD(HEX(`secondary_hair_blue`), 2,'0')), `facial_hair_colour` = CONCAT("#", LPAD(HEX(`facial_red`), 2,'0'), LPAD(HEX(`facial_green`), 2,'0'), LPAD(HEX(`facial_blue`), 2,'0')), `secondary_facial_hair_colour` = CONCAT("#", LPAD(HEX(`secondary_facial_red`), 2,'0'), LPAD(HEX(`secondary_facial_green`), 2,'0'), LPAD(HEX(`secondary_facial_blue`), 2,'0')), `skin_colour` = CONCAT("#", LPAD(HEX(`skin_red`), 2,'0'), LPAD(HEX(`skin_green`), 2,'0'), LPAD(HEX(`skin_blue`), 2,'0')), `head_accessory_colour` = CONCAT("#", LPAD(HEX(`head_accessory_red`), 2,'0'), LPAD(HEX(`head_accessory_green`), 2,'0'), LPAD(HEX(`head_accessory_blue`), 2,'0')), `eye_colour` = CONCAT("#", LPAD(HEX(`eyes_red`), 2,'0'), LPAD(HEX(`eyes_green`), 2,'0'), LPAD(HEX(`eyes_blue`), 2,'0')); ALTER TABLE `characters` DROP `hair_red`, DROP `hair_green`, DROP `hair_blue`, DROP `secondary_hair_red`, DROP `secondary_hair_green`, DROP `secondary_hair_blue`, DROP `facial_red`, DROP `facial_green`, DROP `facial_blue`, DROP `secondary_facial_red`, DROP `secondary_facial_green`, DROP `secondary_facial_blue`, DROP `skin_red`, DROP `skin_green`, DROP `skin_blue`, DROP `head_accessory_red`, DROP `head_accessory_green`, DROP `head_accessory_blue`, DROP `eyes_red`, DROP `eyes_green`, DROP `eyes_blue`; The above does the following: - Adds the new hex colour columns (7 char, 1 for the # and 6 for the number characters) - Fills the columns with the appropriate hexcolour values calculated by converting the appropriate database RGB entries and concatenating them (yes this actually works 100%, tested on local DB with 20 characters all with varying species/designs) - Drops the old columns afterward --- SQL/paradise_schema.sql | 28 +++++++--------------------- SQL/paradise_schema_prefixed.sql | 28 +++++++--------------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 8cf94d61835..f9ede329474 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -30,34 +30,20 @@ CREATE TABLE `characters` ( `age` smallint(4) NOT NULL, `species` varchar(45) NOT NULL, `language` varchar(45) NOT NULL, - `hair_red` smallint(4) NOT NULL, - `hair_green` smallint(4) NOT NULL, - `hair_blue` smallint(4) NOT NULL, - `secondary_hair_red` smallint(4) NOT NULL, - `secondary_hair_green` smallint(4) NOT NULL, - `secondary_hair_blue` smallint(4) NOT NULL, - `facial_red` smallint(4) NOT NULL, - `facial_green` smallint(4) NOT NULL, - `facial_blue` smallint(4) NOT NULL, - `secondary_facial_red` smallint(4) NOT NULL, - `secondary_facial_green` smallint(4) NOT NULL, - `secondary_facial_blue` smallint(4) NOT NULL, + `hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `secondary_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `secondary_facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', `skin_tone` smallint(4) NOT NULL, - `skin_red` smallint(4) NOT NULL, - `skin_green` smallint(4) NOT NULL, - `skin_blue` smallint(4) NOT NULL, + `skin_colour` varchar(7) NOT NULL DEFAULT '#000000', `marking_colours` varchar(255) NOT NULL DEFAULT 'head=%23000000&body=%23000000&tail=%23000000', - `head_accessory_red` smallint(4) NOT NULL, - `head_accessory_green` smallint(4) NOT NULL, - `head_accessory_blue` smallint(4) NOT NULL, + `head_accessory_colour` varchar(7) NOT NULL DEFAULT '#000000', `hair_style_name` varchar(45) NOT NULL, `facial_style_name` varchar(45) NOT NULL, `marking_styles` varchar(255) NOT NULL DEFAULT 'head=None&body=None&tail=None', `head_accessory_style_name` varchar(45) NOT NULL, `alt_head_name` varchar(45) NOT NULL, - `eyes_red` smallint(4) NOT NULL, - `eyes_green` smallint(4) NOT NULL, - `eyes_blue` smallint(4) NOT NULL, + `eye_colour` varchar(7) NOT NULL DEFAULT '#000000', `underwear` mediumtext NOT NULL, `undershirt` mediumtext NOT NULL, `backbag` mediumtext NOT NULL, diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index d1b62ae3767..8de204cfe3e 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -30,34 +30,20 @@ CREATE TABLE `SS13_characters` ( `age` smallint(4) NOT NULL, `species` varchar(45) NOT NULL, `language` varchar(45) NOT NULL, - `hair_red` smallint(4) NOT NULL, - `hair_green` smallint(4) NOT NULL, - `hair_blue` smallint(4) NOT NULL, - `secondary_hair_red` smallint(4) NOT NULL, - `secondary_hair_green` smallint(4) NOT NULL, - `secondary_hair_blue` smallint(4) NOT NULL, - `facial_red` smallint(4) NOT NULL, - `facial_green` smallint(4) NOT NULL, - `facial_blue` smallint(4) NOT NULL, - `secondary_facial_red` smallint(4) NOT NULL, - `secondary_facial_green` smallint(4) NOT NULL, - `secondary_facial_blue` smallint(4) NOT NULL, + `hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `secondary_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', + `secondary_facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000', `skin_tone` smallint(4) NOT NULL, - `skin_red` smallint(4) NOT NULL, - `skin_green` smallint(4) NOT NULL, - `skin_blue` smallint(4) NOT NULL, + `skin_colour` varchar(7) NOT NULL DEFAULT '#000000', `marking_colours` varchar(255) NOT NULL DEFAULT 'head=%23000000&body=%23000000&tail=%23000000', - `head_accessory_red` smallint(4) NOT NULL, - `head_accessory_green` smallint(4) NOT NULL, - `head_accessory_blue` smallint(4) NOT NULL, + `head_accessory_colour` varchar(7) NOT NULL DEFAULT '#000000', `hair_style_name` varchar(45) NOT NULL, `facial_style_name` varchar(45) NOT NULL, `marking_styles` varchar(255) NOT NULL DEFAULT 'head=None&body=None&tail=None', `head_accessory_style_name` varchar(45) NOT NULL, `alt_head_name` varchar(45) NOT NULL, - `eyes_red` smallint(4) NOT NULL, - `eyes_green` smallint(4) NOT NULL, - `eyes_blue` smallint(4) NOT NULL, + `eye_colour` varchar(7) NOT NULL DEFAULT '#000000', `underwear` mediumtext NOT NULL, `undershirt` mediumtext NOT NULL, `backbag` mediumtext NOT NULL, From a6bb591b46ca422476cdc3317133fe3c4b21352d Mon Sep 17 00:00:00 2001 From: KasparoVy Date: Fri, 14 Apr 2017 04:32:37 -0400 Subject: [PATCH 2/3] Converts Mob Colours to Hexadecimal No front-end changes. This just means that mob colours now take up less columns in the database, incur less processing (reduced rgb() calls) and reduces the amount of code dedicated to them. --- code/__HELPERS/icons.dm | 9 +- code/datums/datacore.dm | 23 +- code/game/dna/dna2.dm | 6 +- code/game/dna/dna2_helpers.dm | 93 +++----- code/game/dna/genes/vg_powers.dm | 35 ++- code/game/gamemodes/nuclear/nuclear.dm | 12 +- code/game/mecha/combat/honker.dm | 9 - code/game/response_team.dm | 12 +- code/modules/client/preference/preferences.dm | 163 +++++--------- .../client/preference/preferences_mysql.dm | 213 +++++++----------- code/modules/clothing/head/misc_special.dm | 8 +- .../mob/living/carbon/human/appearance.dm | 57 ++--- code/modules/mob/living/carbon/human/human.dm | 32 +-- .../mob/living/carbon/human/human_defines.dm | 4 +- .../living/carbon/human/species/station.dm | 7 +- .../mob/living/carbon/human/update_icons.dm | 26 +-- .../mob/new_player/preferences_setup.dm | 65 ++---- code/modules/nano/modules/human_appearance.dm | 112 +++------ .../reagents/chemistry/reagents/misc.dm | 10 +- code/modules/surgery/organs/augments_eyes.dm | 11 +- code/modules/surgery/organs/organ_external.dm | 2 +- code/modules/surgery/organs/organ_icon.dm | 28 +-- code/modules/surgery/organs/organ_internal.dm | 10 +- .../surgery/organs/subtypes/standard.dm | 20 +- 24 files changed, 346 insertions(+), 621 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index cfe37505e1c..ac17d0591c5 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -884,9 +884,16 @@ proc/sort_atoms_by_layer(var/list/atoms) icon = J return J return 0 - + //Hook, override to run code on- wait this is images //Images have dir without being an atom, so they get their own definition. //Lame. /image/proc/setDir(newdir) dir = newdir + +proc/rand_hex_color() + var/list/colors = list("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f") + var/color="" + for(var/i=0;i<6;i++) + color = color+pick(colors) + return "#[color]" diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 35e5c04d112..d611396a45a 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -384,7 +384,7 @@ var/record_id_num = 1001 // Proper Skin color - Fix, you can't have HAS_SKIN_TONE *and* HAS_SKIN_COLOR if(H.species.bodyflags & HAS_SKIN_COLOR) - preview_icon.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), ICON_ADD) + preview_icon.Blend(H.skin_colour, ICON_ADD) //Tail Markings var/icon/t_marking_s @@ -402,10 +402,7 @@ var/record_id_num = 1001 var/icon/eyes_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = H.species ? H.species.eyes : "eyes_s") if(!eyes_organ) return - var/eye_red = eyes_organ.eye_colour[1] - var/eye_green = eyes_organ.eye_colour[2] - var/eye_blue = eyes_organ.eye_colour[3] - eyes_s.Blend(rgb(eye_red, eye_green, eye_blue), ICON_ADD) + eyes_s.Blend(eyes_organ.eye_colour, ICON_ADD) face_s.Blend(eyes_s, ICON_OVERLAY) var/datum/sprite_accessory/hair_style = hair_styles_list[head_organ.h_style] @@ -414,14 +411,14 @@ var/record_id_num = 1001 // I'll want to make a species-specific proc for this sooner or later // But this'll do for now if(head_organ.species.name == "Slime People") - hair_s.Blend(rgb(H.r_skin, H.g_skin, H.b_skin, 160), ICON_AND) + hair_s.Blend("[H.skin_colour]A0", ICON_AND) //A0 = 160 alpha. else - hair_s.Blend(rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair), ICON_ADD) + hair_s.Blend(head_organ.hair_colour, ICON_ADD) if(hair_style.secondary_theme) var/icon/hair_secondary_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[hair_style.secondary_theme]_s") if(!hair_style.no_sec_colour) - hair_secondary_s.Blend(rgb(head_organ.r_hair_sec, head_organ.g_hair_sec, head_organ.b_hair_sec), ICON_ADD) + hair_secondary_s.Blend(head_organ.sec_hair_colour, ICON_ADD) hair_s.Blend(hair_secondary_s, ICON_OVERLAY) face_s.Blend(hair_s, ICON_OVERLAY) @@ -431,21 +428,21 @@ var/record_id_num = 1001 var/datum/sprite_accessory/head_accessory_style = head_accessory_styles_list[head_organ.ha_style] if(head_accessory_style && head_accessory_style.species_allowed) var/icon/head_accessory_s = new/icon("icon" = head_accessory_style.icon, "icon_state" = "[head_accessory_style.icon_state]_s") - head_accessory_s.Blend(rgb(head_organ.r_headacc, head_organ.g_headacc, head_organ.b_headacc), ICON_ADD) + head_accessory_s.Blend(head_organ.headacc_colour, ICON_ADD) face_s.Blend(head_accessory_s, ICON_OVERLAY) var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[head_organ.f_style] if(facial_hair_style && facial_hair_style.species_allowed) var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") if(head_organ.species.name == "Slime People") - facial_s.Blend(rgb(H.r_skin, H.g_skin, H.b_skin, 160), ICON_ADD) + facial_s.Blend("[H.skin_colour]A0", ICON_ADD) //A0 = 160 alpha. else - facial_s.Blend(rgb(head_organ.r_facial, head_organ.g_facial, head_organ.b_facial), ICON_ADD) + facial_s.Blend(head_organ.facial_colour, ICON_ADD) if(facial_hair_style.secondary_theme) var/icon/facial_secondary_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_[facial_hair_style.secondary_theme]_s") if(!facial_hair_style.no_sec_colour) - facial_secondary_s.Blend(rgb(head_organ.r_facial_sec, head_organ.g_facial_sec, head_organ.b_facial_sec), ICON_ADD) + facial_secondary_s.Blend(head_organ.sec_facial_colour, ICON_ADD) facial_s.Blend(facial_secondary_s, ICON_OVERLAY) face_s.Blend(facial_s, ICON_OVERLAY) @@ -614,7 +611,7 @@ var/record_id_num = 1001 if(H.body_accessory.pixel_y_offset) temp.Shift(NORTH, H.body_accessory.pixel_y_offset) if(H.species.bodyflags & HAS_SKIN_COLOR) - temp.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), H.body_accessory.blend_mode) + temp.Blend(H.skin_colour, H.body_accessory.blend_mode) if(t_marking_s) temp.Blend(t_marking_s, ICON_OVERLAY) preview_icon.Blend(temp, ICON_OVERLAY) diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index a9e0c49a122..f21c2948b01 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -159,9 +159,9 @@ var/global/list/bad_blocks[0] head_traits_to_dna(H) eye_color_to_dna(eyes_organ) - SetUIValueRange(DNA_UI_SKIN_R, character.r_skin, 255, 1) - SetUIValueRange(DNA_UI_SKIN_G, character.g_skin, 255, 1) - SetUIValueRange(DNA_UI_SKIN_B, character.b_skin, 255, 1) + SetUIValueRange(DNA_UI_SKIN_R, color2R(character.skin_colour), 255, 1) + SetUIValueRange(DNA_UI_SKIN_G, color2G(character.skin_colour), 255, 1) + SetUIValueRange(DNA_UI_SKIN_B, color2B(character.skin_colour), 255, 1) SetUIValueRange(DNA_UI_HEAD_MARK_R, color2R(character.m_colours["head"]), 255, 1) SetUIValueRange(DNA_UI_HEAD_MARK_G, color2G(character.m_colours["head"]), 255, 1) diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 8a0894bfe09..01424b35934 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -140,9 +140,7 @@ dna.write_eyes_attributes(eye_organ) H.update_eyes() - H.r_skin = dna.GetUIValueRange(DNA_UI_SKIN_R, 255) - H.g_skin = dna.GetUIValueRange(DNA_UI_SKIN_G, 255) - H.b_skin = dna.GetUIValueRange(DNA_UI_SKIN_B, 255) + H.skin_colour = rgb(dna.GetUIValueRange(DNA_UI_SKIN_R, 255), dna.GetUIValueRange(DNA_UI_SKIN_G, 255), dna.GetUIValueRange(DNA_UI_SKIN_B, 255)) H.m_colours["head"] = rgb(dna.GetUIValueRange(DNA_UI_HEAD_MARK_R, 255), dna.GetUIValueRange(DNA_UI_HEAD_MARK_G, 255), dna.GetUIValueRange(DNA_UI_HEAD_MARK_B, 255)) H.m_colours["body"] = rgb(dna.GetUIValueRange(DNA_UI_BODY_MARK_R, 255), dna.GetUIValueRange(DNA_UI_BODY_MARK_G, 255), dna.GetUIValueRange(DNA_UI_BODY_MARK_B, 255)) @@ -191,43 +189,27 @@ if((hair > 0) && (hair <= hair_styles_list.len)) head_organ.h_style = hair_styles_list[hair] - head_organ.r_hair = GetUIValueRange(DNA_UI_HAIR_R, 255) - head_organ.g_hair = GetUIValueRange(DNA_UI_HAIR_G, 255) - head_organ.b_hair = GetUIValueRange(DNA_UI_HAIR_B, 255) - - head_organ.r_hair_sec = GetUIValueRange(DNA_UI_HAIR2_R, 255) - head_organ.g_hair_sec = GetUIValueRange(DNA_UI_HAIR2_G, 255) - head_organ.b_hair_sec = GetUIValueRange(DNA_UI_HAIR2_B, 255) + head_organ.hair_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HAIR_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR_B, 255)) + head_organ.sec_hair_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HAIR2_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR2_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HAIR2_B, 255)) //Facial Hair var/beard = GetUIValueRange(DNA_UI_BEARD_STYLE,facial_hair_styles_list.len) if((beard > 0) && (beard <= facial_hair_styles_list.len)) head_organ.f_style = facial_hair_styles_list[beard] - head_organ.r_facial = GetUIValueRange(DNA_UI_BEARD_R, 255) - head_organ.g_facial = GetUIValueRange(DNA_UI_BEARD_G, 255) - head_organ.b_facial = GetUIValueRange(DNA_UI_BEARD_B, 255) - - head_organ.r_facial_sec = GetUIValueRange(DNA_UI_BEARD2_R, 255) - head_organ.g_facial_sec = GetUIValueRange(DNA_UI_BEARD2_G, 255) - head_organ.b_facial_sec = GetUIValueRange(DNA_UI_BEARD2_B, 255) + head_organ.facial_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_BEARD_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD_B, 255)) + head_organ.sec_facial_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_BEARD2_B, 255)) //Head Accessories var/headacc = GetUIValueRange(DNA_UI_HACC_STYLE,head_accessory_styles_list.len) if((headacc > 0) && (headacc <= head_accessory_styles_list.len)) head_organ.ha_style = head_accessory_styles_list[headacc] - head_organ.r_headacc = GetUIValueRange(DNA_UI_HACC_R, 255) - head_organ.g_headacc = GetUIValueRange(DNA_UI_HACC_G, 255) - head_organ.b_headacc = GetUIValueRange(DNA_UI_HACC_B, 255) + head_organ.headacc_colour = rgb(head_organ.dna.GetUIValueRange(DNA_UI_HACC_R, 255), head_organ.dna.GetUIValueRange(DNA_UI_HACC_G, 255), head_organ.dna.GetUIValueRange(DNA_UI_HACC_B, 255)) // This proc gives the DNA info for eye color to the given eyes /datum/dna/proc/write_eyes_attributes(obj/item/organ/internal/eyes/eyes_organ) - var/red = GetUIValueRange(DNA_UI_EYES_R, 255) - var/green = GetUIValueRange(DNA_UI_EYES_G, 255) - var/blue = GetUIValueRange(DNA_UI_EYES_B, 255) - if(eyes_organ) - eyes_organ.eye_colour = list(red, green, blue) + eyes_organ.eye_colour = rgb(eyes_organ.dna.GetUIValueRange(DNA_UI_EYES_R, 255), eyes_organ.dna.GetUIValueRange(DNA_UI_EYES_G, 255), eyes_organ.dna.GetUIValueRange(DNA_UI_EYES_B, 255)) /* TRAIT CHANGING PROCS @@ -237,50 +219,47 @@ // In absence of eyes, possibly randomize the eye color DNA? return - var/eye_red = eyes_organ.eye_colour[1] - var/eye_green = eyes_organ.eye_colour[2] - var/eye_blue = eyes_organ.eye_colour[3] - SetUIValueRange(DNA_UI_EYES_R, eye_red, 255, 1) - SetUIValueRange(DNA_UI_EYES_G, eye_green, 255, 1) - SetUIValueRange(DNA_UI_EYES_B, eye_blue, 255, 1) + SetUIValueRange(DNA_UI_EYES_R, color2R(eyes_organ.eye_colour), 255, 1) + SetUIValueRange(DNA_UI_EYES_G, color2G(eyes_organ.eye_colour), 255, 1) + SetUIValueRange(DNA_UI_EYES_B, color2B(eyes_organ.eye_colour), 255, 1) -/datum/dna/proc/head_traits_to_dna(obj/item/organ/external/head/H) - if(!H) +/datum/dna/proc/head_traits_to_dna(obj/item/organ/external/head/head_organ) + if(!head_organ) log_runtime(EXCEPTION("Attempting to reset DNA from a missing head!"), src) return - if(!H.h_style) - H.h_style = "Skinhead" - var/hair = hair_styles_list.Find(H.h_style) + if(!head_organ.h_style) + head_organ.h_style = "Skinhead" + var/hair = hair_styles_list.Find(head_organ.h_style) // Facial Hair - if(!H.f_style) - H.f_style = "Shaved" - var/beard = facial_hair_styles_list.Find(H.f_style) + if(!head_organ.f_style) + head_organ.f_style = "Shaved" + var/beard = facial_hair_styles_list.Find(head_organ.f_style) // Head Accessory - if(!H.ha_style) - H.ha_style = "None" - var/headacc = head_accessory_styles_list.Find(H.ha_style) + if(!head_organ.ha_style) + head_organ.ha_style = "None" + var/headacc = head_accessory_styles_list.Find(head_organ.ha_style) - SetUIValueRange(DNA_UI_HAIR_R, H.r_hair, 255, 1) - SetUIValueRange(DNA_UI_HAIR_G, H.g_hair, 255, 1) - SetUIValueRange(DNA_UI_HAIR_B, H.b_hair, 255, 1) + SetUIValueRange(DNA_UI_HAIR_R, color2R(head_organ.hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR_G, color2G(head_organ.hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR_B, color2B(head_organ.hair_colour), 255, 1) - SetUIValueRange(DNA_UI_HAIR2_R, H.r_hair_sec, 255, 1) - SetUIValueRange(DNA_UI_HAIR2_G, H.g_hair_sec, 255, 1) - SetUIValueRange(DNA_UI_HAIR2_B, H.b_hair_sec, 255, 1) + SetUIValueRange(DNA_UI_HAIR2_R, color2R(head_organ.sec_hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR2_G, color2G(head_organ.sec_hair_colour), 255, 1) + SetUIValueRange(DNA_UI_HAIR2_B, color2B(head_organ.sec_hair_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD_R, H.r_facial, 255, 1) - SetUIValueRange(DNA_UI_BEARD_G, H.g_facial, 255, 1) - SetUIValueRange(DNA_UI_BEARD_B, H.b_facial, 255, 1) + SetUIValueRange(DNA_UI_BEARD_R, color2R(head_organ.facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD_G, color2G(head_organ.facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD_B, color2B(head_organ.facial_colour), 255, 1) - SetUIValueRange(DNA_UI_BEARD2_R, H.r_facial_sec, 255, 1) - SetUIValueRange(DNA_UI_BEARD2_G, H.g_facial_sec, 255, 1) - SetUIValueRange(DNA_UI_BEARD2_B, H.b_facial_sec, 255, 1) + SetUIValueRange(DNA_UI_BEARD2_R, color2R(head_organ.sec_facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD2_G, color2G(head_organ.sec_facial_colour), 255, 1) + SetUIValueRange(DNA_UI_BEARD2_B, color2B(head_organ.sec_facial_colour), 255, 1) - SetUIValueRange(DNA_UI_HACC_R, H.r_headacc, 255, 1) - SetUIValueRange(DNA_UI_HACC_G, H.g_headacc, 255, 1) - SetUIValueRange(DNA_UI_HACC_B, H.b_headacc, 255, 1) + SetUIValueRange(DNA_UI_HACC_R, color2R(head_organ.headacc_colour), 255, 1) + SetUIValueRange(DNA_UI_HACC_G, color2G(head_organ.headacc_colour), 255, 1) + SetUIValueRange(DNA_UI_HACC_B, color2B(head_organ.headacc_colour), 255, 1) SetUIValueRange(DNA_UI_HAIR_STYLE, hair, hair_styles_list.len, 1) SetUIValueRange(DNA_UI_BEARD_STYLE, beard, facial_hair_styles_list.len, 1) diff --git a/code/game/dna/genes/vg_powers.dm b/code/game/dna/genes/vg_powers.dm index 32a6a58cbb3..cbacd5faf00 100644 --- a/code/game/dna/genes/vg_powers.dm +++ b/code/game/dna/genes/vg_powers.dm @@ -45,16 +45,9 @@ else M.change_gender(FEMALE) - var/eyes_red = 0 - var/eyes_green = 0 - var/eyes_blue = 0 - if(eyes_organ) - eyes_red = eyes_organ.eye_colour[1] - eyes_green = eyes_organ.eye_colour[2] - eyes_blue = eyes_organ.eye_colour[3] - var/new_eyes = input("Please select eye color.", "Character Generation", rgb(eyes_red,eyes_green,eyes_blue)) as null|color + var/new_eyes = input("Please select eye color.", "Character Generation", eyes_organ.eye_colour) as null|color if(new_eyes) - M.change_eye_color(color2R(new_eyes), color2G(new_eyes), color2B(new_eyes)) + M.change_eye_color(new_eyes) //Alt heads. if(head_organ.species.bodyflags & HAS_ALT_HEADS) @@ -71,15 +64,15 @@ if(new_style) M.change_hair(new_style) - var/new_hair = input("Please select hair color.", "Character Generation", rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair)) as null|color + var/new_hair = input("Please select hair color.", "Character Generation", head_organ.hair_colour) as null|color if(new_hair) - M.change_hair_color(color2R(new_hair), color2G(new_hair), color2B(new_hair)) + M.change_hair_color(new_hair) var/datum/sprite_accessory/hair_style = hair_styles_list[head_organ.h_style] if(hair_style.secondary_theme && !hair_style.no_sec_colour) - new_hair = input("Please select secondary hair color.", "Character Generation", rgb(head_organ.r_hair_sec, head_organ.g_hair_sec, head_organ.b_hair_sec)) as null|color + new_hair = input("Please select secondary hair color.", "Character Generation", head_organ.sec_hair_colour) as null|color if(new_hair) - M.change_hair_color(color2R(new_hair), color2G(new_hair), color2B(new_hair), 1) + M.change_hair_color(new_hair, 1) // facial hair var/list/valid_facial_hairstyles = M.generate_valid_facial_hairstyles() @@ -88,15 +81,15 @@ if(new_style) M.change_facial_hair(new_style) - var/new_facial = input("Please select facial hair color.", "Character Generation", rgb(head_organ.r_facial, head_organ.g_facial, head_organ.b_facial)) as null|color + var/new_facial = input("Please select facial hair color.", "Character Generation", head_organ.facial_colour) as null|color if(new_facial) - M.change_facial_hair_color(color2R(new_facial), color2G(new_facial), color2B(new_facial)) + M.change_facial_hair_color(new_facial) var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[head_organ.f_style] if(facial_hair_style.secondary_theme && !facial_hair_style.no_sec_colour) - new_facial = input("Please select secondary facial hair color.", "Character Generation", rgb(head_organ.r_facial_sec, head_organ.g_facial_sec, head_organ.b_facial_sec)) as null|color + new_facial = input("Please select secondary facial hair color.", "Character Generation", head_organ.sec_facial_colour) as null|color if(new_facial) - M.change_facial_hair_color(color2R(new_facial), color2G(new_facial), color2B(new_facial), 1) + M.change_facial_hair_color(new_facial, 1) //Head accessory. if(head_organ.species.bodyflags & HAS_HEAD_ACCESSORY) @@ -105,9 +98,9 @@ if(new_head_accessory) M.change_head_accessory(new_head_accessory) - var/new_head_accessory_colour = input("Please select head accessory colour.", "Character Generation", rgb(head_organ.r_headacc, head_organ.g_headacc, head_organ.b_headacc)) as null|color + var/new_head_accessory_colour = input("Please select head accessory colour.", "Character Generation", head_organ.headacc_colour) as null|color if(new_head_accessory_colour) - M.change_head_accessory_color(color2R(new_head_accessory_colour), color2G(new_head_accessory_colour), color2B(new_head_accessory_colour)) + M.change_head_accessory_color(new_head_accessory_colour) //Body accessory. if(M.species.tail && M.species.bodyflags & HAS_TAIL) @@ -174,9 +167,9 @@ //Skin colour. if(M.species.bodyflags & HAS_SKIN_COLOR) - var/new_body_colour = input("Please select body colour.", "Character Generation", rgb(M.r_skin, M.g_skin, M.b_skin)) as null|color + var/new_body_colour = input("Please select body colour.", "Character Generation", M.skin_colour) as null|color if(new_body_colour) - M.change_skin_color(color2R(new_body_colour), color2G(new_body_colour), color2B(new_body_colour)) + M.change_skin_color(new_body_colour) M.update_dna() diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 6c28b9ade28..8b0565c432e 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -153,13 +153,11 @@ proc/issyndicate(mob/living/M as mob) var/hair_c = pick("#8B4513","#000000","#FF4500","#FFD700") // Brown, black, red, blonde var/eye_c = pick("#000000","#8B4513","1E90FF") // Black, brown, blue var/skin_tone = pick(-50, -30, -10, 0, 0, 0, 10) // Caucasian/black - head_organ.r_facial = color2R(hair_c) - head_organ.g_facial = color2G(hair_c) - head_organ.b_facial = color2B(hair_c) - head_organ.r_hair = color2R(hair_c) - head_organ.g_hair = color2G(hair_c) - head_organ.b_hair = color2B(hair_c) - M.change_eye_color(color2R(eye_c), color2G(eye_c), color2B(eye_c)) + head_organ.facial_colour = hair_c + head_organ.sec_facial_colour = hair_c + head_organ.hair_colour = hair_c + head_organ.sec_hair_colour = hair_c + M.change_eye_color(eye_c) M.s_tone = skin_tone head_organ.h_style = random_hair_style(M.gender, head_organ.species.name) head_organ.f_style = random_facial_hair_style(M.gender, head_organ.species.name) diff --git a/code/game/mecha/combat/honker.dm b/code/game/mecha/combat/honker.dm index 83392cd7447..e0b10fb622a 100644 --- a/code/game/mecha/combat/honker.dm +++ b/code/game/mecha/combat/honker.dm @@ -143,12 +143,3 @@ obj/mecha/combat/honker/Topic(href, href_list) if("sadtrombone") playsound(src, 'sound/misc/sadtrombone.ogg', 50) return - -proc/rand_hex_color() - var/list/colors = list("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f") - var/color="" - for(var/i=0;i<6;i++) - color = color+pick(colors) - return color - - diff --git a/code/game/response_team.dm b/code/game/response_team.dm index ebfe10f71e0..c54d1f65b37 100644 --- a/code/game/response_team.dm +++ b/code/game/response_team.dm @@ -167,13 +167,11 @@ var/ert_request_answered = 0 var/eye_c = pick("#000000","#8B4513","1E90FF") // Black, brown, blue var/skin_tone = pick(-50, -30, -10, 0, 0, 0, 10) // Caucasian/black - head_organ.r_facial = color2R(hair_c) - head_organ.g_facial = color2G(hair_c) - head_organ.b_facial = color2B(hair_c) - head_organ.r_hair = color2R(hair_c) - head_organ.g_hair = color2G(hair_c) - head_organ.b_hair = color2B(hair_c) - M.change_eye_color(color2R(eye_c), color2G(eye_c), color2B(eye_c)) + head_organ.facial_colour = hair_c + head_organ.sec_facial_colour = hair_c + head_organ.hair_colour = hair_c + head_organ.sec_hair_colour = hair_c + M.change_eye_color(eye_c) M.s_tone = skin_tone head_organ.h_style = random_hair_style(M.gender, head_organ.species.name) head_organ.f_style = random_facial_hair_style(M.gender, head_organ.species.name) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 874ab51c9e8..8650245a46a 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -112,9 +112,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts var/socks = "Nude" //socks type var/backbag = GBACKPACK //backpack type var/ha_style = "None" //Head accessory style - var/r_headacc = 0 //Head accessory colour - var/g_headacc = 0 //Head accessory colour - var/b_headacc = 0 //Head accessory colour + var/hacc_colour = "#000000" //Head accessory colour var/list/m_styles = list( "head" = "None", "body" = "None", @@ -126,26 +124,14 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts "tail" = "#000000" ) //Marking colours. var/h_style = "Bald" //Hair type - var/r_hair = 0 //Hair color - var/g_hair = 0 //Hair color - var/b_hair = 0 //Hair color - var/r_hair_sec = 0 //Secondary hair color - var/g_hair_sec = 0 //Secondary hair color - var/b_hair_sec = 0 //Secondary hair color + var/h_colour = "#000000" //Hair color + var/h_sec_colour = "#000000" //Secondary hair color var/f_style = "Shaved" //Facial hair type - var/r_facial = 0 //Facial hair color - var/g_facial = 0 //Facial hair color - var/b_facial = 0 //Facial hair color - var/r_facial_sec = 0 //Secondary facial hair color - var/g_facial_sec = 0 //Secondary facial hair color - var/b_facial_sec = 0 //Secondary facial hair color + var/f_colour = "#000000" //Facial hair color + var/f_sec_colour = "#000000" //Secondary facial hair color var/s_tone = 0 //Skin tone - var/r_skin = 0 //Skin color - var/g_skin = 0 //Skin color - var/b_skin = 0 //Skin color - var/r_eyes = 0 //Eye color - var/g_eyes = 0 //Eye color - var/b_eyes = 0 //Eye color + var/s_colour = "#000000" //Skin color + var/e_colour = "#000000" //Eye color var/alt_head = "None" //Alt head style. var/species = "Human" var/language = "None" //Secondary language @@ -241,8 +227,8 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts save_preferences(C) save_character(C) //let's save this new random character so it doesn't keep generating new ones. -/datum/preferences/proc/color_square(r, g, b) - return "___" +/datum/preferences/proc/color_square(colour) + return "___" // Hello I am a proc full of snowflake species checks how are you /datum/preferences/proc/ShowChoices(mob/user) @@ -319,45 +305,45 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts headaccessoryname = "Horns: " dat += "[headaccessoryname]" dat += "[ha_style] " - dat += "Color [color_square(r_headacc, g_headacc, b_headacc)]
" + dat += "Color [color_square(hacc_colour)]
" if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings. dat += "Head Markings: " dat += "[m_styles["head"]]" - dat += "Color [color_square(color2R(m_colours["head"]), color2G(m_colours["head"]), color2B(m_colours["head"]))]
" + dat += "Color [color_square(m_colours["head"])]
" if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos. dat += "Body Markings: " dat += "[m_styles["body"]]" - dat += "Color [color_square(color2R(m_colours["body"]), color2G(m_colours["body"]), color2B(m_colours["body"]))]
" + dat += "Color [color_square(m_colours["body"])]
" if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings. dat += "Tail Markings: " dat += "[m_styles["tail"]]" - dat += "Color [color_square(color2R(m_colours["tail"]), color2G(m_colours["tail"]), color2B(m_colours["tail"]))]
" + dat += "Color [color_square(m_colours["tail"])]
" dat += "Hair: " dat += "[h_style]" - dat += "Color [color_square(r_hair, g_hair, b_hair)]" + dat += "Color [color_square(h_colour)]" var/datum/sprite_accessory/temp_hair_style = hair_styles_list[h_style] if(temp_hair_style && temp_hair_style.secondary_theme && !temp_hair_style.no_sec_colour) - dat += " Color #2 [color_square(r_hair_sec, g_hair_sec, b_hair_sec)]" + dat += " Color #2 [color_square(h_sec_colour)]" dat += "
" dat += "Facial Hair: " dat += "[f_style ? "[f_style]" : "Shaved"]" - dat += "Color [color_square(r_facial, g_facial, b_facial)]" + dat += "Color [color_square(f_colour)]" var/datum/sprite_accessory/temp_facial_hair_style = facial_hair_styles_list[f_style] if(temp_facial_hair_style && temp_facial_hair_style.secondary_theme && !temp_facial_hair_style.no_sec_colour) - dat += " Color #2 [color_square(r_facial_sec, g_facial_sec, b_facial_sec)]" + dat += " Color #2 [color_square(f_sec_colour)]" dat += "
" if(!(S.bodyflags & ALL_RPARTS)) dat += "Eyes: " - dat += "Color [color_square(r_eyes, g_eyes, b_eyes)]
" + dat += "Color [color_square(e_colour)]
" if((S.bodyflags & HAS_SKIN_COLOR) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) //admins can always fuck with this, because they are admins dat += "Body Color: " - dat += "Color [color_square(r_skin, g_skin, b_skin)]
" + dat += "Color [color_square(s_colour)]
" if(body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) dat += "Body Accessory: " @@ -1188,33 +1174,23 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts age = rand(AGE_MIN, AGE_MAX) if("hair") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox")) - r_hair = rand(0,255) - g_hair = rand(0,255) - b_hair = rand(0,255) + h_colour = rand_hex_color() if("secondary_hair") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox")) - r_hair_sec = rand(0,255) - g_hair_sec = rand(0,255) - b_hair_sec = rand(0,255) + h_sec_colour = rand_hex_color() if("h_style") h_style = random_hair_style(gender, species, robohead) if("facial") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox")) - r_facial = rand(0,255) - g_facial = rand(0,255) - b_facial = rand(0,255) + f_colour = rand_hex_color() if("secondary_facial") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Wryn", "Vulpkanin", "Vox")) - r_facial_sec = rand(0,255) - g_facial_sec = rand(0,255) - b_facial_sec = rand(0,255) + f_sec_colour = rand_hex_color() if("f_style") f_style = random_facial_hair_style(gender, species, robohead) if("headaccessory") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories. - r_headacc = rand(0,255) - g_headacc = rand(0,255) - b_headacc = rand(0,255) + hacc_colour = rand_hex_color() if("ha_style") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories. ha_style = random_head_accessory(species) @@ -1223,19 +1199,19 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts m_styles["head"] = random_marking_style("head", species, robohead, null, alt_head) if("m_head_colour") if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings. - m_colours["head"] = rgb(rand(0,255), rand(0,255), rand(0,255)) + m_colours["head"] = rand_hex_color() if("m_style_body") if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings. m_styles["body"] = random_marking_style("body", species) if("m_body_colour") if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings. - m_colours["body"] = rgb(rand(0,255), rand(0,255), rand(0,255)) + m_colours["body"] = rand_hex_color() if("m_style_tail") if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings. m_styles["tail"] = random_marking_style("tail", species, null, body_accessory) if("m_tail_colour") if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings. - m_colours["tail"] = rgb(rand(0,255), rand(0,255), rand(0,255)) + m_colours["tail"] = rand_hex_color() if("underwear") underwear = random_underwear(gender, species) ShowChoices(user) @@ -1246,17 +1222,13 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts socks = random_socks(gender, species) ShowChoices(user) if("eyes") - r_eyes = rand(0,255) - g_eyes = rand(0,255) - b_eyes = rand(0,255) + e_colour = rand_hex_color() if("s_tone") if(S.bodyflags & (HAS_SKIN_TONE|HAS_ICON_SKIN_TONE)) s_tone = random_skin_tone() if("s_color") if(S.bodyflags & HAS_SKIN_COLOR) - r_skin = rand(0,255) - g_skin = rand(0,255) - b_skin = rand(0,255) + s_colour = rand_hex_color() if("bag") backbag = pick(backbaglist) /*if("skin_style") @@ -1319,9 +1291,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts ha_style = random_head_accessory(species) else ha_style = "None" // No Vulp ears on Unathi - r_headacc = 0 - g_headacc = 0 - b_headacc = 0 + hacc_colour = rand_hex_color() if(NS.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings. m_styles["head"] = random_marking_style("head", species, robohead, null, alt_head) @@ -1361,9 +1331,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts s_tone = 0 if(!(NS.bodyflags & HAS_SKIN_COLOR)) - r_skin = 0 - g_skin = 0 - b_skin = 0 + s_colour = "#000000" alt_head = "None" //No alt heads on species that don't have them. speciesprefs = 0 //My Vox tank shouldn't change how my future Grey talks. @@ -1419,21 +1387,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("hair") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) //Species that have hair. (No HAS_HAIR flag) var/input = "Choose your character's hair colour:" - var/new_hair = input(user, input, "Character Preference", rgb(r_hair, g_hair, b_hair)) as color|null + var/new_hair = input(user, input, "Character Preference", h_colour) as color|null if(new_hair) - r_hair = color2R(new_hair) - g_hair = color2G(new_hair) - b_hair = color2B(new_hair) + h_colour = new_hair if("secondary_hair") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) var/datum/sprite_accessory/hair_style = hair_styles_list[h_style] if(hair_style.secondary_theme && !hair_style.no_sec_colour) - var/new_hair = input(user, "Choose your character's secondary hair colour:", "Character Preference", rgb(r_hair_sec, g_hair_sec, b_hair_sec)) as color|null + var/new_hair = input(user, "Choose your character's secondary hair colour:", "Character Preference", h_sec_colour) as color|null if(new_hair) - r_hair_sec = color2R(new_hair) - g_hair_sec = color2G(new_hair) - b_hair_sec = color2B(new_hair) + h_sec_colour = new_hair if("h_style") var/list/valid_hairstyles = list() @@ -1467,11 +1431,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("headaccessory") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories. var/input = "Choose the colour of your your character's head accessory:" - var/new_head_accessory = input(user, input, "Character Preference", rgb(r_headacc, g_headacc, b_headacc)) as color|null + var/new_head_accessory = input(user, input, "Character Preference", hacc_colour) as color|null if(new_head_accessory) - r_headacc = color2R(new_head_accessory) - g_headacc = color2G(new_head_accessory) - b_headacc = color2B(new_head_accessory) + hacc_colour = new_head_accessory if("ha_style") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories. @@ -1626,21 +1588,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("facial") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) //Species that have facial hair. (No HAS_HAIR_FACIAL flag) - var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", rgb(r_facial, g_facial, b_facial)) as color|null + var/new_facial = input(user, "Choose your character's facial-hair colour:", "Character Preference", f_colour) as color|null if(new_facial) - r_facial = color2R(new_facial) - g_facial = color2G(new_facial) - b_facial = color2B(new_facial) + f_colour = new_facial if("secondary_facial") if(species in list("Human", "Unathi", "Tajaran", "Skrell", "Machine", "Vulpkanin", "Vox")) var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style] if(facial_hair_style.secondary_theme && !facial_hair_style.no_sec_colour) - var/new_facial = input(user, "Choose your character's secondary facial-hair colour:", "Character Preference", rgb(r_facial_sec, g_facial_sec, b_facial_sec)) as color|null + var/new_facial = input(user, "Choose your character's secondary facial-hair colour:", "Character Preference", f_sec_colour) as color|null if(new_facial) - r_facial_sec = color2R(new_facial) - g_facial_sec = color2G(new_facial) - b_facial_sec = color2B(new_facial) + f_sec_colour = new_facial if("f_style") var/list/valid_facial_hairstyles = list() @@ -1723,11 +1681,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts socks = new_socks if("eyes") - var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", rgb(r_eyes, g_eyes, b_eyes)) as color|null + var/new_eyes = input(user, "Choose your character's eye colour:", "Character Preference", e_colour) as color|null if(new_eyes) - r_eyes = color2R(new_eyes) - g_eyes = color2G(new_eyes) - b_eyes = color2B(new_eyes) + e_colour = new_eyes if("s_tone") if(S.bodyflags & HAS_SKIN_TONE) @@ -1750,12 +1706,9 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if("skin") if((S.bodyflags & HAS_SKIN_COLOR) || body_accessory_by_species[species] || check_rights(R_ADMIN, 0, user)) - var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", rgb(r_skin, g_skin, b_skin)) as color|null + var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference", s_colour) as color|null if(new_skin) - r_skin = color2R(new_skin) - g_skin = color2G(new_skin) - b_skin = color2B(new_skin) - + s_colour = new_skin if("ooccolor") var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference", ooccolor) as color|null @@ -2124,21 +2077,13 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts //Head-specific var/obj/item/organ/external/head/H = character.get_organ("head") - H.r_hair = r_hair - H.g_hair = g_hair - H.b_hair = b_hair + H.hair_colour = h_colour - H.r_hair_sec = r_hair_sec - H.g_hair_sec = g_hair_sec - H.b_hair_sec = b_hair_sec + H.sec_hair_colour = h_sec_colour - H.r_facial = r_facial - H.g_facial = g_facial - H.b_facial = b_facial + H.facial_colour = f_colour - H.r_facial_sec = r_facial_sec - H.g_facial_sec = g_facial_sec - H.b_facial_sec = b_facial_sec + H.sec_facial_colour = f_sec_colour H.h_style = h_style H.f_style = f_style @@ -2146,9 +2091,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts H.alt_head = alt_head //End of head-specific. - character.r_skin = r_skin - character.g_skin = g_skin - character.b_skin = b_skin + character.skin_colour = s_colour character.s_tone = s_tone @@ -2192,9 +2135,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts character.socks = socks if(character.species.bodyflags & HAS_HEAD_ACCESSORY) - H.r_headacc = r_headacc - H.g_headacc = g_headacc - H.b_headacc = b_headacc + H.headacc_colour = hacc_colour H.ha_style = ha_style if(character.species.bodyflags & HAS_MARKINGS) character.m_colours = m_colours @@ -2211,7 +2152,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts message_admins("[key_name_admin(character)] has spawned with their gender as plural or neuter. Please notify coders.") character.change_gender(MALE) - character.change_eye_color(r_eyes, g_eyes, b_eyes) + character.change_eye_color(e_colour) if(disabilities & DISABILITY_FLAG_FAT && (CAN_BE_FAT in character.species.species_traits)) character.dna.SetSEState(FATBLOCK,1,1) diff --git a/code/modules/client/preference/preferences_mysql.dm b/code/modules/client/preference/preferences_mysql.dm index 579699a9414..a7c3810a40d 100644 --- a/code/modules/client/preference/preferences_mysql.dm +++ b/code/modules/client/preference/preferences_mysql.dm @@ -118,34 +118,20 @@ age, species, language, - hair_red, - hair_green, - hair_blue, - secondary_hair_red, - secondary_hair_green, - secondary_hair_blue, - facial_red, - facial_green, - facial_blue, - secondary_facial_red, - secondary_facial_green, - secondary_facial_blue, + hair_colour, + secondary_hair_colour, + facial_hair_colour, + secondary_facial_hair_colour, skin_tone, - skin_red, - skin_green, - skin_blue, + skin_colour, marking_colours, - head_accessory_red, - head_accessory_green, - head_accessory_blue, + head_accessory_colour, hair_style_name, facial_style_name, marking_styles, head_accessory_style_name, alt_head_name, - eyes_red, - eyes_green, - eyes_blue, + eye_colour, underwear, undershirt, backbag, @@ -194,61 +180,46 @@ species = query.item[6] language = query.item[7] - //colors to be consolidated into hex strings (requires some work with dna code) - r_hair = text2num(query.item[8]) - g_hair = text2num(query.item[9]) - b_hair = text2num(query.item[10]) - r_hair_sec = text2num(query.item[11]) - g_hair_sec = text2num(query.item[12]) - b_hair_sec = text2num(query.item[13]) - r_facial = text2num(query.item[14]) - g_facial = text2num(query.item[15]) - b_facial = text2num(query.item[16]) - r_facial_sec = text2num(query.item[17]) - g_facial_sec = text2num(query.item[18]) - b_facial_sec = text2num(query.item[19]) - s_tone = text2num(query.item[20]) - r_skin = text2num(query.item[21]) - g_skin = text2num(query.item[22]) - b_skin = text2num(query.item[23]) - m_colours = params2list(query.item[24]) - r_headacc = text2num(query.item[25]) - g_headacc = text2num(query.item[26]) - b_headacc = text2num(query.item[27]) - h_style = query.item[28] - f_style = query.item[29] - m_styles = params2list(query.item[30]) - ha_style = query.item[31] - alt_head = query.item[32] - r_eyes = text2num(query.item[33]) - g_eyes = text2num(query.item[34]) - b_eyes = text2num(query.item[35]) - underwear = query.item[36] - undershirt = query.item[37] - backbag = query.item[38] - b_type = query.item[39] + h_colour = query.item[8] + h_sec_colour = query.item[9] + f_colour = query.item[10] + f_sec_colour = query.item[11] + s_tone = text2num(query.item[12]) + s_colour = query.item[13] + m_colours = params2list(query.item[14]) + hacc_colour = query.item[15] + h_style = query.item[16] + f_style = query.item[17] + m_styles = params2list(query.item[18]) + ha_style = query.item[19] + alt_head = query.item[20] + e_colour = query.item[21] + underwear = query.item[22] + undershirt = query.item[23] + backbag = query.item[24] + b_type = query.item[25] //Jobs - alternate_option = text2num(query.item[40]) - job_support_high = text2num(query.item[41]) - job_support_med = text2num(query.item[42]) - job_support_low = text2num(query.item[43]) - job_medsci_high = text2num(query.item[44]) - job_medsci_med = text2num(query.item[45]) - job_medsci_low = text2num(query.item[46]) - job_engsec_high = text2num(query.item[47]) - job_engsec_med = text2num(query.item[48]) - job_engsec_low = text2num(query.item[49]) - job_karma_high = text2num(query.item[50]) - job_karma_med = text2num(query.item[51]) - job_karma_low = text2num(query.item[52]) + alternate_option = text2num(query.item[26]) + job_support_high = text2num(query.item[27]) + job_support_med = text2num(query.item[28]) + job_support_low = text2num(query.item[29]) + job_medsci_high = text2num(query.item[30]) + job_medsci_med = text2num(query.item[31]) + job_medsci_low = text2num(query.item[32]) + job_engsec_high = text2num(query.item[33]) + job_engsec_med = text2num(query.item[34]) + job_engsec_low = text2num(query.item[35]) + job_karma_high = text2num(query.item[36]) + job_karma_med = text2num(query.item[37]) + job_karma_low = text2num(query.item[38]) //Miscellaneous - flavor_text = query.item[53] - med_record = query.item[54] - sec_record = query.item[55] - gen_record = query.item[56] + flavor_text = query.item[39] + med_record = query.item[40] + sec_record = query.item[41] + gen_record = query.item[42] // Apparently, the preceding vars weren't always encoded properly... if(findtext(flavor_text, "<")) // ... so let's clumsily check for tags! flavor_text = html_encode(flavor_text) @@ -258,18 +229,18 @@ sec_record = html_encode(sec_record) if(findtext(gen_record, "<")) gen_record = html_encode(gen_record) - disabilities = text2num(query.item[57]) - player_alt_titles = params2list(query.item[58]) - organ_data = params2list(query.item[59]) - rlimb_data = params2list(query.item[60]) - nanotrasen_relation = query.item[61] - speciesprefs = text2num(query.item[62]) + disabilities = text2num(query.item[43]) + player_alt_titles = params2list(query.item[44]) + organ_data = params2list(query.item[45]) + rlimb_data = params2list(query.item[46]) + nanotrasen_relation = query.item[47] + speciesprefs = text2num(query.item[48]) //socks - socks = query.item[63] - body_accessory = query.item[64] - gear = params2list(query.item[65]) - autohiss_mode = text2num(query.item[66]) + socks = query.item[49] + body_accessory = query.item[50] + gear = params2list(query.item[51]) + autohiss_mode = text2num(query.item[52]) //Sanitize var/datum/species/SP = all_species[species] @@ -283,36 +254,22 @@ be_random_name = sanitize_integer(be_random_name, 0, 1, initial(be_random_name)) gender = sanitize_gender(gender, FALSE, !SP.has_gender) age = sanitize_integer(age, AGE_MIN, AGE_MAX, initial(age)) - r_hair = sanitize_integer(r_hair, 0, 255, initial(r_hair)) - g_hair = sanitize_integer(g_hair, 0, 255, initial(g_hair)) - b_hair = sanitize_integer(b_hair, 0, 255, initial(b_hair)) - r_hair_sec = sanitize_integer(r_hair_sec, 0, 255, initial(r_hair_sec)) - g_hair_sec = sanitize_integer(g_hair_sec, 0, 255, initial(g_hair_sec)) - b_hair_sec = sanitize_integer(b_hair_sec, 0, 255, initial(b_hair_sec)) - r_facial = sanitize_integer(r_facial, 0, 255, initial(r_facial)) - g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial)) - b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial)) - r_facial_sec = sanitize_integer(r_facial_sec, 0, 255, initial(r_facial_sec)) - g_facial_sec = sanitize_integer(g_facial_sec, 0, 255, initial(g_facial_sec)) - b_facial_sec = sanitize_integer(b_facial_sec, 0, 255, initial(b_facial_sec)) + h_colour = sanitize_hexcolor(h_colour) + h_sec_colour = sanitize_hexcolor(h_sec_colour) + f_colour = sanitize_hexcolor(f_colour) + f_sec_colour = sanitize_hexcolor(f_sec_colour) s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone)) - r_skin = sanitize_integer(r_skin, 0, 255, initial(r_skin)) - g_skin = sanitize_integer(g_skin, 0, 255, initial(g_skin)) - b_skin = sanitize_integer(b_skin, 0, 255, initial(b_skin)) + s_colour = sanitize_hexcolor(s_colour) for(var/marking_location in m_colours) m_colours[marking_location] = sanitize_hexcolor(m_colours[marking_location], DEFAULT_MARKING_COLOURS[marking_location]) - r_headacc = sanitize_integer(r_headacc, 0, 255, initial(r_headacc)) - g_headacc = sanitize_integer(g_headacc, 0, 255, initial(g_headacc)) - b_headacc = sanitize_integer(b_headacc, 0, 255, initial(b_headacc)) + hacc_colour = sanitize_hexcolor(hacc_colour) h_style = sanitize_inlist(h_style, hair_styles_list, initial(h_style)) f_style = sanitize_inlist(f_style, facial_hair_styles_list, initial(f_style)) for(var/marking_location in m_styles) m_styles[marking_location] = sanitize_inlist(m_styles[marking_location], marking_styles_list, DEFAULT_MARKING_STYLES[marking_location]) ha_style = sanitize_inlist(ha_style, head_accessory_styles_list, initial(ha_style)) alt_head = sanitize_inlist(alt_head, alt_heads_list, initial(alt_head)) - r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes)) - g_eyes = sanitize_integer(g_eyes, 0, 255, initial(g_eyes)) - b_eyes = sanitize_integer(b_eyes, 0, 255, initial(b_eyes)) + e_colour = sanitize_hexcolor(e_colour) underwear = sanitize_text(underwear, initial(underwear)) undershirt = sanitize_text(undershirt, initial(undershirt)) backbag = sanitize_text(backbag, initial(backbag)) @@ -373,34 +330,20 @@ age='[age]', species='[sanitizeSQL(species)]', language='[sanitizeSQL(language)]', - hair_red='[r_hair]', - hair_green='[g_hair]', - hair_blue='[b_hair]', - secondary_hair_red='[r_hair_sec]', - secondary_hair_green='[g_hair_sec]', - secondary_hair_blue='[b_hair_sec]', - facial_red='[r_facial]', - facial_green='[g_facial]', - facial_blue='[b_facial]', - secondary_facial_red='[r_facial_sec]', - secondary_facial_green='[g_facial_sec]', - secondary_facial_blue='[b_facial_sec]', + hair_colour='[h_colour]', + secondary_hair_colour='[h_sec_colour]', + facial_hair_colour='[f_colour]', + secondary_facial_hair_colour='[f_sec_colour]', skin_tone='[s_tone]', - skin_red='[r_skin]', - skin_green='[g_skin]', - skin_blue='[b_skin]', + skin_colour='[s_colour]', marking_colours='[sanitizeSQL(markingcolourslist)]', - head_accessory_red='[r_headacc]', - head_accessory_green='[g_headacc]', - head_accessory_blue='[b_headacc]', + head_accessory_colour='[hacc_colour]', hair_style_name='[sanitizeSQL(h_style)]', facial_style_name='[sanitizeSQL(f_style)]', marking_styles='[sanitizeSQL(markingstyleslist)]', head_accessory_style_name='[sanitizeSQL(ha_style)]', alt_head_name='[sanitizeSQL(alt_head)]', - eyes_red='[r_eyes]', - eyes_green='[g_eyes]', - eyes_blue='[b_eyes]', + eye_colour='[e_colour]', underwear='[underwear]', undershirt='[undershirt]', backbag='[backbag]', @@ -446,19 +389,17 @@ var/DBQuery/query = dbcon.NewQuery({" INSERT INTO [format_table_name("characters")] (ckey, slot, OOC_Notes, real_name, name_is_always_random, gender, age, species, language, - hair_red, hair_green, hair_blue, - secondary_hair_red, secondary_hair_green, secondary_hair_blue, - facial_red, facial_green, facial_blue, - secondary_facial_red, secondary_facial_green, secondary_facial_blue, - skin_tone, skin_red, skin_green, skin_blue, + hair_colour, secondary_hair_colour, + facial_hair_colour, secondary_facial_hair_colour, + skin_tone, skin_colour, marking_colours, - head_accessory_red, head_accessory_green, head_accessory_blue, + head_accessory_colour, hair_style_name, facial_style_name, marking_styles, head_accessory_style_name, alt_head_name, - eyes_red, eyes_green, eyes_blue, + eye_colour, underwear, undershirt, backbag, b_type, alternate_option, job_support_high, job_support_med, job_support_low, @@ -476,19 +417,17 @@ VALUES ('[C.ckey]', '[default_slot]', '[sanitizeSQL(metadata)]', '[sanitizeSQL(real_name)]', '[be_random_name]','[gender]', '[age]', '[sanitizeSQL(species)]', '[sanitizeSQL(language)]', - '[r_hair]', '[g_hair]', '[b_hair]', - '[r_hair_sec]', '[g_hair_sec]', '[b_hair_sec]', - '[r_facial]', '[g_facial]', '[b_facial]', - '[r_facial_sec]', '[g_facial_sec]', '[b_facial_sec]', - '[s_tone]', '[r_skin]', '[g_skin]', '[b_skin]', + '[h_colour]', '[h_sec_colour]', + '[f_colour]', '[f_sec_colour]', + '[s_tone]', '[s_colour]', '[sanitizeSQL(markingcolourslist)]', - '[r_headacc]', '[g_headacc]', '[b_headacc]', + '[hacc_colour]', '[sanitizeSQL(h_style)]', '[sanitizeSQL(f_style)]', '[sanitizeSQL(markingstyleslist)]', '[sanitizeSQL(ha_style)]', '[sanitizeSQL(alt_head)]', - '[r_eyes]', '[g_eyes]', '[b_eyes]', + '[e_colour]', '[underwear]', '[undershirt]', '[backbag]', '[b_type]', '[alternate_option]', '[job_support_high]', '[job_support_med]', '[job_support_low]', diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index ee0610471c8..ab42d17e469 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -184,14 +184,10 @@ var/obj/item/organ/external/head/head_organ = user.get_organ("head") mob = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kitty") -// mob2 = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kitty2") - Commented out because it seemingly does nothing. - mob.Blend(rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair), ICON_ADD) -// mob2.Blend(rgb(user.r_hair, user.g_hair, user.b_hair), ICON_ADD) - Commented out because it seemingly does nothing. + mob.Blend(head_organ.hair_colour, ICON_ADD) var/icon/earbit = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kittyinner") -// var/icon/earbit2 = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kittyinner2") - Commented out because it seemingly does nothing. mob.Blend(earbit, ICON_OVERLAY) -// mob2.Blend(earbit2, ICON_OVERLAY) - Commented out because it seemingly does nothing. icon_override = mob @@ -210,7 +206,7 @@ if(!istype(user)) return var/obj/item/organ/external/head/head_organ = user.get_organ("head") mob = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "mousey") - mob.Blend(rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair), ICON_ADD) + mob.Blend(head_organ.hair_colour, ICON_ADD) var/icon/earbit = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "mouseyinner") mob.Blend(earbit, ICON_OVERLAY) diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index e258962f784..3cb6cec5720 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -210,19 +210,14 @@ H.ha_style = "None" update_head_accessory() -/mob/living/carbon/human/proc/change_eye_color(var/red, var/green, var/blue, update_dna = 1) +/mob/living/carbon/human/proc/change_eye_color(var/colour = "#000000", update_dna = 1) // Update the main DNA datum, then sync the change across the organs var/obj/item/organ/internal/eyes/eyes_organ = get_int_organ(/obj/item/organ/internal/eyes) if(eyes_organ) - var/eyes_red = eyes_organ.eye_colour[1] - var/eyes_green = eyes_organ.eye_colour[2] - var/eyes_blue = eyes_organ.eye_colour[3] - if(red == eyes_red && green == eyes_green && blue == eyes_blue) + if(colour == eyes_organ.eye_colour) return - eyes_organ.eye_colour[1] = red - eyes_organ.eye_colour[2] = green - eyes_organ.eye_colour[3] = blue + eyes_organ.eye_colour = colour dna.eye_color_to_dna(eyes_organ) eyes_organ.set_dna(dna) @@ -233,68 +228,58 @@ update_body() return 1 -/mob/living/carbon/human/proc/change_hair_color(var/red, var/green, var/blue, var/secondary) +/mob/living/carbon/human/proc/change_hair_color(var/colour = "#000000", var/secondary) var/obj/item/organ/external/head/H = get_organ("head") if(!H) return if(!secondary) - if(red == H.r_hair && green == H.g_hair && blue == H.b_hair) + if(colour == H.hair_colour) return - H.r_hair = red - H.g_hair = green - H.b_hair = blue + H.hair_colour = colour else - if(red == H.r_hair_sec && green == H.g_hair_sec && blue == H.b_hair_sec) + if(colour == H.sec_hair_colour) return - H.r_hair_sec = red - H.g_hair_sec = green - H.b_hair_sec = blue + H.sec_hair_colour = colour update_hair() return 1 -/mob/living/carbon/human/proc/change_facial_hair_color(var/red, var/green, var/blue, var/secondary) +/mob/living/carbon/human/proc/change_facial_hair_color(var/colour = "#000000", var/secondary) var/obj/item/organ/external/head/H = get_organ("head") if(!H) return if(!secondary) - if(red == H.r_facial && green == H.g_facial && blue == H.b_facial) + if(colour == H.facial_colour) return - H.r_facial = red - H.g_facial = green - H.b_facial = blue + H.facial_colour = colour else - if(red == H.r_facial_sec && green == H.g_facial_sec && blue == H.b_facial_sec) + if(colour == H.sec_facial_colour) return - H.r_facial_sec = red - H.g_facial_sec = green - H.b_facial_sec = blue + H.sec_facial_colour = colour update_fhair() return 1 -/mob/living/carbon/human/proc/change_head_accessory_color(var/red, var/green, var/blue) +/mob/living/carbon/human/proc/change_head_accessory_color(var/colour = "#000000") var/obj/item/organ/external/head/H = get_organ("head") if(!H) return - if(red == H.r_headacc && green == H.g_headacc && blue == H.b_headacc) + if(colour == H.headacc_colour) return - H.r_headacc = red - H.g_headacc = green - H.b_headacc = blue + H.headacc_colour = colour update_head_accessory() return 1 -/mob/living/carbon/human/proc/change_marking_color(var/colour, var/location = "body") +/mob/living/carbon/human/proc/change_marking_color(var/colour = "#000000", var/location = "body") if(colour == m_colours[location]) return @@ -307,13 +292,11 @@ return 1 -/mob/living/carbon/human/proc/change_skin_color(var/red, var/green, var/blue) - if(red == r_skin && green == g_skin && blue == b_skin || !(species.bodyflags & HAS_SKIN_COLOR)) +/mob/living/carbon/human/proc/change_skin_color(var/colour = "#000000") + if(colour == skin_colour || !(species.bodyflags & HAS_SKIN_COLOR)) return - r_skin = red - g_skin = green - b_skin = blue + skin_colour = colour force_update_limbs() update_body() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a97edcec455..ebc874912d4 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1433,13 +1433,9 @@ if(species.base_color && default_colour) //Apply colour. - r_skin = color2R(species.base_color) - g_skin = color2G(species.base_color) - b_skin = color2B(species.base_color) + skin_colour = species.base_color else - r_skin = 0 - g_skin = 0 - b_skin = 0 + skin_colour = "#000000" if(!(species.bodyflags & HAS_SKIN_TONE)) s_tone = 0 @@ -1463,29 +1459,17 @@ if(species.default_hair_colour) //Apply colour. - H.r_hair = color2R(species.default_hair_colour) - H.g_hair = color2G(species.default_hair_colour) - H.b_hair = color2B(species.default_hair_colour) + H.hair_colour = species.default_hair_colour else - H.r_hair = 0 - H.g_hair = 0 - H.b_hair = 0 + H.hair_colour = "#000000" if(species.default_fhair_colour) - H.r_facial = color2R(species.default_fhair_colour) - H.g_facial = color2G(species.default_fhair_colour) - H.b_facial = color2B(species.default_fhair_colour) + H.facial_colour = species.default_fhair_colour else - H.r_facial = 0 - H.g_facial = 0 - H.b_facial = 0 + H.facial_colour = "#000000" if(species.default_headacc_colour) - H.r_headacc = color2R(species.default_headacc_colour) - H.g_headacc = color2G(species.default_headacc_colour) - H.b_headacc = color2B(species.default_headacc_colour) + H.headacc_colour = species.default_headacc_colour else - H.r_headacc = 0 - H.g_headacc = 0 - H.b_headacc = 0 + H.headacc_colour = "#000000" m_styles = DEFAULT_MARKING_STYLES //Wipes out markings, setting them all to "None". m_colours = DEFAULT_MARKING_COLOURS //Defaults colour to #00000 for all markings. diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index e7f3861eec1..df310f2149c 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -10,9 +10,7 @@ var/global/default_martial_art = new/datum/martial_art var/s_tone = 0 //Skin tone //Skin colour - var/r_skin = 0 - var/g_skin = 0 - var/b_skin = 0 + var/skin_colour = "#000000" var/lip_style = null //no lipstick by default- arguably misleading, as it could be used for general makeup var/lip_color = "white" diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm index 1841ae50279..6944e42b80e 100644 --- a/code/modules/mob/living/carbon/human/species/station.dm +++ b/code/modules/mob/living/carbon/human/species/station.dm @@ -581,11 +581,8 @@ if((H in recolor_list) && H.reagents.total_volume > SLIMEPERSON_COLOR_SHIFT_TRIGGER) var/blood_amount = H.blood_volume var/r_color = mix_color_from_reagents(H.reagents.reagent_list) - var/new_body_color = BlendRGB(r_color, rgb(H.r_skin, H.g_skin, H.b_skin), (blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)/((blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)+(H.reagents.total_volume))) - var/list/new_color_list = ReadRGB(new_body_color) - H.r_skin = new_color_list[1] - H.g_skin = new_color_list[2] - H.b_skin = new_color_list[3] + var/new_body_color = BlendRGB(r_color, H.skin_colour, (blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)/((blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)+(H.reagents.total_volume))) + H.skin_colour = new_body_color if(world.time % SLIMEPERSON_ICON_UPDATE_PERIOD > SLIMEPERSON_ICON_UPDATE_PERIOD - 20) // The 20 is because this gets called every 2 seconds, from the mob controller for(var/organname in H.bodyparts_by_name) var/obj/item/organ/external/E = H.bodyparts_by_name[organname] diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 2d3fab0b2a6..90002196c0f 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -228,7 +228,7 @@ var/global/list/damage_icon_parts = list() var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes) if(eyes) - icon_key += "[rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3])]" + icon_key += "[eyes.eye_colour]" else icon_key += "#000000" @@ -248,7 +248,7 @@ var/global/list/damage_icon_parts = list() icon_key += "[part.dna.GetUIState(DNA_UI_GENDER)]" icon_key += "[part.dna.GetUIValue(DNA_UI_SKIN_TONE)]" if(part.s_col) - icon_key += "[rgb(part.s_col[1], part.s_col[2], part.s_col[3])]" + icon_key += "[part.s_col]" if(part.s_tone) icon_key += "[part.s_tone]" @@ -408,7 +408,7 @@ var/global/list/damage_icon_parts = list() if(head_organ.species.name in head_accessory_style.species_allowed) var/icon/head_accessory_s = new/icon("icon" = head_accessory_style.icon, "icon_state" = "[head_accessory_style.icon_state]_s") if(head_accessory_style.do_colouration) - head_accessory_s.Blend(rgb(head_organ.r_headacc, head_organ.g_headacc, head_organ.b_headacc), ICON_ADD) + head_accessory_s.Blend(head_organ.headacc_colour, ICON_ADD) head_accessory_standing = head_accessory_s //head_accessory_standing.Blend(head_accessory_s, ICON_OVERLAY) //Having it this way preserves animations. Useful for animated antennae. @@ -449,14 +449,14 @@ var/global/list/damage_icon_parts = list() if((head_organ.species.name in hair_style.species_allowed) || (head_organ.species.bodyflags & ALL_RPARTS)) //If the head's species is in the list of allowed species for the hairstyle, or the head's species is one flagged to have bodies comprised wholly of cybernetics... var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") if(head_organ.species.name == "Slime People") // I am el worstos - hair_s.Blend(rgb(r_skin, g_skin, b_skin, 160), ICON_AND) + hair_s.Blend("[skin_colour]A0", ICON_AND) else if(hair_style.do_colouration) - hair_s.Blend(rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair), ICON_ADD) + hair_s.Blend(head_organ.hair_colour, ICON_ADD) if(hair_style.secondary_theme) var/icon/hair_secondary_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[hair_style.secondary_theme]_s") if(!hair_style.no_sec_colour) - hair_secondary_s.Blend(rgb(head_organ.r_hair_sec, head_organ.g_hair_sec, head_organ.b_hair_sec), ICON_ADD) + hair_secondary_s.Blend(head_organ.sec_hair_colour, ICON_ADD) hair_s.Blend(hair_secondary_s, ICON_OVERLAY) hair_standing = hair_s //hair_standing.Blend(hair_s, ICON_OVERLAY) @@ -495,14 +495,14 @@ var/global/list/damage_icon_parts = list() if((head_organ.species.name in facial_hair_style.species_allowed) || (head_organ.species.bodyflags & ALL_RPARTS)) //If the head's species is in the list of allowed species for the hairstyle, or the head's species is one flagged to have bodies comprised wholly of cybernetics... var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") if(head_organ.species.name == "Slime People") // I am el worstos - facial_s.Blend(rgb(r_skin, g_skin, b_skin, 160), ICON_AND) + facial_s.Blend("[skin_colour]A0", ICON_AND) else if(facial_hair_style.do_colouration) - facial_s.Blend(rgb(head_organ.r_facial, head_organ.g_facial, head_organ.b_facial), ICON_ADD) + facial_s.Blend(head_organ.facial_colour, ICON_ADD) if(facial_hair_style.secondary_theme) var/icon/facial_secondary_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_[facial_hair_style.secondary_theme]_s") if(!facial_hair_style.no_sec_colour) - facial_secondary_s.Blend(rgb(head_organ.r_facial_sec, head_organ.g_facial_sec, head_organ.b_facial_sec), ICON_ADD) + facial_secondary_s.Blend(head_organ.sec_facial_colour, ICON_ADD) facial_s.Blend(facial_secondary_s, ICON_OVERLAY) face_standing.Blend(facial_s, ICON_OVERLAY) @@ -1168,7 +1168,7 @@ var/global/list/damage_icon_parts = list() if(body_accessory.try_restrictions(src)) var/icon/accessory_s = new/icon("icon" = body_accessory.icon, "icon_state" = body_accessory.icon_state) if(species.bodyflags & HAS_SKIN_COLOR) - accessory_s.Blend(rgb(r_skin, g_skin, b_skin), body_accessory.blend_mode) + accessory_s.Blend(skin_colour, body_accessory.blend_mode) if(tail_marking_icon && (body_accessory.name in tail_marking_style.tails_allowed)) accessory_s.Blend(tail_marking_icon, ICON_OVERLAY) if((!body_accessory || istype(body_accessory, /datum/body_accessory/tail)) && species.bodyflags & TAIL_OVERLAPPED) // If the player has a species whose tail is overlapped by limbs... (having a non-tail body accessory like the snake body will override this) @@ -1193,7 +1193,7 @@ var/global/list/damage_icon_parts = list() if(!wear_suit || !(wear_suit.flags_inv & HIDETAIL) && !istype(wear_suit, /obj/item/clothing/suit/space)) var/icon/tail_s = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[tail]_s") if(species.bodyflags & HAS_SKIN_COLOR) - tail_s.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + tail_s.Blend(skin_colour, ICON_ADD) if(tail_marking_icon && !tail_marking_style.tails_allowed) tail_s.Blend(tail_marking_icon, ICON_OVERLAY) if((!body_accessory || istype(body_accessory, /datum/body_accessory/tail)) && species.bodyflags & TAIL_OVERLAPPED) // If the player has a species whose tail is overlapped by limbs... (having a non-tail body accessory like the snake body will override this) @@ -1234,7 +1234,7 @@ var/global/list/damage_icon_parts = list() if(body_accessory) var/icon/accessory_s = new/icon("icon" = body_accessory.get_animated_icon(), "icon_state" = body_accessory.get_animated_icon_state()) if(species.bodyflags & HAS_SKIN_COLOR) - accessory_s.Blend(rgb(r_skin, g_skin, b_skin), body_accessory.blend_mode) + accessory_s.Blend(skin_colour, body_accessory.blend_mode) if(tail_marking_icon && (body_accessory.name in tail_marking_style.tails_allowed)) accessory_s.Blend(tail_marking_icon, ICON_OVERLAY) if((!body_accessory || istype(body_accessory, /datum/body_accessory/tail)) && species.bodyflags & TAIL_OVERLAPPED) // If the player has a species whose tail is overlapped by limbs... (having a non-tail body accessory like the snake body will override this) @@ -1261,7 +1261,7 @@ var/global/list/damage_icon_parts = list() else if(tail && species.bodyflags & HAS_TAIL) var/icon/tailw_s = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[tail]w_s") if(species.bodyflags & HAS_SKIN_COLOR) - tailw_s.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + tailw_s.Blend(skin_colour, ICON_ADD) if(tail_marking_icon && !tail_marking_style.tails_allowed) tailw_s.Blend(tail_marking_icon, ICON_OVERLAY) if((!body_accessory || istype(body_accessory, /datum/body_accessory/tail)) && species.bodyflags & TAIL_OVERLAPPED) // If the player has a species whose tail is overlapped by limbs... (having a non-tail body accessory like the snake body will override this) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 75f1872fdad..a1ee93e986a 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -30,22 +30,16 @@ randomize_hair_color("facial") if(S.bodyflags & HAS_HEAD_ACCESSORY) ha_style = random_head_accessory(species) - var/list/colours = randomize_skin_color(1) - r_headacc = colours["red"] - g_headacc = colours["green"] - b_headacc = colours["blue"] + hacc_colour = randomize_skin_color(1) if(S.bodyflags & HAS_HEAD_MARKINGS) m_styles["head"] = random_marking_style("head", species, robohead, null, alt_head) - var/list/colours = randomize_skin_color(1) - m_colours["head"] = rgb(colours["red"], colours["green"], colours["blue"]) + m_colours["head"] = randomize_skin_color(1) if(S.bodyflags & HAS_BODY_MARKINGS) m_styles["body"] = random_marking_style("body", species) - var/list/colours = randomize_skin_color(1) - m_colours["body"] = rgb(colours["red"], colours["green"], colours["blue"]) + m_colours["body"] = randomize_skin_color(1) if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings. m_styles["tail"] = random_marking_style("tail", species, null, body_accessory) - var/list/colours = randomize_skin_color(1) - m_colours["tail"] = rgb(colours["red"], colours["green"], colours["blue"]) + m_colours["tail"] = randomize_skin_color(1) if(!(S.bodyflags & ALL_RPARTS)) randomize_eyes_color() if(S.bodyflags & HAS_SKIN_COLOR) @@ -56,9 +50,7 @@ /datum/preferences/proc/randomize_hair_color(var/target = "hair") if(prob (75) && target == "facial") // Chance to inherit hair color - r_facial = r_hair - g_facial = g_hair - b_facial = b_hair + f_colour = h_colour return var/red @@ -106,13 +98,9 @@ switch(target) if("hair") - r_hair = red - g_hair = green - b_hair = blue + h_colour = rgb(red, green, blue) if("facial") - r_facial = red - g_facial = green - b_facial = blue + f_colour = rgb(red, green, blue) /datum/preferences/proc/randomize_eyes_color() var/red @@ -158,11 +146,9 @@ green = max(min(green + rand (-25, 25), 255), 0) blue = max(min(blue + rand (-25, 25), 255), 0) - r_eyes = red - g_eyes = green - b_eyes = blue + e_colour = rgb(red, green, blue) -/datum/preferences/proc/randomize_skin_color(var/pass_to_list) +/datum/preferences/proc/randomize_skin_color(var/pass_on) var/red var/green var/blue @@ -206,17 +192,10 @@ green = max(min(green + rand (-25, 25), 255), 0) blue = max(min(blue + rand (-25, 25), 255), 0) - if(pass_to_list) - var/list/colours = list( - "red" = red, - "blue" = blue, - "green" = green - ) - return colours + if(pass_on) + return rgb(red, green, blue) else - r_skin = red - g_skin = green - b_skin = blue + s_colour = rgb(red, green, blue) /datum/preferences/proc/blend_backpack(var/icon/clothes_s,var/backbag,var/satchel,var/backpack="backpack") switch(backbag) @@ -284,7 +263,7 @@ // Skin color if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR)) - preview_icon.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + preview_icon.Blend(s_colour, ICON_ADD) // Skin tone if(current_species && (current_species.bodyflags & HAS_SKIN_TONE)) @@ -325,7 +304,7 @@ temp.Shift(NORTH, tail_shift_y) if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR)) - temp.Blend(rgb(r_skin, g_skin, b_skin), blend_mode) + temp.Blend(s_colour, blend_mode) if(current_species && (current_species.bodyflags & HAS_TAIL_MARKINGS)) var/tail_marking = m_styles["tail"] @@ -358,7 +337,7 @@ var/icon/face_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = "bald_s") if(!(current_species.bodyflags & NO_EYES)) var/icon/eyes_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = current_species ? current_species.eyes : "eyes_s") - eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD) + eyes_s.Blend(e_colour, ICON_ADD) face_s.Blend(eyes_s, ICON_OVERLAY) @@ -366,14 +345,14 @@ if(hair_style) var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") if(current_species.name == "Slime People") // whee I am part of the problem - hair_s.Blend(rgb(r_skin, g_skin, b_skin, 160), ICON_ADD) + hair_s.Blend("[s_colour]A0", ICON_ADD) else - hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + hair_s.Blend(h_colour, ICON_ADD) if(hair_style.secondary_theme) var/icon/hair_secondary_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[hair_style.secondary_theme]_s") if(!hair_style.no_sec_colour) - hair_secondary_s.Blend(rgb(r_hair_sec, g_hair_sec, b_hair_sec), ICON_ADD) + hair_secondary_s.Blend(h_sec_colour, ICON_ADD) hair_s.Blend(hair_secondary_s, ICON_OVERLAY) face_s.Blend(hair_s, ICON_OVERLAY) @@ -383,21 +362,21 @@ var/datum/sprite_accessory/head_accessory_style = head_accessory_styles_list[ha_style] if(head_accessory_style && head_accessory_style.species_allowed) var/icon/head_accessory_s = new/icon("icon" = head_accessory_style.icon, "icon_state" = "[head_accessory_style.icon_state]_s") - head_accessory_s.Blend(rgb(r_headacc, g_headacc, b_headacc), ICON_ADD) + head_accessory_s.Blend(hacc_colour, ICON_ADD) face_s.Blend(head_accessory_s, ICON_OVERLAY) var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style] if(facial_hair_style && facial_hair_style.species_allowed) var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") if(current_species.name == "Slime People") // whee I am part of the problem - facial_s.Blend(rgb(r_skin, g_skin, b_skin, 160), ICON_ADD) + facial_s.Blend("[s_colour]A0", ICON_ADD) else - facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + facial_s.Blend(f_colour, ICON_ADD) if(facial_hair_style.secondary_theme) var/icon/facial_secondary_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_[facial_hair_style.secondary_theme]_s") if(!facial_hair_style.no_sec_colour) - facial_secondary_s.Blend(rgb(r_facial_sec, g_facial_sec, b_facial_sec), ICON_ADD) + facial_secondary_s.Blend(f_sec_colour, ICON_ADD) facial_s.Blend(facial_secondary_s, ICON_OVERLAY) face_s.Blend(facial_s, ICON_OVERLAY) diff --git a/code/modules/nano/modules/human_appearance.dm b/code/modules/nano/modules/human_appearance.dm index 95738cd6354..41eadfc87aa 100644 --- a/code/modules/nano/modules/human_appearance.dm +++ b/code/modules/nano/modules/human_appearance.dm @@ -67,14 +67,10 @@ return owner.change_skin_tone(new_s_tone) if(href_list["skin_color"]) if(can_change_skin_color()) - var/new_skin = input(usr, "Choose your character's skin colour: ", "Skin Color", rgb(owner.r_skin, owner.g_skin, owner.b_skin)) as color|null - if(new_skin && can_still_topic(state)) - var/r_skin = color2R(new_skin) - var/g_skin = color2G(new_skin) - var/b_skin = color2B(new_skin) - if(owner.change_skin_color(r_skin, g_skin, b_skin)) - update_dna() - return 1 + var/new_skin = input(usr, "Choose your character's skin colour: ", "Skin Color", owner.skin_colour) as color|null + if(new_skin && can_still_topic(state) && owner.change_skin_color(new_skin)) + update_dna() + return 1 if(href_list["hair"]) if(can_change(APPEARANCE_HAIR) && (href_list["hair"] in valid_hairstyles)) if(owner.change_hair(href_list["hair"])) @@ -82,24 +78,16 @@ return 1 if(href_list["hair_color"]) if(can_change(APPEARANCE_HAIR_COLOR)) - var/new_hair = input("Please select hair color.", "Hair Color", rgb(head_organ.r_hair, head_organ.g_hair, head_organ.b_hair)) as color|null - if(new_hair && can_still_topic(state)) - var/r_hair = color2R(new_hair) - var/g_hair = color2G(new_hair) - var/b_hair = color2B(new_hair) - if(owner.change_hair_color(r_hair, g_hair, b_hair)) - update_dna() - return 1 + var/new_hair = input("Please select hair color.", "Hair Color", head_organ.hair_colour) as color|null + if(new_hair && can_still_topic(state) && owner.change_hair_color(new_hair)) + update_dna() + return 1 if(href_list["secondary_hair_color"]) if(can_change(APPEARANCE_SECONDARY_HAIR_COLOR)) - var/new_hair = input("Please select secondary hair color.", "Secondary Hair Color", rgb(head_organ.r_hair_sec, head_organ.g_hair_sec, head_organ.b_hair_sec)) as color|null - if(new_hair && can_still_topic(state)) - var/r_hair_sec = color2R(new_hair) - var/g_hair_sec = color2G(new_hair) - var/b_hair_sec = color2B(new_hair) - if(owner.change_hair_color(r_hair_sec, g_hair_sec, b_hair_sec, 1)) - update_dna() - return 1 + var/new_hair = input("Please select secondary hair color.", "Secondary Hair Color", head_organ.sec_hair_colour) as color|null + if(new_hair && can_still_topic(state) && owner.change_hair_color(new_hair, 1)) + update_dna() + return 1 if(href_list["facial_hair"]) if(can_change(APPEARANCE_FACIAL_HAIR) && (href_list["facial_hair"] in valid_facial_hairstyles)) if(owner.change_facial_hair(href_list["facial_hair"])) @@ -107,42 +95,23 @@ return 1 if(href_list["facial_hair_color"]) if(can_change(APPEARANCE_FACIAL_HAIR_COLOR)) - var/new_facial = input("Please select facial hair color.", "Facial Hair Color", rgb(head_organ.r_facial, head_organ.g_facial, head_organ.b_facial)) as color|null - if(new_facial && can_still_topic(state)) - var/r_facial = color2R(new_facial) - var/g_facial = color2G(new_facial) - var/b_facial = color2B(new_facial) - if(owner.change_facial_hair_color(r_facial, g_facial, b_facial)) - update_dna() - return 1 + var/new_facial = input("Please select facial hair color.", "Facial Hair Color", head_organ.facial_colour) as color|null + if(new_facial && can_still_topic(state) && owner.change_facial_hair_color(new_facial)) + update_dna() + return 1 if(href_list["secondary_facial_hair_color"]) if(can_change(APPEARANCE_SECONDARY_FACIAL_HAIR_COLOR)) - var/new_facial = input("Please select secondary facial hair color.", "Secondary Facial Hair Color", rgb(head_organ.r_facial_sec, head_organ.g_facial_sec, head_organ.b_facial_sec)) as color|null - if(new_facial && can_still_topic(state)) - var/r_facial_sec = color2R(new_facial) - var/g_facial_sec = color2G(new_facial) - var/b_facial_sec = color2B(new_facial) - if(owner.change_facial_hair_color(r_facial_sec, g_facial_sec, b_facial_sec, 1)) - update_dna() - return 1 + var/new_facial = input("Please select secondary facial hair color.", "Secondary Facial Hair Color", head_organ.sec_facial_colour) as color|null + if(new_facial && can_still_topic(state) && owner.change_facial_hair_color(new_facial, 1)) + update_dna() + return 1 if(href_list["eye_color"]) if(can_change(APPEARANCE_EYE_COLOR)) var/obj/item/organ/internal/eyes/eyes_organ = owner.get_int_organ(/obj/item/organ/internal/eyes) - var/eyes_red = 0 - var/eyes_green = 0 - var/eyes_blue = 0 - if(eyes_organ) - eyes_red = eyes_organ.eye_colour[1] - eyes_green = eyes_organ.eye_colour[2] - eyes_blue = eyes_organ.eye_colour[3] - var/new_eyes = input("Please select eye color.", "Eye Color", rgb(eyes_red, eyes_green, eyes_blue)) as color|null - if(new_eyes && can_still_topic(state)) - var/r_eyes = color2R(new_eyes) - var/g_eyes = color2G(new_eyes) - var/b_eyes = color2B(new_eyes) - if(owner.change_eye_color(r_eyes, g_eyes, b_eyes)) - update_dna() - return 1 + var/new_eyes = input("Please select eye color.", "Eye Color", eyes_organ.eye_colour) as color|null + if(new_eyes && can_still_topic(state) && owner.change_eye_color(new_eyes)) + update_dna() + return 1 if(href_list["head_accessory"]) if(can_change_head_accessory() && (href_list["head_accessory"] in valid_head_accessories)) if(owner.change_head_accessory(href_list["head_accessory"])) @@ -150,14 +119,10 @@ return 1 if(href_list["head_accessory_color"]) if(can_change_head_accessory()) - var/new_head_accessory = input("Please select head accessory color.", "Head Accessory Color", rgb(head_organ.r_headacc, head_organ.g_headacc, head_organ.b_headacc)) as color|null - if(new_head_accessory && can_still_topic(state)) - var/r_headacc = color2R(new_head_accessory) - var/g_headacc = color2G(new_head_accessory) - var/b_headacc = color2B(new_head_accessory) - if(owner.change_head_accessory_color(r_headacc, g_headacc, b_headacc)) - update_dna() - return 1 + var/new_head_accessory = input("Please select head accessory color.", "Head Accessory Color", head_organ.headacc_colour) as color|null + if(new_head_accessory && can_still_topic(state) && owner.change_head_accessory_color(new_head_accessory)) + update_dna() + return 1 if(href_list["head_marking"]) if(can_change_markings("head") && (href_list["head_marking"] in valid_head_marking_styles)) if(owner.change_markings(href_list["head_marking"], "head")) @@ -166,10 +131,9 @@ if(href_list["head_marking_color"]) if(can_change_markings("head")) var/new_markings = input("Please select head marking color.", "Marking Color", owner.m_colours["head"]) as color|null - if(new_markings && can_still_topic(state)) - if(owner.change_marking_color(new_markings, "head")) - update_dna() - return 1 + if(new_markings && can_still_topic(state) && owner.change_marking_color(new_markings, "head")) + update_dna() + return 1 if(href_list["body_marking"]) if(can_change_markings("body") && (href_list["body_marking"] in valid_body_marking_styles)) if(owner.change_markings(href_list["body_marking"], "body")) @@ -178,10 +142,9 @@ if(href_list["body_marking_color"]) if(can_change_markings("body")) var/new_markings = input("Please select body marking color.", "Marking Color", owner.m_colours["body"]) as color|null - if(new_markings && can_still_topic(state)) - if(owner.change_marking_color(new_markings, "body")) - update_dna() - return 1 + if(new_markings && can_still_topic(state) && owner.change_marking_color(new_markings, "body")) + update_dna() + return 1 if(href_list["tail_marking"]) if(can_change_markings("tail") && (href_list["tail_marking"] in valid_tail_marking_styles)) if(owner.change_markings(href_list["tail_marking"], "tail")) @@ -190,10 +153,9 @@ if(href_list["tail_marking_color"]) if(can_change_markings("tail")) var/new_markings = input("Please select tail marking color.", "Marking Color", owner.m_colours["tail"]) as color|null - if(new_markings && can_still_topic(state)) - if(owner.change_marking_color(new_markings, "tail")) - update_dna() - return 1 + if(new_markings && can_still_topic(state) && owner.change_marking_color(new_markings, "tail")) + update_dna() + return 1 if(href_list["body_accessory"]) if(can_change_body_accessory() && (href_list["body_accessory"] in valid_body_accessories)) if(owner.change_body_accessory(href_list["body_accessory"])) diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index 76bb9c7fc7b..87cbcd40a0f 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -275,12 +275,10 @@ if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head_organ = H.get_organ("head") - head_organ.r_facial = rand(0,255) - head_organ.g_facial = rand(0,255) - head_organ.b_facial = rand(0,255) - head_organ.r_hair = rand(0,255) - head_organ.g_hair = rand(0,255) - head_organ.b_hair = rand(0,255) + head_organ.facial_colour = rand_hex_color() + head_organ.sec_facial_colour = rand_hex_color() + head_organ.hair_colour = rand_hex_color() + head_organ.sec_hair_colour = rand_hex_color() H.update_hair() H.update_fhair() ..() diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm index 1e419fb1b2b..67f33c4989d 100644 --- a/code/modules/surgery/organs/augments_eyes.dm +++ b/code/modules/surgery/organs/augments_eyes.dm @@ -10,8 +10,8 @@ var/vision_flags = 0 var/dark_view = 0 var/see_invisible = 0 - var/list/eye_colour = list(0,0,0) - var/list/old_eye_colour = list(0,0,0) + var/eye_colour = "#000000" + var/old_eye_colour = "#000000" var/flash_protect = 0 var/aug_message = "Your vision is augmented!" @@ -40,7 +40,6 @@ /obj/item/organ/internal/cyberimp/eyes/xray name = "X-ray implant" desc = "These cybernetic eye implants will give you X-ray vision. Blinking is futile." - eye_colour = list(0, 0, 0) implant_color = "#000000" origin_tech = "materials=4;programming=4;biotech=6;magnets=4" vision_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS @@ -50,7 +49,7 @@ /obj/item/organ/internal/cyberimp/eyes/thermals name = "Thermals implant" desc = "These cybernetic eye implants will give you Thermal vision. Vertical slit pupil included." - eye_colour = list(255, 204, 0) + eye_colour = "#FFCC00" implant_color = "#FFCC00" vision_flags = SEE_MOBS flash_protect = -1 @@ -81,7 +80,7 @@ /obj/item/organ/internal/cyberimp/eyes/hud/medical name = "Medical HUD implant" desc = "These cybernetic eye implants will display a medical HUD over everything you see." - eye_colour = list(0,0,208) + eye_colour = "#0000D0" implant_color = "#00FFFF" origin_tech = "materials=4;programming=4;biotech=4" aug_message = "You suddenly see health bars floating above people's heads..." @@ -90,7 +89,7 @@ /obj/item/organ/internal/cyberimp/eyes/hud/security name = "Security HUD implant" desc = "These cybernetic eye implants will display a security HUD over everything you see." - eye_colour = list(208,0,0) + eye_colour = "#D00000" implant_color = "#CC0000" origin_tech = "materials=4;programming=4;biotech=3;combat=3" aug_message = "Job indicator icons pop up in your vision. That is not a certified surgeon..." diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 5b8930f3016..922ec2ef639 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -32,7 +32,7 @@ var/cannot_amputate var/cannot_break var/s_tone = null - var/list/s_col = null // If this is instantiated, it should be a list of length 3 + var/s_col = null // If this is instantiated, it should be a hex value. var/list/child_icons = list() var/perma_injury = 0 var/dismember_at_max_damage = FALSE diff --git a/code/modules/surgery/organs/organ_icon.dm b/code/modules/surgery/organs/organ_icon.dm index 59e3de83894..c42a946661d 100644 --- a/code/modules/surgery/organs/organ_icon.dm +++ b/code/modules/surgery/organs/organ_icon.dm @@ -38,7 +38,7 @@ var/global/list/limb_icon_cache = list() s_tone = H.s_tone if(H.species.bodyflags & HAS_SKIN_COLOR) s_tone = null - s_col = list(H.r_skin, H.g_skin, H.b_skin) + s_col = H.skin_colour if(H.species.bodyflags & HAS_ICON_SKIN_TONE) var/obj/item/organ/external/chest/C = H.get_organ("chest") change_organ_icobase(C.icobase, C.deform) @@ -51,7 +51,7 @@ var/global/list/limb_icon_cache = list() s_tone = dna.GetUIValue(DNA_UI_SKIN_TONE) if(species.bodyflags & HAS_SKIN_COLOR) s_tone = null - s_col = list(dna.GetUIValue(DNA_UI_SKIN_R), dna.GetUIValue(DNA_UI_SKIN_G), dna.GetUIValue(DNA_UI_SKIN_B)) + s_col = rgb(dna.GetUIValue(DNA_UI_SKIN_R), dna.GetUIValue(DNA_UI_SKIN_G), dna.GetUIValue(DNA_UI_SKIN_B)) /obj/item/organ/external/head/sync_colour_to_human(var/mob/living/carbon/human/H) ..() @@ -69,8 +69,8 @@ var/global/list/limb_icon_cache = list() if(force_icon) mob_icon = new /icon(force_icon, "[icon_name]") if(species && species.name == "Machine") //snowflake for IPC's, sorry. - if(s_col && s_col.len >= 3) - mob_icon.Blend(rgb(s_col[1], s_col[2], s_col[3]), ICON_ADD) + if(s_col) + mob_icon.Blend(s_col, ICON_ADD) else var/new_icons = get_icon_state(skeletal) var/icon_file = new_icons[1] @@ -86,8 +86,8 @@ var/global/list/limb_icon_cache = list() mob_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) else mob_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) - else if(s_col && s_col.len >= 3) - mob_icon.Blend(rgb(s_col[1], s_col[2], s_col[3]), ICON_ADD) + else if(s_col) + mob_icon.Blend(s_col, ICON_ADD) dir = EAST icon = mob_icon @@ -107,11 +107,11 @@ var/global/list/limb_icon_cache = list() if(species.eyes) var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', species.eyes) if(eye_implant) // Eye implants override native DNA eye color - eyes_icon.Blend(rgb(eye_implant.eye_colour[1],eye_implant.eye_colour[2],eye_implant.eye_colour[3]), ICON_ADD) + eyes_icon.Blend(eye_implant.eye_colour, ICON_ADD) else if(eyes) - eyes_icon.Blend(rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3]), ICON_ADD) + eyes_icon.Blend(eyes.eye_colour, ICON_ADD) else - eyes_icon.Blend(rgb(128,0,0), ICON_ADD) + eyes_icon.Blend("#800000", ICON_ADD) mob_icon.Blend(eyes_icon, ICON_OVERLAY) overlays |= eyes_icon @@ -134,7 +134,7 @@ var/global/list/limb_icon_cache = list() if(head_accessory_style && head_accessory_style.species_allowed && (species.name in head_accessory_style.species_allowed)) var/icon/head_accessory_s = new/icon("icon" = head_accessory_style.icon, "icon_state" = "[head_accessory_style.icon_state]_s") if(head_accessory_style.do_colouration) - head_accessory_s.Blend(rgb(r_headacc, g_headacc, b_headacc), ICON_ADD) + head_accessory_s.Blend(headacc_colour, ICON_ADD) overlays |= head_accessory_s if(f_style) @@ -142,9 +142,9 @@ var/global/list/limb_icon_cache = list() if(facial_hair_style && ((facial_hair_style.species_allowed && (species.name in facial_hair_style.species_allowed)) || (src.species.bodyflags & ALL_RPARTS))) var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s") if(species.name == "Slime People") // I am el worstos - facial_s.Blend(rgb(owner.r_skin, owner.g_skin, owner.b_skin, 160), ICON_AND) + facial_s.Blend("[owner.skin_colour]A0", ICON_AND) //A0 = 160 alpha. else if(facial_hair_style.do_colouration) - facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD) + facial_s.Blend(facial_colour, ICON_ADD) overlays |= facial_s if(h_style && !(owner.head && (owner.head.flags & BLOCKHEADHAIR))) @@ -152,9 +152,9 @@ var/global/list/limb_icon_cache = list() if(hair_style && ((species.name in hair_style.species_allowed) || (src.species.bodyflags & ALL_RPARTS))) var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") if(species.name == "Slime People") // I am el worstos - hair_s.Blend(rgb(owner.r_skin, owner.g_skin, owner.b_skin, 160), ICON_AND) + hair_s.Blend("[owner.skin_colour]A0", ICON_AND) //A0 = 160 alpha. else if(hair_style.do_colouration) - hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD) + hair_s.Blend(hair_colour, ICON_ADD) overlays |= hair_s return mob_icon diff --git a/code/modules/surgery/organs/organ_internal.dm b/code/modules/surgery/organs/organ_internal.dm index 1070199d598..0aeafc9893a 100644 --- a/code/modules/surgery/organs/organ_internal.dm +++ b/code/modules/surgery/organs/organ_internal.dm @@ -324,7 +324,7 @@ organ_tag = "eyes" parent_organ = "head" slot = "eyes" - var/list/eye_colour = list(0,0,0) + var/eye_colour = "#000000" var/list/colourmatrix = null var/list/colourblind_matrix = MATRIX_GREYSCALE //Special colourblindness parameters. By default, it's black-and-white. var/colourblind_darkview = null @@ -630,13 +630,9 @@ head_organ.h_style = "Mohawk" else head_organ.h_style = "Very Long Hair" - head_organ.r_hair = 216 - head_organ.g_hair = 192 - head_organ.b_hair = 120 + head_organ.hair_colour = "#D8C078" H.update_hair() if(!(head_organ.f_style == "Very Long Beard")) head_organ.f_style = "Very Long Beard" - head_organ.r_facial = 216 - head_organ.g_facial = 192 - head_organ.b_facial = 120 + head_organ.facial_colour = "#D8C078" H.update_fhair() diff --git a/code/modules/surgery/organs/subtypes/standard.dm b/code/modules/surgery/organs/subtypes/standard.dm index bf2aeced0d4..a18613d55af 100644 --- a/code/modules/surgery/organs/subtypes/standard.dm +++ b/code/modules/surgery/organs/subtypes/standard.dm @@ -169,27 +169,17 @@ var/alt_head = "None" //Hair colour and style - var/r_hair = 0 - var/g_hair = 0 - var/b_hair = 0 - var/r_hair_sec = 0 - var/g_hair_sec = 0 - var/b_hair_sec = 0 + var/hair_colour = "#000000" + var/sec_hair_colour = "#000000" var/h_style = "Bald" //Head accessory colour and style - var/r_headacc = 0 - var/g_headacc = 0 - var/b_headacc = 0 + var/headacc_colour = "#000000" var/ha_style = "None" //Facial hair colour and style - var/r_facial = 0 - var/g_facial = 0 - var/b_facial = 0 - var/r_facial_sec = 0 - var/g_facial_sec = 0 - var/b_facial_sec = 0 + var/facial_colour = "#000000" + var/sec_facial_colour = "#000000" var/f_style = "Shaved" /obj/item/organ/external/head/remove() From ff6f7f964468d9c58125af0d9b6017322c38e751 Mon Sep 17 00:00:00 2001 From: KasparoVy Date: Sat, 22 Jul 2017 20:10:44 -0400 Subject: [PATCH 3/3] Updates SQL Version Includes my query. Thanks Tigercat2000 and Allfd. --- SQL/updates/0-1.sql | 30 ++++++++++++++++++++++++++++++ code/__DEFINES/misc.dm | 2 +- config/example/dbconfig.txt | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 SQL/updates/0-1.sql diff --git a/SQL/updates/0-1.sql b/SQL/updates/0-1.sql new file mode 100644 index 00000000000..977c979e113 --- /dev/null +++ b/SQL/updates/0-1.sql @@ -0,0 +1,30 @@ +#Updating the SQL from version 0 to version 1. -KasparoVv +#Adding new columns to contain the hex values (will be converted from RGB). +ALTER TABLE `characters` + ADD `hair_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `language`, + ADD `secondary_hair_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `hair_blue`, + ADD `facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `secondary_hair_blue`, + ADD `secondary_facial_hair_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `facial_blue`, + ADD `skin_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `skin_tone`, + ADD `head_accessory_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `marking_colours`, + ADD `eye_colour` varchar(7) NOT NULL DEFAULT '#000000' AFTER `alt_head_name`; + +#Converting RGB colours to HEX colours and transferring them to the new columns. +UPDATE `characters` + SET `hair_colour` = CONCAT("#", LPAD(HEX(`hair_red`), 2,'0'), LPAD(HEX(`hair_green`), 2,'0'), LPAD(HEX(`hair_blue`), 2,'0')), + `secondary_hair_colour` = CONCAT("#", LPAD(HEX(`secondary_hair_red`), 2,'0'), LPAD(HEX(`secondary_hair_green`), 2,'0'), LPAD(HEX(`secondary_hair_blue`), 2,'0')), + `facial_hair_colour` = CONCAT("#", LPAD(HEX(`facial_red`), 2,'0'), LPAD(HEX(`facial_green`), 2,'0'), LPAD(HEX(`facial_blue`), 2,'0')), + `secondary_facial_hair_colour` = CONCAT("#", LPAD(HEX(`secondary_facial_red`), 2,'0'), LPAD(HEX(`secondary_facial_green`), 2,'0'), LPAD(HEX(`secondary_facial_blue`), 2,'0')), + `skin_colour` = CONCAT("#", LPAD(HEX(`skin_red`), 2,'0'), LPAD(HEX(`skin_green`), 2,'0'), LPAD(HEX(`skin_blue`), 2,'0')), + `head_accessory_colour` = CONCAT("#", LPAD(HEX(`head_accessory_red`), 2,'0'), LPAD(HEX(`head_accessory_green`), 2,'0'), LPAD(HEX(`head_accessory_blue`), 2,'0')), + `eye_colour` = CONCAT("#", LPAD(HEX(`eyes_red`), 2,'0'), LPAD(HEX(`eyes_green`), 2,'0'), LPAD(HEX(`eyes_blue`), 2,'0')); + +#Dropping the old columns now that the hex colour columns are in place. +ALTER TABLE `characters` + DROP `hair_red`, DROP `hair_green`, DROP `hair_blue`, + DROP `secondary_hair_red`, DROP `secondary_hair_green`, DROP `secondary_hair_blue`, + DROP `facial_red`, DROP `facial_green`, DROP `facial_blue`, + DROP `secondary_facial_red`, DROP `secondary_facial_green`, DROP `secondary_facial_blue`, + DROP `skin_red`, DROP `skin_green`, DROP `skin_blue`, + DROP `head_accessory_red`, DROP `head_accessory_green`, DROP `head_accessory_blue`, + DROP `eyes_red`, DROP `eyes_green`, DROP `eyes_blue`; diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 1142f614775..ef9cbb6b800 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -349,4 +349,4 @@ #define BLOOD_STATE_NOT_BLOODY "no blood whatsoever" // The SQL version required by this version of the code -#define SQL_VERSION 0 +#define SQL_VERSION 1 diff --git a/config/example/dbconfig.txt b/config/example/dbconfig.txt index e713bda4c7d..837e1c5946c 100644 --- a/config/example/dbconfig.txt +++ b/config/example/dbconfig.txt @@ -9,7 +9,7 @@ ## This value must be set to the version of the paradise schema in use. ## If this value does not match, the SQL database will not be loaded and an error will be generated. ## Roundstart will be delayed. -DB_VERSION 0 +DB_VERSION 1 ## Server the MySQL database can be found at. # Examples: localhost, 200.135.5.43, www.mysqldb.com, etc.