From 10b7a2e8d93f51206b32962f4e8709e937ed9238 Mon Sep 17 00:00:00 2001 From: suethecake Date: Sun, 27 Apr 2014 01:00:16 -0600 Subject: [PATCH] Initial commit containing all the necessary code files that allow Tajaran, Unathi, and Skrell to change both their hair and body color to match. NO MORE GREEN/GREY! Conflicts: code/modules/client/preferences.dm code/modules/mob/living/carbon/human/human_defines.dm code/modules/mob/living/carbon/species.dm code/setup.dm --- code/datums/datacore.dm | 7 ++- code/game/dna/dna2.dm | 23 +++++--- code/game/dna/dna2_helpers.dm | 4 ++ code/modules/admin/admin_verbs.dm | 6 +++ code/modules/client/preferences.dm | 30 +++++++++-- code/modules/client/preferences_savefile.dm | 11 +++- .../mob/living/carbon/human/human_defines.dm | 5 ++ .../mob/living/carbon/human/update_icons.dm | 12 ++++- code/modules/mob/living/carbon/species.dm | 20 ++++--- .../mob/new_player/preferences_setup.dm | 53 +++++++++++++++++++ code/modules/organs/organ_external.dm | 7 ++- code/setup.dm | 4 +- 12 files changed, 158 insertions(+), 24 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 64e629e56a7..02bd6052992 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -151,12 +151,17 @@ proc/get_id_photo(var/mob/living/carbon/human/H) preview_icon.Blend(temp, ICON_OVERLAY) // Skin tone - if(H.species.flags & HAS_SKIN_TONE) + if(H.species.bodyflags & HAS_SKIN_TONE) if (H.s_tone >= 0) preview_icon.Blend(rgb(H.s_tone, H.s_tone, H.s_tone), ICON_ADD) else preview_icon.Blend(rgb(-H.s_tone, -H.s_tone, -H.s_tone), ICON_SUBTRACT) + // Skin color + if(H.species.flags & HAS_SKIN_TONE) + if(!H.species || H.species.flags & HAS_SKIN_COLOR) + preview_icon.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), ICON_ADD) + var/icon/eyes_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = H.species ? H.species.eyes : "eyes_s") eyes_s.Blend(rgb(H.r_eyes, H.g_eyes, H.b_eyes), ICON_ADD) diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index 531fac59e94..7a3118229a0 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -24,13 +24,16 @@ #define DNA_UI_BEARD_G 5 #define DNA_UI_BEARD_B 6 #define DNA_UI_SKIN_TONE 7 -#define DNA_UI_EYES_R 8 -#define DNA_UI_EYES_G 9 -#define DNA_UI_EYES_B 10 -#define DNA_UI_GENDER 11 -#define DNA_UI_BEARD_STYLE 12 -#define DNA_UI_HAIR_STYLE 13 -#define DNA_UI_LENGTH 13 // Update this when you add something, or you WILL break shit. +#define DNA_UI_SKIN_R 8 +#define DNA_UI_SKIN_G 9 +#define DNA_UI_SKIN_B 10 +#define DNA_UI_EYES_R 11 +#define DNA_UI_EYES_G 12 +#define DNA_UI_EYES_B 13 +#define DNA_UI_GENDER 14 +#define DNA_UI_BEARD_STYLE 15 +#define DNA_UI_HAIR_STYLE 16 +#define DNA_UI_LENGTH 16 // Update this when you add something, or you WILL break shit. #define DNA_SE_LENGTH 55 // Was STRUCDNASIZE, size 27. 15 new blocks added = 42, plus room to grow. @@ -138,6 +141,10 @@ var/global/list/bad_blocks[0] SetUIValueRange(DNA_UI_EYES_G, character.g_eyes, 255, 1) SetUIValueRange(DNA_UI_EYES_B, character.b_eyes, 255, 1) + 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_TONE, 35-character.s_tone, 220, 1) // Value can be negative. SetUIState(DNA_UI_GENDER, character.gender!=MALE, 1) @@ -360,4 +367,4 @@ var/global/list/bad_blocks[0] ResetSE() unique_enzymes = md5(character.real_name) - reg_dna[unique_enzymes] = character.real_name \ No newline at end of file + reg_dna[unique_enzymes] = character.real_name diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index a179c3dab68..e8a6d16ebb0 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -139,6 +139,10 @@ H.g_facial = dna.GetUIValueRange(DNA_UI_BEARD_G, 255) H.b_facial = dna.GetUIValueRange(DNA_UI_BEARD_B, 255) + 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.r_eyes = dna.GetUIValueRange(DNA_UI_EYES_R, 255) H.g_eyes = dna.GetUIValueRange(DNA_UI_EYES_G, 255) H.b_eyes = dna.GetUIValueRange(DNA_UI_EYES_B, 255) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index eff3e8737eb..f0b071893fd 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -673,6 +673,12 @@ var/list/admin_verbs_mod = list( M.g_eyes = hex2num(copytext(new_eyes, 4, 6)) M.b_eyes = hex2num(copytext(new_eyes, 6, 8)) + var/new_skin = input("Please select body color. This is for Tajaran, Unathi, and Skrell only!", "Character Generation") as color + if(new_skin) + M.r_skin = hex2num(copytext(new_skin, 2, 4)) + M.g_skin = hex2num(copytext(new_skin, 4, 6)) + M.b_skin = hex2num(copytext(new_skin, 6, 8)) + var/new_tone = input("Please select skin tone level: 1-220 (1=albino, 35=caucasian, 150=black, 220='very' black)", "Character Generation") as text if (new_tone) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 4d30a43305f..e61c7da403d 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -67,7 +67,10 @@ datum/preferences var/r_facial = 0 //Face hair color var/g_facial = 0 //Face hair color var/b_facial = 0 //Face hair color - var/s_tone = 0 //Skin 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 @@ -182,10 +185,10 @@ datum/preferences dat += "
" dat += "Species: [species]
" dat += "Secondary Language:
[language]
" - dat += "Accent: [accent]
" +/* dat += "Accent: [accent]
" dat += "Voice: [voice]
" dat += "Pitch: [pitch]
" - dat += "Talking Speed: [talkspeed]
" + dat += "Talking Speed: [talkspeed]
"*/ dat += "Blood Type: [b_type]
" dat += "Skin Tone: [-s_tone + 35]/220
" // dat += "Skin pattern: Adjust
" @@ -296,7 +299,10 @@ datum/preferences dat += " Style: [f_style]
" dat += "
Eyes
" - dat += "Change Color
__
" + dat += "Change Color
__

" + + dat += "
Body Color
" + dat += "Change Color
__
" dat += "
" @@ -932,6 +938,10 @@ datum/preferences b_eyes = rand(0,255) if("s_tone") s_tone = random_skin_tone() + if("s_color") + r_skin = rand(0,255) + g_skin = rand(0,255) + b_skin = rand(0,255) if("bag") backbag = rand(1,4) /*if("skin_style") @@ -1143,6 +1153,14 @@ datum/preferences if(new_s_tone) s_tone = 35 - max(min( round(new_s_tone), 220),1) + if("skin") + if(species == "Unathi" || species == "Tajaran" || species == "Skrell") + var/new_skin = input(user, "Choose your character's skin colour: ", "Character Preference") as color|null + if(new_skin) + r_skin = hex2num(copytext(new_skin, 2, 4)) + g_skin = hex2num(copytext(new_skin, 4, 6)) + b_skin = hex2num(copytext(new_skin, 6, 8)) + if("ooccolor") var/new_ooccolor = input(user, "Choose your OOC colour:", "Game Preference") as color|null if(new_ooccolor) @@ -1376,6 +1394,10 @@ datum/preferences character.g_facial = g_facial character.b_facial = b_facial + character.r_skin = r_skin + character.g_skin = g_skin + character.b_skin = b_skin + character.s_tone = s_tone character.h_style = h_style diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 12149c5e3c1..ea6d370c873 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -270,6 +270,9 @@ S["facial_green"] >> g_facial S["facial_blue"] >> b_facial S["skin_tone"] >> s_tone + S["skin_red"] >> r_skin + S["skin_green"] >> g_skin + S["skin_blue"] >> b_skin S["hair_style_name"] >> h_style S["facial_style_name"] >> f_style S["eyes_red"] >> r_eyes @@ -323,6 +326,9 @@ g_facial = sanitize_integer(g_facial, 0, 255, initial(g_facial)) b_facial = sanitize_integer(b_facial, 0, 255, initial(b_facial)) s_tone = sanitize_integer(s_tone, -185, 34, initial(s_tone)) + r_skin = sanitize_integer(r_facial, 0, 255, initial(r_skin)) + g_skin = sanitize_integer(r_facial, 0, 255, initial(g_skin)) + b_skin = sanitize_integer(r_facial, 0, 255, initial(b_skin)) 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)) r_eyes = sanitize_integer(r_eyes, 0, 255, initial(r_eyes)) @@ -371,7 +377,10 @@ S["facial_red"] << r_facial S["facial_green"] << g_facial S["facial_blue"] << b_facial - S["skin_tone"] << s_tone + S["skin_tone"] >> s_tone + S["skin_red"] << r_skin + S["skin_green"] << g_skin + S["skin_blue"] << b_skin S["hair_style_name"] << h_style S["facial_style_name"] << f_style S["eyes_red"] << r_eyes diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 6d672f1a78b..291211f9a75 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -18,6 +18,11 @@ var/s_tone = 0 //Skin tone + //Skin colour + var/r_skin = 0 + var/g_skin = 0 + var/b_skin = 0 + var/lip_style = null //no lipstick by default- arguably misleading, as it could be used for general makeup var/age = 30 //Player's age (pure fluff) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 510311122c2..76cadfaa471 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -295,12 +295,16 @@ proc/get_damage_icon_part(damage_state, body_part) stand_icon.Blend(temp, ICON_OVERLAY) //Skin tone - if(!skeleton && !husk && !hulk && (species.flags & HAS_SKIN_TONE)) + if(!skeleton && !husk && !hulk && (species.bodyflags & HAS_SKIN_TONE)) if(s_tone >= 0) stand_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD) else stand_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT) + //Skin color + if(!skeleton && !husk && !hulk && (species.flags & HAS_SKIN_COLOR)) + stand_icon.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + if(husk) var/icon/mask = new(stand_icon) var/icon/husk_over = new(race_icon,"overlay_husk") @@ -852,7 +856,11 @@ proc/get_damage_icon_part(damage_state, body_part) if(species.tail && species.bodyflags & HAS_TAIL) if(!wear_suit || !(wear_suit.flags_inv & HIDEJUMPSUIT) && !istype(wear_suit, /obj/item/clothing/suit/space)) - overlays_standing[TAIL_LAYER] = image("icon" = 'icons/effects/species.dmi', "icon_state" = "[species.tail]_s") + var/icon/tail_s = new/icon("icon" = 'icons/effects/species.dmi', "icon_state" = "[species.tail]_s") + tail_s.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + + stand_icon.Blend(tail_s, ICON_OVERLAY) + overlays_standing[TAIL_LAYER] = image(stand_icon) if(update_icons) update_icons() diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index c9a0cfedeaa..5c28ccc6243 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -43,7 +43,7 @@ var/flags = 0 // Various specific features. var/bloodflags=0 var/bodyflags=0 - + var/flesh_color = "#FFC896" //Pink. var/list/abilities = list() // For species-derived or admin-given powers /datum/species/proc/create_organs(var/mob/living/carbon/human/H) //Handles creation of mob organs. @@ -104,7 +104,8 @@ deform = 'icons/mob/human_races/r_def_human.dmi' primitive = /mob/living/carbon/monkey path = /mob/living/carbon/human/human - flags = HAS_SKIN_TONE | HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT + flags = HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT + bodyflags = HAS_SKIN_TONE /datum/species/unathi name = "Unathi" @@ -118,7 +119,7 @@ darksight = 3 flags = HAS_LIPS | HAS_UNDERWEAR - bodyflags = FEET_CLAWS | HAS_TAIL + bodyflags = FEET_CLAWS | HAS_TAIL | HAS_SKIN_COLOR cold_level_1 = 280 //Default 260 - Lower is better cold_level_2 = 220 //Default 200 @@ -128,6 +129,9 @@ heat_level_2 = 480 //Default 400 heat_level_3 = 1100 //Default 1000 + flesh_color = "#34AF10" + + /datum/species/tajaran name = "Tajaran" icobase = 'icons/mob/human_races/r_tajaran.dmi' @@ -149,7 +153,9 @@ primitive = /mob/living/carbon/monkey/tajara flags = HAS_LIPS | HAS_UNDERWEAR | CAN_BE_FAT - bodyflags = FEET_PADDED | HAS_TAIL + bodyflags = FEET_PADDED | HAS_TAIL | HAS_SKIN_COLOR + + flesh_color = "#AFA59E" /datum/species/skrell name = "Skrell" @@ -161,6 +167,9 @@ flags = HAS_LIPS | HAS_UNDERWEAR bloodflags = BLOOD_GREEN + bodyflags = HAS_SKIN_COLOR + + flesh_color = "#8CD7A3" /datum/species/vox name = "Vox" @@ -319,5 +328,4 @@ flags = IS_WHITELISTED | NO_BREATHE | NO_SCAN | NO_BLOOD | NO_PAIN | IS_SYNTHETIC -// blood_color = "#FFFFFF" -// flesh_color = "#AAAAAA" + flesh_color = "#AAAAAA" diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index b09bc2bc724..2b8674f8290 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -12,6 +12,7 @@ datum/preferences randomize_hair_color("hair") randomize_hair_color("facial") randomize_eyes_color() + randomize_skin_color() underwear = rand(1,underwear_m.len) undershirt = rand(1,undershirt_t.len) backbag = 2 @@ -128,6 +129,54 @@ datum/preferences g_eyes = green b_eyes = blue + proc/randomize_skin_color() + var/red + var/green + var/blue + + var/col = pick ("black", "grey", "brown", "chestnut", "blue", "lightblue", "green", "albino") + switch(col) + if("black") + red = 0 + green = 0 + blue = 0 + if("grey") + red = rand (100, 200) + green = red + blue = red + if("brown") + red = 102 + green = 51 + blue = 0 + if("chestnut") + red = 153 + green = 102 + blue = 0 + if("blue") + red = 51 + green = 102 + blue = 204 + if("lightblue") + red = 102 + green = 204 + blue = 255 + if("green") + red = 0 + green = 102 + blue = 0 + if("albino") + red = rand (200, 255) + green = rand (0, 150) + blue = rand (0, 150) + + red = max(min(red + rand (-25, 25), 255), 0) + green = max(min(green + rand (-25, 25), 255), 0) + blue = max(min(blue + rand (-25, 25), 255), 0) + + r_skin = red + g_skin = green + b_skin = blue + proc/update_preview_icon(var/for_observer=0) //seriously. This is horrendous. del(preview_icon_front) @@ -166,6 +215,10 @@ datum/preferences preview_icon.Blend(temp, ICON_OVERLAY) + // Skin color + if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR)) + preview_icon.Blend(rgb(r_skin, g_skin, b_skin), ICON_ADD) + // Skin tone if(current_species && (current_species.flags & HAS_SKIN_TONE)) if (s_tone >= 0) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 77a6972beb9..b4675de979b 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -899,12 +899,17 @@ obj/item/weapon/organ/New(loc, mob/living/carbon/human/H) if(base) //Changing limb's skin tone to match owner - if(!H.species || H.species.flags & HAS_SKIN_TONE) + if(!H.species || H.species.bodyflags & HAS_SKIN_TONE) if (H.s_tone >= 0) base.Blend(rgb(H.s_tone, H.s_tone, H.s_tone), ICON_ADD) else base.Blend(rgb(-H.s_tone, -H.s_tone, -H.s_tone), ICON_SUBTRACT) + if(base) + //Changing limb's skin color to match owner + if(!H.species || H.species.flags & HAS_SKIN_COLOR) + base.Blend(rgb(H.r_skin, H.g_skin, H.b_skin), ICON_ADD) + icon = base dir = SOUTH src.transform = turn(src.transform, rand(70,130)) diff --git a/code/setup.dm b/code/setup.dm index 3567b5c2d3c..9a3ebb21f65 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -767,6 +767,7 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse ) //Species flags. + #define NO_BLOOD 1 #define NO_BREATHE 2 #define IS_SLOW 4 @@ -775,7 +776,6 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse #define NO_PAIN 32 #define REQUIRE_LIGHT 64 #define IS_WHITELISTED 128 -#define HAS_SKIN_TONE 256 #define HAS_LIPS 512 #define HAS_UNDERWEAR 1024 #define IS_SYNTHETIC 2048 @@ -793,6 +793,8 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse #define FEET_PADDED 2 #define FEET_NOSLIP 4 #define HAS_TAIL 8 +#define HAS_SKIN_TONE 16 +#define HAS_SKIN_COLOR 32 //Language flags.