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

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++

View File

@@ -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

View File

@@ -18,6 +18,7 @@
mutantrace_variation = STYLE_DIGITIGRADE
var/last_bloodtype = "" //used to track the last bloodtype to have graced these shoes; makes for better performing footprint shenanigans
var/last_blood_DNA = "" //same as last one
var/last_blood_color = ""
/obj/item/clothing/shoes/ComponentInitialize()
. = ..()
@@ -48,6 +49,7 @@
if(blood_dna.len)
last_bloodtype = blood_dna[blood_dna[blood_dna.len]]//trust me this works
last_blood_DNA = blood_dna[blood_dna.len]
last_blood_color = blood_dna["color"]
/obj/item/clothing/shoes/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = ..()

View File

@@ -188,7 +188,7 @@
blood_data["viruses"] += D.Copy()
blood_data["blood_DNA"] = dna.unique_enzymes
blood_data["bloodcolor"] = bloodtype_to_color(dna.blood_type)
blood_data["bloodcolor"] = dna.species.exotic_blood_color
if(disease_resistances && disease_resistances.len)
blood_data["resistances"] = disease_resistances.Copy()
var/list/temp_chem = list()

View File

@@ -77,7 +77,7 @@
var/turf/T = get_turf(src)
if(S.bloody_shoes && S.bloody_shoes[S.blood_state])
var/obj/effect/decal/cleanable/blood/footprints/oldFP = locate(/obj/effect/decal/cleanable/blood/footprints) in T
if(oldFP && (oldFP.blood_state == S.blood_state && oldFP.color == bloodtype_to_color(S.last_bloodtype)))
if(oldFP && (oldFP.blood_state == S.blood_state && oldFP.color == S.last_blood_color))
return
S.bloody_shoes[S.blood_state] = max(0, S.bloody_shoes[S.blood_state] - BLOOD_LOSS_PER_STEP)
var/obj/effect/decal/cleanable/blood/footprints/FP = new /obj/effect/decal/cleanable/blood/footprints(T)
@@ -86,6 +86,7 @@
FP.bloodiness = S.bloody_shoes[S.blood_state]
if(S.last_bloodtype)
FP.blood_DNA += list(S.last_blood_DNA = S.last_bloodtype)
FP.blood_DNA["colors"] += S.last_blood_color
FP.update_icon()
update_inv_shoes()
//End bloody footprints

View File

@@ -39,6 +39,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
var/use_skintones = NO_SKINTONES // does it use skintones or not? (spoiler alert this is only used by humans)
var/exotic_blood = "" // If your race wants to bleed something other than bog standard blood, change this to reagent id.
var/exotic_bloodtype = "" //If your race uses a non standard bloodtype (A+, O-, AB-, etc)
var/exotic_blood_color = BLOOD_COLOR_HUMAN //assume human as the default blood colour, override this default by species subtypes
var/meat = /obj/item/reagent_containers/food/snacks/meat/slab/human //What the species drops on gibbing
var/list/gib_types = list(/obj/effect/gibspawner/human, /obj/effect/gibspawner/human/bodypartless)
var/skinned_type

View File

@@ -15,6 +15,7 @@
disliked_food = TOXIC
icon_limbs = DEFAULT_BODYPART_ICON_CITADEL
exotic_bloodtype = "BUG"
exotic_blood_color = BLOOD_COLOR_BUG
/datum/species/insect/spec_death(gibbed, mob/living/carbon/human/H)
if(H)

View File

@@ -11,6 +11,7 @@
disliked_food = null
liked_food = GROSS
exotic_bloodtype = "BUG"
exotic_blood_color = BLOOD_COLOR_BUG
/datum/species/fly/handle_chemicals(datum/reagent/chem, mob/living/carbon/human/H)
if(istype(chem, /datum/reagent/toxin/pestkiller))

View File

@@ -20,6 +20,7 @@
mutanteyes = /obj/item/organ/eyes/ipc
exotic_bloodtype = "HF"
exotic_blood_color = BLOOD_COLOR_OIL
var/datum/action/innate/monitor_change/screen

View File

@@ -13,6 +13,7 @@
gib_types = list(/obj/effect/gibspawner/slime, /obj/effect/gibspawner/slime/bodypartless)
exotic_blood = /datum/reagent/blood/jellyblood
exotic_bloodtype = "GEL"
exotic_blood_color = "BLOOD_COLOR_SLIME"
damage_overlay_type = ""
var/datum/action/innate/regenerate_limbs/regenerate_limbs
var/datum/action/innate/slime_change/slime_change //CIT CHANGE

View File

@@ -21,6 +21,7 @@
gib_types = list(/obj/effect/gibspawner/lizard, /obj/effect/gibspawner/lizard/bodypartless)
skinned_type = /obj/item/stack/sheet/animalhide/lizard
exotic_bloodtype = "L"
exotic_blood_color = BLOOD_COLOR_LIZARD
disliked_food = GRAIN | DAIRY
liked_food = GROSS | MEAT
inert_mutation = FIREBREATH

View File

@@ -18,7 +18,7 @@
mutanteyes = /obj/item/organ/eyes/ipc
exotic_bloodtype = "S"
exotic_blood_color = BLOOD_COLOR_OIL
/datum/species/synthliz/qualifies_for_rank(rank, list/features)
return TRUE

View File

@@ -68,7 +68,7 @@
var/dam_colors = "#E62525"
if(ishuman(src))
var/mob/living/carbon/human/H = src
dam_colors = bloodtype_to_color(H.dna.blood_type)
dam_colors = H.dna.species.exotic_blood_color
var/mutable_appearance/damage_overlay = mutable_appearance('icons/mob/dam_mob.dmi', "blank", -DAMAGE_LAYER, color = dam_colors)
overlays_standing[DAMAGE_LAYER] = damage_overlay
@@ -193,6 +193,9 @@
/mob/living/carbon/update_body()
update_body_parts()
// snowflakey thing: update blood colour if a slimeperson
if(isjellyperson(src))
dna.species.exotic_blood_color = "#" + dna.features["mcolor"]
/mob/living/carbon/proc/update_body_parts()
//CHECK FOR UPDATE

View File

@@ -239,7 +239,7 @@
else
if(ishuman(target))
var/mob/living/carbon/human/H = target
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target_loca, splatter_dir, bloodtype_to_color(H.dna.blood_type))
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target_loca, splatter_dir, H.dna.species.exotic_blood_color)
else
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target_loca, splatter_dir, bloodtype_to_color())

View File

@@ -77,7 +77,7 @@
/datum/reagent/blood/on_new(list/data)
if(istype(data))
SetViruses(src, data)
color = bloodtype_to_color(data["blood_type"])
color = data["bloodcolor"]
if(data["blood_type"] == "SY")
name = "Synthetic Blood"
taste_description = "oil"