Files
Aurora.3/code/modules/reagents/Chemistry-Colours.dm
DreamySkrell 65b9a5f516 Synthetic Blood Substitute (#19381)
![image](https://github.com/Aurorastation/Aurora.3/assets/107256943/56844752-b8d9-402c-87aa-735481d0a3ef)

![image](https://github.com/Aurorastation/Aurora.3/assets/107256943/a961b871-0dc4-40da-827a-27041a823028)


changes:
  - rscadd: "Adds Synthetic Blood Substitute."

other info:
- ~~shell IPCs have white blood (other IPCs keep their black oil
blood)~~ (removed/reverted on request, shells keep black oil blood, no
change here with this PR)
- organics can optionally pick the SBS blood type to get white blood
- this is intended mainly for heavily augmented organics, and you have
to be have at least 8 augmented organs or limbs
- white blood has no mechanical differences (positive or negative)
represented in game, as it is supposed to still just be blood (but with
potentially better characteristics)
- white blood is incompatible with red blood, both ways, including organ
transplantations

---------

Co-authored-by: DreamySkrell <>
2024-06-20 10:18:39 +00:00

37 lines
1.3 KiB
Plaintext

/datum/reagents/proc/get_color()
if(!LAZYLEN(reagent_volumes))
return "#ffffffff"
if(reagent_volumes.len == 1) // It's pretty common and saves a lot of work
var/singleton/reagent/R = GET_SINGLETON(reagent_volumes[1])
return R.get_color(src)
var/list/colors = list(0, 0, 0, 0)
var/tot_w = 0
for(var/rtype in reagent_volumes)
var/singleton/reagent/R = GET_SINGLETON(rtype)
if(R.color_weight <= 0)
continue
var/hex = uppertext(R.color)
if(length(hex) == 7)
hex += "FF"
var/mod = REAGENT_VOLUME(src, rtype) * R.color_weight
colors[1] += hex2num(copytext(hex, 2, 4)) * mod
colors[2] += hex2num(copytext(hex, 4, 6)) * mod
colors[3] += hex2num(copytext(hex, 6, 8)) * mod
colors[4] += hex2num(copytext(hex, 8, 10)) * mod
tot_w += mod
return rgb(colors[1] / tot_w, colors[2] / tot_w, colors[3] / tot_w, colors[4] / tot_w)
/singleton/reagent/proc/get_color(var/datum/reagents/holder)
return color
/singleton/reagent/blood/get_color(var/datum/reagents/holder)
if(!holder || isemptylist(REAGENT_DATA(holder, type)))
return color
if(LAZYACCESS(holder.reagent_data[type], "blood_type") == "SBS") // synthetic blood substitute
return COLOR_SYNTH_BLOOD
return LAZYACCESS(holder.reagent_data[type], "blood_colour") || color // return default colour if not set