diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm
index f9c3ce39b08..26738b137fe 100644
--- a/code/datums/datacore.dm
+++ b/code/datums/datacore.dm
@@ -129,6 +129,7 @@
proc/get_id_photo(var/mob/living/carbon/human/H)
var/icon/preview_icon = null
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
+ var/obj/item/organ/internal/eyes/eyes_organ = H.get_int_organ(/obj/item/organ/internal/eyes)
var/g = "m"
if(H.gender == FEMALE)
@@ -170,7 +171,12 @@ proc/get_id_photo(var/mob/living/carbon/human/H)
var/icon/face_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = "bald_s")
if(!(H.species.bodyflags & NO_EYES))
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)
+ 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)
face_s.Blend(eyes_s, ICON_OVERLAY)
var/datum/sprite_accessory/hair_style = hair_styles_list[head_organ.h_style]
diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm
index 4224ad1aa5e..347e6470869 100644
--- a/code/game/dna/dna2.dm
+++ b/code/game/dna/dna2.dm
@@ -134,19 +134,8 @@ var/global/list/bad_blocks[0]
// Hair
// FIXME: Species-specific defaults pls
var/obj/item/organ/external/head/H = character.get_organ("head")
- if(!H.h_style)
- H.h_style = "Skinhead"
- var/hair = hair_styles_list.Find(H.h_style)
+ var/obj/item/organ/internal/eyes/eyes_organ = character.get_int_organ(/obj/item/organ/internal/eyes)
- // Facial Hair
- if(!H.f_style)
- H.f_style = "Shaved"
- var/beard = facial_hair_styles_list.Find(H.f_style)
-
- // Head Accessory
- if(!H.ha_style)
- H.ha_style = "None"
- var/headacc = head_accessory_styles_list.Find(H.ha_style)
/*// Body Accessory
if(!character.body_accessory)
@@ -158,26 +147,13 @@ var/global/list/bad_blocks[0]
character.m_style = "None"
var/marks = marking_styles_list.Find(character.m_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_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_EYES_R, character.r_eyes, 255, 1)
- SetUIValueRange(DNA_UI_EYES_G, character.g_eyes, 255, 1)
- SetUIValueRange(DNA_UI_EYES_B, character.b_eyes, 255, 1)
+ 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_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_MARK_R, character.r_markings, 255, 1)
SetUIValueRange(DNA_UI_MARK_G, character.g_markings, 255, 1)
SetUIValueRange(DNA_UI_MARK_B, character.b_markings, 255, 1)
@@ -185,11 +161,7 @@ var/global/list/bad_blocks[0]
SetUIValueRange(DNA_UI_SKIN_TONE, 35-character.s_tone, 220, 1) // Value can be negative.
SetUIState(DNA_UI_GENDER, character.gender!=MALE, 1)
-
- SetUIValueRange(DNA_UI_HAIR_STYLE, hair, hair_styles_list.len, 1)
- SetUIValueRange(DNA_UI_BEARD_STYLE, beard, facial_hair_styles_list.len, 1)
/*SetUIValueRange(DNA_UI_BACC_STYLE, bodyacc, facial_hair_styles_list.len, 1)*/
- SetUIValueRange(DNA_UI_HACC_STYLE, headacc, head_accessory_styles_list.len, 1)
SetUIValueRange(DNA_UI_MARK_STYLE, marks, marking_styles_list.len, 1)
diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm
index 5bc984b11ac..3aecc2fb918 100644
--- a/code/game/dna/dna2_helpers.dm
+++ b/code/game/dna/dna2_helpers.dm
@@ -132,33 +132,16 @@
dna.check_integrity()
var/mob/living/carbon/human/H = src
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
- head_organ.r_hair = dna.GetUIValueRange(DNA_UI_HAIR_R, 255)
- head_organ.g_hair = dna.GetUIValueRange(DNA_UI_HAIR_G, 255)
- head_organ.b_hair = dna.GetUIValueRange(DNA_UI_HAIR_B, 255)
-
- head_organ.r_facial = dna.GetUIValueRange(DNA_UI_BEARD_R, 255)
- head_organ.g_facial = dna.GetUIValueRange(DNA_UI_BEARD_G, 255)
- head_organ.b_facial = dna.GetUIValueRange(DNA_UI_BEARD_B, 255)
+ dna.write_head_attributes(head_organ)
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)
-
- head_organ.r_headacc = dna.GetUIValueRange(DNA_UI_HACC_R, 255)
- head_organ.g_headacc = dna.GetUIValueRange(DNA_UI_HACC_G, 255)
- head_organ.b_headacc = dna.GetUIValueRange(DNA_UI_HACC_B, 255)
-
H.r_markings = dna.GetUIValueRange(DNA_UI_MARK_R, 255)
H.g_markings = dna.GetUIValueRange(DNA_UI_MARK_G, 255)
H.b_markings = dna.GetUIValueRange(DNA_UI_MARK_B, 255)
-
- H.update_eyes()
-
H.s_tone = 35 - dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) // Value can be negative.
if(dna.GetUIState(DNA_UI_GENDER))
@@ -166,21 +149,6 @@
else
H.change_gender(MALE, 0)
- //Hair
- var/hair = dna.GetUIValueRange(DNA_UI_HAIR_STYLE,hair_styles_list.len)
- if((0 < hair) && (hair <= hair_styles_list.len))
- head_organ.h_style = hair_styles_list[hair]
-
- //Facial Hair
- var/beard = dna.GetUIValueRange(DNA_UI_BEARD_STYLE,facial_hair_styles_list.len)
- if((0 < beard) && (beard <= facial_hair_styles_list.len))
- head_organ.f_style = facial_hair_styles_list[beard]
-
- //Head Accessories
- var/headacc = dna.GetUIValueRange(DNA_UI_HACC_STYLE,head_accessory_styles_list.len)
- if((0 < headacc) && (headacc <= head_accessory_styles_list.len))
- head_organ.ha_style = head_accessory_styles_list[headacc]
-
//Markings
var/marks = dna.GetUIValueRange(DNA_UI_MARK_STYLE,marking_styles_list.len)
if((0 < marks) && (marks <= marking_styles_list.len))
@@ -196,3 +164,98 @@
return 1
else
return 0
+
+/*
+ ORGAN WRITING PROCS
+*/
+
+
+// I'm putting this here because nothing outside the DNA module should ever have
+// to directly mess with the guts of DNA code
+
+// This proc applies the DNA's information to the given head
+/datum/dna/proc/write_head_attributes(obj/item/organ/external/head/head_organ)
+
+ //Hair
+ var/hair = GetUIValueRange(DNA_UI_HAIR_STYLE,hair_styles_list.len)
+ if((0 < hair) && (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)
+
+ //Facial Hair
+ var/beard = GetUIValueRange(DNA_UI_BEARD_STYLE,facial_hair_styles_list.len)
+ if((0 < beard) && (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 Accessories
+ var/headacc = GetUIValueRange(DNA_UI_HACC_STYLE,head_accessory_styles_list.len)
+ if((0 < headacc) && (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)
+
+// 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)
+ eyes_organ.eye_colour = list(
+ GetUIValueRange(DNA_UI_EYES_R, 255),
+ GetUIValueRange(DNA_UI_EYES_G, 255),
+ GetUIValueRange(DNA_UI_EYES_B, 255)
+ )
+
+/*
+ TRAIT CHANGING PROCS
+*/
+/datum/dna/proc/eye_color_to_dna(obj/item/organ/internal/eyes/eyes_organ)
+ if(!eyes_organ)
+ // 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)
+
+/datum/dna/proc/head_traits_to_dna(obj/item/organ/external/head/H)
+ if(!H)
+ log_debug("Attempting to reset DNA from a missing head!")
+ return
+ if(!H.h_style)
+ H.h_style = "Skinhead"
+ var/hair = hair_styles_list.Find(H.h_style)
+
+ // Facial Hair
+ if(!H.f_style)
+ H.f_style = "Shaved"
+ var/beard = facial_hair_styles_list.Find(H.f_style)
+
+ // Head Accessory
+ if(!H.ha_style)
+ H.ha_style = "None"
+ var/headacc = head_accessory_styles_list.Find(H.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_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_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_HAIR_STYLE, hair, hair_styles_list.len, 1)
+ SetUIValueRange(DNA_UI_BEARD_STYLE, beard, facial_hair_styles_list.len, 1)
+ SetUIValueRange(DNA_UI_HACC_STYLE, headacc, head_accessory_styles_list.len, 1)
diff --git a/code/game/dna/genes/vg_powers.dm b/code/game/dna/genes/vg_powers.dm
index 7ed7f3fea97..992e4326317 100644
--- a/code/game/dna/genes/vg_powers.dm
+++ b/code/game/dna/genes/vg_powers.dm
@@ -36,6 +36,7 @@
return
var/mob/living/carbon/human/M=usr
var/obj/item/organ/external/head/head_organ = M.get_organ("head")
+ var/obj/item/organ/internal/eyes/eyes_organ = M.get_int_organ(/obj/item/organ/internal/eyes)
var/new_gender = alert(usr, "Please select gender.", "Character Generation", "Male", "Female")
if(new_gender)
@@ -44,12 +45,19 @@
else
M.change_gender(FEMALE)
- var/new_eyes = input("Please select eye color.", "Character Generation", rgb(M.r_eyes,M.g_eyes,M.b_eyes)) as null|color
+ 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
if(new_eyes)
- M.r_eyes = hex2num(copytext(new_eyes, 2, 4))
- M.g_eyes = hex2num(copytext(new_eyes, 4, 6))
- M.b_eyes = hex2num(copytext(new_eyes, 6, 8))
- M.change_eye_color(M.r_eyes, M.g_eyes, M.b_eyes)
+ eyes_red = hex2num(copytext(new_eyes, 2, 4))
+ eyes_green = hex2num(copytext(new_eyes, 4, 6))
+ eyes_blue = hex2num(copytext(new_eyes, 6, 8))
+ M.change_eye_color(eyes_red, eyes_green, eyes_blue)
// hair
var/list/valid_hairstyles = M.generate_valid_hairstyles()
diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm
index f5fdd85242f..1a607bea3ca 100644
--- a/code/game/gamemodes/nuclear/nuclear.dm
+++ b/code/game/gamemodes/nuclear/nuclear.dm
@@ -154,9 +154,10 @@ proc/issyndicate(mob/living/M as mob)
head_organ.r_hair = hex2num(copytext(hair_c, 2, 4))
head_organ.g_hair = hex2num(copytext(hair_c, 4, 6))
head_organ.b_hair = hex2num(copytext(hair_c, 6, 8))
- M.r_eyes = hex2num(copytext(eye_c, 2, 4))
- M.g_eyes = hex2num(copytext(eye_c, 4, 6))
- M.b_eyes = hex2num(copytext(eye_c, 6, 8))
+ var/eyes_red = hex2num(copytext(eye_c, 2, 4))
+ var/eyes_green = hex2num(copytext(eye_c, 4, 6))
+ var/eyes_blue = hex2num(copytext(eye_c, 6, 8))
+ M.change_eye_color(eyes_red, eyes_green, eyes_blue)
M.s_tone = skin_tone
head_organ.h_style = hair_style
head_organ.f_style = facial_hair_style
@@ -517,4 +518,4 @@ proc/issyndicate(mob/living/M as mob)
dat += "Station Destroyed: [score_nuked ? "Yes" : "No"] (-[score_nuked_penalty] Points)
"
dat += "
"
- return dat
\ No newline at end of file
+ return dat
diff --git a/code/game/response_team.dm b/code/game/response_team.dm
index 9e5605c3b28..81e800a2b00 100644
--- a/code/game/response_team.dm
+++ b/code/game/response_team.dm
@@ -173,9 +173,10 @@ var/ert_request_answered = 0
head_organ.r_hair = hex2num(copytext(hair_c, 2, 4))
head_organ.g_hair = hex2num(copytext(hair_c, 4, 6))
head_organ.b_hair = hex2num(copytext(hair_c, 6, 8))
- M.r_eyes = hex2num(copytext(eye_c, 2, 4))
- M.g_eyes = hex2num(copytext(eye_c, 4, 6))
- M.b_eyes = hex2num(copytext(eye_c, 6, 8))
+ var/eyes_red = hex2num(copytext(eye_c, 2, 4))
+ var/eyes_green = hex2num(copytext(eye_c, 4, 6))
+ var/eyes_blue = hex2num(copytext(eye_c, 6, 8))
+ M.change_eye_color(eyes_red, eyes_green, eyes_blue)
M.s_tone = skin_tone
head_organ.h_style = hair_style
head_organ.f_style = facial_hair_style
diff --git a/code/modules/admin/verbs/SDQL2/useful_procs.dm b/code/modules/admin/verbs/SDQL2/useful_procs.dm
new file mode 100644
index 00000000000..5dd8d657118
--- /dev/null
+++ b/code/modules/admin/verbs/SDQL2/useful_procs.dm
@@ -0,0 +1,29 @@
+// This one's for you, SDQL fans
+
+// Give this a string and a location to create the object. Examples of using
+// this function:
+/*
+CALL global.json_to_object_arbitrary_vars("{'type':'/obj/item/weapon/crowbar', 'color':'#FF0000','force':5000,'name':'Greytides Gravedigger'}", loc) ON /mob/living/carbon/human WHERE ckey == 'crazylemon'".
+*/
+// This is a bit more flexible than the serialization interface because that interface
+// expects a rigid structure for the data
+/proc/json_to_object_arbitrary_vars(json_data, position)
+ var/data = json_decode(json_data)
+ return list_to_object_arbitrary_vars(data, position)
+
+
+/proc/list_to_object_arbitrary_vars(list/data, position)
+ if(!islist(data))
+ throw EXCEPTION("Not a list.")
+ if(!("type" in data))
+ throw EXCEPTION("No 'type' field in the data")
+ var/path = text2path(data["type"])
+ if(!path)
+ throw EXCEPTION("Path not found: [path]")
+
+ var/atom/movable/thing = new path(position)
+ data -= "type"
+ for(var/attribute in data)
+ thing.vars[attribute] = data[attribute]
+
+ return thing
diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm
index d8491b4a38b..b2521e02b0d 100644
--- a/code/modules/client/preference/preferences.dm
+++ b/code/modules/client/preference/preferences.dm
@@ -1850,9 +1850,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
character.age = age
character.b_type = b_type
- character.r_eyes = r_eyes
- character.g_eyes = g_eyes
- character.b_eyes = b_eyes
+ character.change_eye_color(r_eyes, g_eyes, b_eyes)
//Head-specific
var/obj/item/organ/external/head/H = character.get_organ("head")
@@ -2015,4 +2013,4 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
popup.open(0)
/datum/preferences/proc/close_load_dialog(mob/user)
- user << browse(null, "window=saves")
\ No newline at end of file
+ user << browse(null, "window=saves")
diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm
index ca241306f00..c4fb4b89dac 100644
--- a/code/modules/mob/living/carbon/human/appearance.dm
+++ b/code/modules/mob/living/carbon/human/appearance.dm
@@ -170,14 +170,24 @@
H.ha_style = "None"
update_head_accessory()
-/mob/living/carbon/human/proc/change_eye_color(var/red, var/green, var/blue)
- if(red == r_eyes && green == g_eyes && blue == b_eyes)
- return
+/mob/living/carbon/human/proc/change_eye_color(var/red, var/green, var/blue, 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)
+ return
- r_eyes = red
- g_eyes = green
- b_eyes = blue
+ eyes_organ.eye_colour[1] = red
+ eyes_organ.eye_colour[2] = green
+ eyes_organ.eye_colour[3] = blue
+ dna.eye_color_to_dna(eyes_organ)
+ if(update_dna)
+ update_dna()
+ sync_organ_dna(assimilate=0)
update_eyes()
update_body()
return 1
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 5f2de47752c..48111b46d8a 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -2081,7 +2081,6 @@
dna.deserialize(data["dna"])
real_name = dna.real_name
name = real_name
- UpdateAppearance()
set_species(dna.species)
age = data["age"]
undershirt = data["ushirt"]
@@ -2105,6 +2104,7 @@
// As above, "New" code handles insertion, DNA sync
list_to_object(organs_list[organ], src)
+ UpdateAppearance()
// De-serialize equipment
// #1: Jumpsuit
diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm
index 61ef6fb1a4f..272cb65e33a 100644
--- a/code/modules/mob/living/carbon/human/human_defines.dm
+++ b/code/modules/mob/living/carbon/human/human_defines.dm
@@ -9,11 +9,6 @@ var/global/default_martial_art = new/datum/martial_art
var/b_markings = 0
var/m_style = "None"
- //Eye colour
- var/r_eyes = 0
- var/g_eyes = 0
- var/b_eyes = 0
-
var/s_tone = 0 //Skin tone
//Skin colour
diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm
index b919912a6c1..8f7ed81a5fa 100644
--- a/code/modules/mob/living/carbon/human/update_icons.dm
+++ b/code/modules/mob/living/carbon/human/update_icons.dm
@@ -1301,43 +1301,6 @@ var/global/list/damage_icon_parts = list()
if(update_icons) update_icons()
-
-// Used mostly for creating head items
-/mob/living/carbon/human/proc/generate_head_icon()
-//gender no longer matters for the mouth, although there should probably be seperate base head icons.
-// var/g = "m"
-// if(gender == FEMALE) g = "f"
- var/obj/item/organ/external/head/H = get_organ("head")
- //base icons
- var/icon/face_lying = new /icon('icons/mob/human_face.dmi',"bald_l")
-
-
- if(H.f_style)
- var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[H.f_style]
- if(facial_hair_style)
- var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l")
- facial_l.Blend(rgb(H.r_facial, H.g_facial, H.b_facial), ICON_ADD)
- face_lying.Blend(facial_l, ICON_OVERLAY)
-
- if(H.h_style)
- var/datum/sprite_accessory/hair_style = hair_styles_list[H.h_style]
- if(hair_style)
- var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l")
- hair_l.Blend(rgb(H.r_hair, H.g_hair, H.b_hair), ICON_ADD)
- face_lying.Blend(hair_l, ICON_OVERLAY)
-
- //Eyes
- // Note: These used to be in update_face(), and the fact they're here will make it difficult to create a disembodied head
- var/icon/eyes_l = new/icon('icons/mob/human_face.dmi', "eyes_l")
- eyes_l.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD)
- face_lying.Blend(eyes_l, ICON_OVERLAY)
-
- if(lip_style)
- face_lying.Blend(new/icon('icons/mob/human_face.dmi', "lips_[lip_style]_l"), ICON_OVERLAY)
-
- var/image/face_lying_image = new /image(icon = face_lying)
- return face_lying_image
-
/mob/living/carbon/human/proc/force_update_limbs()
for(var/obj/item/organ/external/O in organs)
O.sync_colour_to_human(src)
diff --git a/code/modules/mob/living/carbon/superheroes.dm b/code/modules/mob/living/carbon/superheroes.dm
index 862a44eb57b..60e1cd82654 100644
--- a/code/modules/mob/living/carbon/superheroes.dm
+++ b/code/modules/mob/living/carbon/superheroes.dm
@@ -215,9 +215,8 @@
head_organ.h_style = "Bald"
head_organ.f_style = "Shaved"
target.s_tone = 35
- target.r_eyes = 1
- target.b_eyes = 1
- target.g_eyes = 1
+ // No `update_dna=0` here because the character is being over-written
+ target.change_eye_color(1,1,1)
for(var/obj/item/W in target)
if(istype(W,/obj/item/organ)) continue
target.unEquip(W)
@@ -233,4 +232,3 @@
target.equip_to_slot_or_del(W, slot_wear_id)
target.equip_to_slot_or_del(new /obj/item/device/radio/headset(target), slot_l_ear)
target.regenerate_icons()
-
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index 323f170facd..8b2888852e5 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -213,4 +213,4 @@
var/list/permanent_huds = list()
- var/list/actions = list()
\ No newline at end of file
+ var/list/actions = list()
diff --git a/code/modules/nano/modules/human_appearance.dm b/code/modules/nano/modules/human_appearance.dm
index ee289cfec9b..5a60d261c91 100644
--- a/code/modules/nano/modules/human_appearance.dm
+++ b/code/modules/nano/modules/human_appearance.dm
@@ -30,6 +30,8 @@
if(can_change(APPEARANCE_RACE) && (href_list["race"] in valid_species))
if(owner.change_species(href_list["race"]))
cut_and_generate_data()
+ // Species change creates new organs - runtimes ahoy if we forget this
+ head_organ = owner.get_organ("head")
return 1
if(href_list["gender"])
if(can_change(APPEARANCE_GENDER))
@@ -102,7 +104,15 @@
return 1
if(href_list["eye_color"])
if(can_change(APPEARANCE_EYE_COLOR))
- var/new_eyes = input("Please select eye color.", "Eye Color", rgb(owner.r_eyes, owner.g_eyes, owner.b_eyes)) as color|null
+ 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 = hex2num(copytext(new_eyes, 2, 4))
var/g_eyes = hex2num(copytext(new_eyes, 4, 6))
@@ -158,7 +168,7 @@
if(data["change_race"])
var/species[0]
for(var/specimen in valid_species)
- species[++species.len] = list("specimen" = specimen)
+ species[++species.len] = list("specimen" = specimen)
data["species"] = species
data["change_gender"] = can_change(APPEARANCE_GENDER)
@@ -171,7 +181,7 @@
for(var/head_accessory_style in valid_head_accessories)
head_accessory_styles[++head_accessory_styles.len] = list("headaccessorystyle" = head_accessory_style)
data["head_accessory_styles"] = head_accessory_styles
- data["head_accessory_style"] = head_organ.ha_style
+ data["head_accessory_style"] = (head_organ ? head_organ.ha_style : "None")
data["change_hair"] = can_change(APPEARANCE_HAIR)
if(data["change_hair"])
@@ -179,7 +189,7 @@
for(var/hair_style in valid_hairstyles)
hair_styles[++hair_styles.len] = list("hairstyle" = hair_style)
data["hair_styles"] = hair_styles
- data["hair_style"] = head_organ.h_style
+ data["hair_style"] = (head_organ ? head_organ.h_style : "Skinhead")
data["change_facial_hair"] = can_change(APPEARANCE_FACIAL_HAIR)
if(data["change_facial_hair"])
@@ -187,7 +197,7 @@
for(var/facial_hair_style in valid_facial_hairstyles)
facial_hair_styles[++facial_hair_styles.len] = list("facialhairstyle" = facial_hair_style)
data["facial_hair_styles"] = facial_hair_styles
- data["facial_hair_style"] = head_organ.f_style
+ data["facial_hair_style"] = (head_organ ? head_organ.f_style : "Shaved")
data["change_markings"] = can_change_markings()
if(data["change_markings"])
@@ -233,6 +243,9 @@
return owner && (flags & APPEARANCE_SKIN) && (owner.species.bodyflags & HAS_SKIN_COLOR)
/datum/nano_module/appearance_changer/proc/can_change_head_accessory()
+ if(!head_organ)
+ log_debug("Missing head!")
+ return 0
return owner && (flags & APPEARANCE_HEAD_ACCESSORY) && (head_organ.species.bodyflags & HAS_HEAD_ACCESSORY)
/datum/nano_module/appearance_changer/proc/can_change_markings()
diff --git a/code/modules/space_management/space_chunk.dm b/code/modules/space_management/space_chunk.dm
index b7764e5673e..a150d25d2f3 100644
--- a/code/modules/space_management/space_chunk.dm
+++ b/code/modules/space_management/space_chunk.dm
@@ -1,3 +1,9 @@
+// I'd use consts here, but our coding standard is silly and demonizes usage
+// of that.
+#define BOTTOM_LEFT_CHUNK 1
+#define BOTTOM_RIGHT_CHUNK 2
+#define TOP_LEFT_CHUNK 3
+#define TOP_RIGHT_CHUNK 4
/datum/space_chunk
var/x
var/y
@@ -22,3 +28,8 @@
/datum/space_chunk/proc/return_turfs()
return
+
+#undef BOTTOM_LEFT_CHUNK
+#undef BOTTOM_RIGHT_CHUNK
+#undef TOP_LEFT_CHUNK
+#undef TOP_RIGHT_CHUNK
diff --git a/code/modules/surgery/organs/augments_eyes.dm b/code/modules/surgery/organs/augments_eyes.dm
index 679a98c98f4..549461caa4c 100644
--- a/code/modules/surgery/organs/augments_eyes.dm
+++ b/code/modules/surgery/organs/augments_eyes.dm
@@ -13,28 +13,9 @@
var/flash_protect = 0
var/aug_message = "Your vision is augmented!"
-/obj/item/organ/internal/cyberimp/eyes/proc/update_colour()
- if(!owner)
- return
- eye_colour = list(
- owner.r_eyes ? owner.r_eyes : 0,
- owner.g_eyes ? owner.g_eyes : 0,
- owner.b_eyes ? owner.b_eyes : 0
- )
-
/obj/item/organ/internal/cyberimp/eyes/insert(var/mob/living/carbon/M, var/special = 0)
..()
- if(istype(owner, /mob/living/carbon/human) && eye_colour)
- var/mob/living/carbon/human/HMN = owner
- old_eye_colour[1] = HMN.r_eyes
- old_eye_colour[2] = HMN.g_eyes
- old_eye_colour[2] = HMN.b_eyes
-
- HMN.r_eyes = eye_colour[1]
- HMN.g_eyes = eye_colour[2]
- HMN.b_eyes = eye_colour[3]
- HMN.update_eyes()
if(aug_message && !special)
to_chat(owner, "[aug_message]")
M.sight |= vision_flags
@@ -42,12 +23,6 @@
/obj/item/organ/internal/cyberimp/eyes/remove(var/mob/living/carbon/M, var/special = 0)
..()
M.sight ^= vision_flags
- if(istype(owner,/mob/living/carbon/human) && eye_colour)
- var/mob/living/carbon/human/HMN = owner
- HMN.r_eyes = old_eye_colour[1]
- HMN.g_eyes = old_eye_colour[2]
- HMN.b_eyes = old_eye_colour[3]
- HMN.update_eyes()
/obj/item/organ/internal/cyberimp/eyes/on_life()
..()
@@ -132,4 +107,4 @@
// Welding with thermals will still hurt your eyes a bit.
/obj/item/organ/internal/cyberimp/eyes/shield/emp_act(severity)
- return
\ No newline at end of file
+ return
diff --git a/code/modules/surgery/organs/organ_icon.dm b/code/modules/surgery/organs/organ_icon.dm
index 49777aa4a5c..d3690cb5740 100644
--- a/code/modules/surgery/organs/organ_icon.dm
+++ b/code/modules/surgery/organs/organ_icon.dm
@@ -55,13 +55,15 @@ var/global/list/limb_icon_cache = list()
overlays.Cut()
if(!owner)
return
- var/obj/item/organ/external/head/H = owner.get_organ("head")
if(species.has_organ["eyes"])
- var/obj/item/organ/internal/eyes/eyes = owner.get_int_organ(/obj/item/organ/internal/eyes)//owner.internal_organs_by_name["eyes"]
+ var/obj/item/organ/internal/eyes/eyes = owner.get_int_organ(/obj/item/organ/internal/eyes)
+ var/obj/item/organ/internal/cyberimp/eyes/eye_implant = owner.get_int_organ(/obj/item/organ/internal/cyberimp/eyes)
if(species.eyes)
var/icon/eyes_icon = new/icon('icons/mob/human_face.dmi', species.eyes)
- if(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)
+ else if(eyes)
eyes_icon.Blend(rgb(eyes.eye_colour[1], eyes.eye_colour[2], eyes.eye_colour[3]), ICON_ADD)
else
eyes_icon.Blend(rgb(128,0,0), ICON_ADD)
@@ -81,32 +83,32 @@ var/global/list/limb_icon_cache = list()
markings_s.Blend(rgb(owner.r_markings, owner.g_markings, owner.b_markings), ICON_ADD)
overlays |= markings_s
- if(H.ha_style)
- var/datum/sprite_accessory/head_accessory_style = head_accessory_styles_list[H.ha_style]
- if(head_accessory_style && head_accessory_style.species_allowed && (H.species.name in head_accessory_style.species_allowed))
+ if(ha_style)
+ var/datum/sprite_accessory/head_accessory_style = head_accessory_styles_list[ha_style]
+ 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(H.r_headacc, H.g_headacc, H.b_headacc), ICON_ADD)
+ head_accessory_s.Blend(rgb(r_headacc, g_headacc, b_headacc), ICON_ADD)
overlays |= head_accessory_s
- if(H.f_style)
- var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[H.f_style]
- if(facial_hair_style && ((facial_hair_style.species_allowed && (H.species.name in facial_hair_style.species_allowed)) || (src.species.flags & ALL_RPARTS)))
+ if(f_style)
+ var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style]
+ if(facial_hair_style && ((facial_hair_style.species_allowed && (species.name in facial_hair_style.species_allowed)) || (src.species.flags & ALL_RPARTS)))
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
- if(H.species.name == "Slime People") // I am el worstos
+ 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)
else if(facial_hair_style.do_colouration)
- facial_s.Blend(rgb(H.r_facial, H.g_facial, H.b_facial), ICON_ADD)
+ facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
overlays |= facial_s
- if(H.h_style && !(owner.head && (owner.head.flags & BLOCKHEADHAIR)))
- var/datum/sprite_accessory/hair_style = hair_styles_list[H.h_style]
- if(hair_style && ((H.species.name in hair_style.species_allowed) || (src.species.flags & ALL_RPARTS)))
+ if(h_style && !(owner.head && (owner.head.flags & BLOCKHEADHAIR)))
+ var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
+ if(hair_style && ((species.name in hair_style.species_allowed) || (src.species.flags & ALL_RPARTS)))
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
- if(H.species.name == "Slime People") // I am el worstos
+ 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)
else if(hair_style.do_colouration)
- hair_s.Blend(rgb(H.r_hair, H.g_hair, H.b_hair), ICON_ADD)
+ hair_s.Blend(rgb(r_hair, g_hair, b_hair), 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 9c28a60b055..990c807f0aa 100644
--- a/code/modules/surgery/organs/organ_internal.dm
+++ b/code/modules/surgery/organs/organ_internal.dm
@@ -335,23 +335,14 @@
var/list/eye_colour = list(0,0,0)
/obj/item/organ/internal/eyes/proc/update_colour()
- if(!owner)
- return
- eye_colour = list(
- owner.r_eyes ? owner.r_eyes : 0,
- owner.g_eyes ? owner.g_eyes : 0,
- owner.b_eyes ? owner.b_eyes : 0
- )
+ dna.write_eyes_attributes(src)
/obj/item/organ/internal/eyes/insert(mob/living/carbon/M, special = 0)
-// Apply our eye colour to the target.
- if(istype(M) && eye_colour)
- var/mob/living/carbon/human/eyes = M
- eyes.r_eyes = eye_colour[1]
- eyes.g_eyes = eye_colour[2]
- eyes.b_eyes = eye_colour[3]
- eyes.update_eyes()
..()
+ if(istype(M) && eye_colour)
+ var/mob/living/carbon/human/H = M
+ // Apply our eye colour to the target.
+ H.update_body()
/obj/item/organ/internal/eyes/surgeryize()
if(!owner)
diff --git a/code/modules/surgery/organs/subtypes/standard.dm b/code/modules/surgery/organs/subtypes/standard.dm
index 1c6240318fe..2c2d3fa124c 100644
--- a/code/modules/surgery/organs/subtypes/standard.dm
+++ b/code/modules/surgery/organs/subtypes/standard.dm
@@ -193,3 +193,7 @@
disfigure("brute")
if(burn_dam > 40)
disfigure("burn")
+
+/obj/item/organ/external/head/set_dna(datum/dna/new_dna)
+ ..()
+ new_dna.write_head_attributes(src)
diff --git a/paradise.dme b/paradise.dme
index 58f09d246ae..c278b8d03b9 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -1041,6 +1041,7 @@
#include "code\modules\admin\verbs\vox_raiders.dm"
#include "code\modules\admin\verbs\SDQL2\SDQL_2.dm"
#include "code\modules\admin\verbs\SDQL2\SDQL_2_parser.dm"
+#include "code\modules\admin\verbs\SDQL2\useful_procs.dm"
#include "code\modules\alarm\alarm.dm"
#include "code\modules\alarm\alarm_handler.dm"
#include "code\modules\alarm\atmosphere_alarm.dm"