add support for custom blood colours

This commit is contained in:
Timothy Teakettle
2020-06-26 20:29:40 +01:00
parent 79a8be2c65
commit 334d55bef3
15 changed files with 28 additions and 15 deletions
+8 -7
View File
@@ -446,8 +446,10 @@
return
var/list/blood_dna = list()
if(dna)
blood_dna["color"] = list(dna.species.exotic_blood_color) //so when combined, the list grows with the number of colors
blood_dna[dna.unique_enzymes] = dna.blood_type
else
blood_dna["color"] = list(BLOOD_COLOR_HUMAN)
blood_dna["UNKNOWN DNA"] = "X*"
return blood_dna
@@ -544,23 +546,22 @@
/atom/proc/blood_DNA_to_color()
var/list/colors = list()//first we make a list of all bloodtypes present
for(var/bloop in blood_DNA)
if(colors[blood_DNA[bloop]])
colors[blood_DNA[bloop]]++
for(var/blood_color in blood_DNA["color"])
if(colors[blood_color])
colors[blood_color]++
else
colors[blood_DNA[bloop]] = 1
colors[blood_color] = 1
var/final_rgb = BLOOD_COLOR_HUMAN //a default so we don't have white blood graphics if something messed up
if(colors.len)
var/sum = 0 //this is all shitcode, but it works; trust me
final_rgb = bloodtype_to_color(colors[1])
final_rgb = colors[1]
sum = colors[colors[1]]
if(colors.len > 1)
var/i = 2
while(i <= colors.len)
var/tmp = colors[colors[i]]
final_rgb = BlendRGB(final_rgb, bloodtype_to_color(colors[i]), tmp/(tmp+sum))
final_rgb = BlendRGB(final_rgb, colors[i], tmp/(tmp+sum))
sum += tmp
i++
@@ -91,7 +91,7 @@
var/mob/living/carbon/human/H = O
var/obj/item/clothing/shoes/S = H.shoes
if(S && S.bloody_shoes[blood_state])
if(color != bloodtype_to_color(S.last_bloodtype))
if(color != S.last_blood_color)
return
S.bloody_shoes[blood_state] = max(S.bloody_shoes[blood_state] - BLOOD_LOSS_PER_STEP, 0)
shoe_types |= S.type
@@ -104,7 +104,7 @@
var/mob/living/carbon/human/H = O
var/obj/item/clothing/shoes/S = H.shoes
if(S && S.bloody_shoes[blood_state])
if(color != bloodtype_to_color(S.last_bloodtype))//last entry - we check its color
if(color != S.last_blood_color)//last entry - we check its color
return
S.bloody_shoes[blood_state] = max(S.bloody_shoes[blood_state] - BLOOD_LOSS_PER_STEP, 0)
shoe_types |= S.type