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.
This commit is contained in:
KasparoVy
2017-07-22 19:59:58 -04:00
parent b31f38796a
commit a6bb591b46
24 changed files with 346 additions and 621 deletions
+5 -6
View File
@@ -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..."
@@ -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
+14 -14
View File
@@ -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
@@ -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()
@@ -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()