Adds handling for sampling blood inside reagent containers with a swab. (#9739)

This commit is contained in:
mikomyazaki
2020-08-21 20:28:47 +02:00
committed by GitHub
parent 3b8a718651
commit 37225d23d4
4 changed files with 55 additions and 7 deletions
+26 -7
View File
@@ -1,3 +1,8 @@
#define EVIDENCE_TYPE_BLOOD "Blood"
#define EVIDENCE_TYPE_GSR "Gunshot Residue"
#define EVIDENCE_TYPE_SALIVA "Saliva"
#define EVIDENCE_TYPE_ADDITIONAL "Additional"
/obj/item/forensics/swab
name = "swab kit"
desc = "A sterilized cotton swab and vial used to take forensic samples."
@@ -81,11 +86,14 @@
var/list/choices = list()
if(A.blood_DNA)
choices |= "Blood"
choices |= EVIDENCE_TYPE_BLOOD
if(istype(A, /obj/item/clothing))
choices |= "Gunshot Residue"
choices |= EVIDENCE_TYPE_GSR
if(LAZYLEN(A.other_DNA) && A.other_DNA_type == "saliva")
choices |= "Saliva"
choices |= EVIDENCE_TYPE_SALIVA
var/list/list/additional_evidence = A.get_additional_forensics_swab_info()
if(additional_evidence && additional_evidence["type"] != "")
choices |= EVIDENCE_TYPE_ADDITIONAL + " - " + additional_evidence["type"]
var/choice
if(!choices.len)
@@ -100,13 +108,14 @@
return
var/sample_type
var/sample_message
switch (choice)
if ("Blood")
if (EVIDENCE_TYPE_BLOOD)
if(!A.blood_DNA || !A.blood_DNA.len) return
dna = A.blood_DNA.Copy()
sample_type = "blood"
if ("Gunshot Residue")
if (EVIDENCE_TYPE_GSR)
var/obj/item/clothing/B = A
if(!istype(B) || !B.gunshot_residue)
to_chat(user, "<span class='warning'>There is no residue on \the [A].</span>")
@@ -114,13 +123,23 @@
gsr = B.gunshot_residue
sample_type = "residue"
if ("Saliva")
if (EVIDENCE_TYPE_SALIVA)
if (!LAZYLEN(A.other_DNA)) return
dna = A.other_DNA.Copy()
sample_type = "saliva"
else //additional evidence
if(additional_evidence["dna"].len)
dna = additional_evidence["dna"].Copy()
if(additional_evidence["gsr"])
gsr = additional_evidence["gsr"]
sample_type = additional_evidence["sample_type"]
if(!sample_type)
crash_with("[user] swabbed \the [A.name] for additional evidence but there was no sample_type defined!")
sample_message = additional_evidence["sample_message"]
if(sample_type)
user.visible_message("\The [user] swabs \the [A] for a sample.", "You swab \the [A] for a sample.")
user.visible_message("\The [user] swabs \the [A] for a sample.", sample_message || "You swab \the [A] for a sample.")
set_used(sample_type, A)
/obj/item/forensics/swab/proc/set_used(var/sample_str, var/atom/source)
@@ -40,6 +40,17 @@
if(!is_open_container())
to_chat(user, "<span class='notice'>Airtight lid seals it completely.</span>")
/obj/item/reagent_containers/glass/get_additional_forensics_swab_info()
var/list/additional_evidence = ..()
var/datum/reagent/blood/B = locate() in reagents.reagent_list
if(B)
additional_evidence["type"] = EVIDENCE_TYPE_BLOOD
additional_evidence["sample_type"] = "blood"
additional_evidence["dna"] += B.data["blood_DNA"]
additional_evidence["sample_message"] = "You dip the swab inside \the [src.name] to sample its contents."
return additional_evidence
/obj/item/reagent_containers/glass/attack_self()
..()
if(is_open_container())