99 lines
2.8 KiB
Plaintext
99 lines
2.8 KiB
Plaintext
/obj/item/reagent_containers/blood
|
|
name = "blood pack"
|
|
desc = "Contains blood used for transfusion. Must be attached to an IV drip."
|
|
icon = 'icons/obj/bloodpack.dmi'
|
|
icon_state = "bloodpack"
|
|
volume = 200
|
|
var/blood_type = null
|
|
var/labelled = 0
|
|
var/color_to_apply = "#FFFFFF"
|
|
var/mutable_appearance/fill_overlay
|
|
|
|
/obj/item/reagent_containers/blood/Initialize()
|
|
. = ..()
|
|
if(blood_type != null)
|
|
reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_colour"=color, "blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/blood/on_reagent_change(changetype)
|
|
if(reagents)
|
|
var/datum/reagent/blood/B = reagents.has_reagent("blood")
|
|
if(B && B.data && B.data["blood_type"])
|
|
blood_type = B.data["blood_type"]
|
|
color_to_apply = bloodtype_to_color(blood_type)
|
|
else
|
|
blood_type = null
|
|
update_pack_name()
|
|
update_icon()
|
|
|
|
/obj/item/reagent_containers/blood/proc/update_pack_name()
|
|
if(!labelled)
|
|
if(blood_type)
|
|
name = "blood pack - [blood_type]"
|
|
else
|
|
name = "blood pack"
|
|
|
|
/obj/item/reagent_containers/blood/update_icon()
|
|
cut_overlays()
|
|
|
|
var/v = min(round(reagents.total_volume / volume * 10), 10)
|
|
if(v > 0)
|
|
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "bloodpack1")
|
|
filling.icon_state = "bloodpack[v]"
|
|
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
|
add_overlay(filling)
|
|
|
|
/obj/item/reagent_containers/blood/random
|
|
icon_state = "random_bloodpack"
|
|
|
|
/obj/item/reagent_containers/blood/random/Initialize()
|
|
icon_state = "bloodpack"
|
|
blood_type = pick("A+", "A-", "B+", "B-", "O+", "O-", "L", "SY")
|
|
return ..()
|
|
|
|
/obj/item/reagent_containers/blood/APlus
|
|
blood_type = "A+"
|
|
|
|
/obj/item/reagent_containers/blood/AMinus
|
|
blood_type = "A-"
|
|
|
|
/obj/item/reagent_containers/blood/BPlus
|
|
blood_type = "B+"
|
|
|
|
/obj/item/reagent_containers/blood/BMinus
|
|
blood_type = "B-"
|
|
|
|
/obj/item/reagent_containers/blood/OPlus
|
|
blood_type = "O+"
|
|
|
|
/obj/item/reagent_containers/blood/OMinus
|
|
blood_type = "O-"
|
|
|
|
/obj/item/reagent_containers/blood/lizard
|
|
blood_type = "L"
|
|
|
|
/obj/item/reagent_containers/blood/universal
|
|
blood_type = "U"
|
|
|
|
/obj/item/reagent_containers/blood/synthetics
|
|
blood_type = "SY"
|
|
|
|
/obj/item/reagent_containers/blood/attackby(obj/item/I, mob/user, params)
|
|
if (istype(I, /obj/item/pen) || istype(I, /obj/item/toy/crayon))
|
|
if(!user.is_literate())
|
|
to_chat(user, "<span class='notice'>You scribble illegibly on the label of [src]!</span>")
|
|
return
|
|
var/t = stripped_input(user, "What would you like to label the blood pack?", name, null, 53)
|
|
if(!user.canUseTopic(src, BE_CLOSE))
|
|
return
|
|
if(user.get_active_held_item() != I)
|
|
return
|
|
if(t)
|
|
labelled = 1
|
|
name = "blood pack - [t]"
|
|
else
|
|
labelled = 0
|
|
update_pack_name()
|
|
else
|
|
return ..()
|