improves detective QOL and code quality (#31462)

* improves detective QOL and code quality

* small fixes

* desc fix

* pollard review
This commit is contained in:
Contrabang
2026-02-23 17:40:57 +00:00
committed by GitHub
parent 75cc35153b
commit d6c34ac3a9
7 changed files with 327 additions and 282 deletions
+288 -99
View File
@@ -3,7 +3,7 @@
/obj/item/evidencebag
name = "evidence bag"
desc = "An empty evidence bag."
icon = 'icons/obj/storage.dmi'
icon = 'icons/obj/forensics/forensics.dmi'
icon_state = "evidenceobj"
w_class = WEIGHT_CLASS_TINY
@@ -14,7 +14,7 @@
/obj/item/evidencebag/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(evidencebagEquip(I, user))
return 1
return TRUE
/obj/item/evidencebag/proc/evidencebagEquip(obj/item/I, mob/user)
if(!istype(I) || I.anchored)
@@ -46,56 +46,69 @@
user.visible_message(SPAN_NOTICE("[user] puts [I] into [src]."), SPAN_NOTICE("You put [I] inside [src]."),\
SPAN_NOTICE("You hear a rustle as someone puts something into a plastic bag."))
icon_state = "evidence"
var/xx = I.pixel_x //save the offset of the item
var/yy = I.pixel_y
I.pixel_x = 0 //then remove it so it'll stay within the evidence bag
I.pixel_y = 0
var/image/img = image("icon"=I, "layer"=FLOAT_LAYER) //take a snapshot. (necessary to stop the underlays appearing under our inventory-HUD slots ~Carn
img.plane = FLOAT_PLANE
I.pixel_x = xx //and then return it
I.pixel_y = yy
overlays += img
overlays += "evidence" //should look nicer for transparent stuff. not really that important, but hey.
desc = "An evidence bag containing [I]. [I.desc]"
I.loc = src
I.forceMove(src)
w_class = I.w_class
return 1
update_appearance(UPDATE_ICON_STATE|UPDATE_OVERLAYS|UPDATE_DESC)
return TRUE
/obj/item/evidencebag/attack_self__legacy__attackchain(mob/user)
if(length(contents))
var/obj/item/I = contents[1]
user.visible_message(SPAN_NOTICE("[user] takes [I] out of [src]."), SPAN_NOTICE("You take [I] out of [src]."),\
SPAN_NOTICE("You hear someone rustle around in a plastic bag, and remove something."))
overlays.Cut() //remove the overlays
user.put_in_hands(I)
I.pickup(user)
w_class = WEIGHT_CLASS_TINY
icon_state = "evidenceobj"
desc = "An empty evidence bag."
else
if(!length(contents))
to_chat(user, "[src] is empty.")
icon_state = "evidenceobj"
return
var/obj/item/I = contents[1]
user.visible_message(SPAN_NOTICE("[user] takes [I] out of [src]."), SPAN_NOTICE("You take [I] out of [src]."),\
SPAN_NOTICE("You hear someone rustle around in a plastic bag, and remove something."))
user.put_in_hands(I)
I.pickup(user)
w_class = WEIGHT_CLASS_TINY
update_appearance(UPDATE_ICON_STATE|UPDATE_OVERLAYS|UPDATE_DESC)
/obj/item/evidencebag/update_icon_state()
if(length(contents))
icon_state = "evidence"
else
icon_state = "evidenceobj"
/obj/item/evidencebag/update_overlays()
. = ..()
if(!length(contents))
return
var/obj/item/I = contents[1]
var/image/img = image("icon"=I, "layer"=FLOAT_LAYER) // take a snapshot. (necessary to stop the underlays appearing under our inventory-HUD slots ~Carn
img.plane = FLOAT_PLANE
img.pixel_x = 0
img.pixel_y = 0
. += img
. += "evidence" // should look nicer for transparent stuff. not really that important, but hey.
/obj/item/evidencebag/update_desc(updates)
. = ..()
if(length(contents))
var/obj/item/I = contents[1]
desc = "An evidence bag containing [I]. [I.desc]"
else
desc = initial(desc)
/obj/item/sample
name = "\improper Forensic sample"
desc = ABSTRACT_TYPE_DESC
icon = 'icons/obj/forensics/forensics.dmi'
w_class = WEIGHT_CLASS_TINY
var/list/evidence = list()
new_attack_chain = TRUE
var/list/evidence = list()
/obj/item/sample/Initialize(mapload, atom/supplied)
. = ..()
if(supplied)
transfer_evidence(supplied)
name = "[initial(name)] ([supplied])"
update_icon(UPDATE_ICON_STATE)
if(length(evidence))
icon_state = "fingerprint1"
update_icon()
/obj/item/sample/proc/report(obj/item/paper/report, obj/machinery/analyzer, report_num)
report.name = "ERR. No Sample Found"
report.info = "<b>[analyzer] was not able to finalize a report.</b>"
return FALSE
/obj/item/sample/proc/transfer_evidence(atom/supplied)
if(length(supplied.suit_fibers))
@@ -110,18 +123,6 @@
to_chat(user, SPAN_NOTICE("You add [supplied] to [src]."))
return TRUE
/obj/item/sample/print/merge_evidence(obj/item/sample/supplied, mob/user)
if(!supplied || !length(supplied.evidence))
return FALSE
for(var/print in supplied.evidence)
if(evidence[print])
evidence[print] = stringmerge(evidence[print], supplied.evidence[print])
else
evidence[print] = supplied.evidence[print]
name = "[initial(name)] (combined)"
to_chat(user, SPAN_NOTICE("You overlay [src] and [supplied], combining the print records."))
return TRUE
/obj/item/sample/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, src.type))
user.unequip(used)
@@ -132,19 +133,30 @@
/obj/item/sample/print
name = "fingerprint card"
desc = "Preserves fingerprints."
icon = 'icons/obj/card.dmi'
icon_state = "fingerprint0"
desc = "A stiff paper card for preserving fingerprints. This one is unused."
icon_state = "fingerprint"
inhand_icon_state = "paper"
/// boolean variable, indicates if print card is in the used state
var/used
/// if true, the print was pulled instead of being manually pressed.
var/pulled = FALSE
/obj/item/sample/print/update_icon_state()
. = ..()
icon_state = "fingerprint0"
if(used)
icon_state = "fingerprint1"
if(!length(evidence))
icon_state = "fingerprint"
return
if(pulled)
icon_state = "fingerprint_pulled"
return
icon_state = "fingerprint_pressed"
/obj/item/sample/print/update_desc()
. = ..()
if(!length(evidence))
desc = initial(desc)
return
if(pulled)
desc = "A stiff paper card for preserving fingerprints. This one has been used for pulling prints with fingerprint powder."
return
desc = "A stiff paper card for preserving fingerprints. This one has been used manually printed."
/obj/item/sample/print/activate_self(mob/user)
if(..() || length(evidence) || !ishuman(user))
@@ -159,57 +171,98 @@
var/fullprint = H.get_full_print()
evidence[fullprint] = fullprint
name = "[initial(name)] ([H])"
used = TRUE
update_icon(UPDATE_ICON_STATE)
update_appearance(UPDATE_ICON_STATE|UPDATE_DESC)
/obj/item/sample/print/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(!ishuman(target))
return ..()
var/mob/living/carbon/human/H = target
if(user.zone_selected == "r_hand" || user.zone_selected == "l_hand")
if(!ishuman(target))
return ..()
if(length(evidence))
return ITEM_INTERACT_COMPLETE
if(H.gloves)
to_chat(user, SPAN_WARNING("[H] is wearing gloves."))
return ITEM_INTERACT_COMPLETE
if(user != H && H.stat == CONSCIOUS && !H.restrained())
user.visible_message(SPAN_DANGER("[user] tried to fingerprint [H], but he resists."))
return ITEM_INTERACT_COMPLETE
var/has_hand = (H.has_organ("r_hand") || H.has_organ("l_hand"))
if(!has_hand)
to_chat(user, SPAN_WARNING("[H] has no hands!"))
return ITEM_INTERACT_COMPLETE
if(!do_after(user, 2 SECONDS, target = H))
return ITEM_INTERACT_COMPLETE
user.visible_message(SPAN_NOTICE("[user] makes a copy of [H]'s fingerprints'."))
var/fullprint = H.get_full_print()
evidence[fullprint] = fullprint
transfer_evidence(src)
name = "[initial(name)] ([H])"
used = TRUE
update_appearance(UPDATE_ICON_STATE)
if(user.zone_selected != "r_hand" && user.zone_selected != "l_hand")
to_chat(user, SPAN_WARNING("You need to target [H]'s hands to obtain fingerprints!"))
return ITEM_INTERACT_COMPLETE
else
to_chat(user, SPAN_WARNING("You need to target [H]'s hands to obtain fingerprints!'."))
if(length(evidence))
return ITEM_INTERACT_COMPLETE
if(H.gloves)
to_chat(user, SPAN_WARNING("[H] is wearing gloves."))
return ITEM_INTERACT_COMPLETE
if(user != H && H.stat == CONSCIOUS && !H.restrained())
user.visible_message(SPAN_DANGER("[user] tried to fingerprint [H], but he resists."))
return ITEM_INTERACT_COMPLETE
var/has_hand = (H.has_organ("r_hand") || H.has_organ("l_hand"))
if(!has_hand)
to_chat(user, SPAN_WARNING("[H] has no hands!"))
return ITEM_INTERACT_COMPLETE
if(!do_after(user, 2 SECONDS, target = H))
return ITEM_INTERACT_COMPLETE
user.visible_message(SPAN_NOTICE("[user] makes a copy of [H]'s fingerprints'."))
var/fullprint = H.get_full_print()
evidence[fullprint] = fullprint
transfer_evidence(src)
name = "[initial(name)] ([H])"
update_appearance(UPDATE_ICON_STATE|UPDATE_DESC)
return ITEM_INTERACT_COMPLETE
/obj/item/sample/print/transfer_evidence(atom/supplied)
if(length(supplied.fingerprints))
for(var/print in supplied.fingerprints)
evidence[print] = supplied.fingerprints[print]
supplied.fingerprints.Cut()
if(!length(supplied.fingerprints))
return
for(var/print in supplied.fingerprints)
evidence[print] = supplied.fingerprints[print]
supplied.fingerprints.Cut()
/obj/item/sample/print/merge_evidence(obj/item/sample/supplied, mob/user)
if(!supplied || !length(supplied.evidence))
return FALSE
for(var/print in supplied.evidence)
if(evidence[print])
evidence[print] = stringmerge(evidence[print], supplied.evidence[print])
else
evidence[print] = supplied.evidence[print]
name = "[initial(name)] (combined)"
to_chat(user, SPAN_NOTICE("You overlay [src] and [supplied], combining the print records."))
return TRUE
/obj/item/sample/print/report(obj/item/paper/report, obj/machinery/analyzer, report_num)
if(!istype(analyzer, /obj/machinery/microscope))
return ..()
report.name = "Fingerprint Analysis Report No. [report_num]: [name]"
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Fingerprint Analysis Report No. [report_num]</b>: [name]<br>"
if(length(evidence))
report.info += "<br>Surface analysis identified the following unique fingerprints:<br>"
for(var/prints in evidence)
report.info += SPAN_NOTICE("Fingerprint: ")
if(stringpercent(prints) > 6) // if theres 6 or more *, then the print is unreadable
report.info += "INCOMPLETE PRINT<br>"
else
report.info += "[prints]<br>"
else
report.info += "No analysis information available."
/obj/item/sample/fibers
name = "fiber bag"
desc = "Used to store fiber evidence for forensic examianation."
icon_state = "fiberbag"
/obj/item/sample/fibers/report(obj/item/paper/report, obj/machinery/analyzer, report_num)
if(!istype(analyzer, /obj/machinery/microscope))
return ..()
report.name = "Report on fiber sample no. [report_num]: [name]"
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Analyzed object:</b><br>[name]<br><br>"
if(evidence)
report.info += "Molecular analysis on the provided sample determined the presence of the following unique fiber strands:<br>"
for(var/fiber in evidence)
report.info += SPAN_NOTICE("Most Likely Match: [fiber]<br>")
else
report.info += "No fibers found."
/obj/item/forensics
icon = 'icons/obj/forensics/forensics.dmi'
w_class = WEIGHT_CLASS_TINY
@@ -217,19 +270,21 @@
/obj/item/forensics/sample_kit
name = "fiber collection kit"
desc = "A magnifying glass and pair of tweezers. Used to lift fabric fibers from crime scene objects. Use on harm intent to collect samples without disturbing the scene."
desc = "A magnifying glass and pair of tweezers. Used to lift fabric fibers from crime scene objects. Use on <b>harm intent</b> to collect samples without disturbing the scene."
icon_state = "m_glass"
w_class = WEIGHT_CLASS_SMALL
/// naming for individual evidence items
var/evidence_type = "fibers"
var/evidence_type = "fiber"
var/evidence_path = /obj/item/sample/fibers
/obj/item/forensics/sample_kit/proc/can_take_sample(mob/user, atom/supplied)
return length(supplied.suit_fibers)
/obj/item/forensics/sample_kit/proc/take_sample(mob/user, atom/supplied)
var/obj/item/sample/S = new evidence_path(get_turf(user))
S.transfer_evidence(supplied)
to_chat(user, SPAN_NOTICE("You move [S.evidence.len] [S.evidence.len > 1 ? "[evidence_type]s" : "[evidence_type]"] into [S]."))
to_chat(user, SPAN_NOTICE("You move [S.evidence.len] [evidence_type]\s into [S]."))
return S
/obj/item/forensics/sample_kit/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(user.a_intent != INTENT_HARM)
@@ -238,7 +293,7 @@
if(can_take_sample(user, target))
take_sample(user, target)
else
to_chat(user, SPAN_WARNING("You cannot find [evidence_type] on [target]."))
to_chat(user, SPAN_WARNING("You cannot find [evidence_type]s on [target]."))
return ITEM_INTERACT_COMPLETE
/obj/item/forensics/sample_kit/MouseDrop(atom/over)
@@ -247,10 +302,144 @@
/obj/item/forensics/sample_kit/powder
name = "fingerprint powder"
desc = "A jar of aluminum powder and a specialized brush. Use on harm intent to collect samples without leaving additional prints."
desc = "A jar of aluminum powder and a specialized brush. Use on <b>harm intent</b> to collect samples without leaving additional prints."
icon_state = "dust"
evidence_type = "prints"
evidence_type = "print"
evidence_path = /obj/item/sample/print
/obj/item/forensics/sample_kit/powder/can_take_sample(mob/user, atom/supplied)
return length(supplied.fingerprints)
/obj/item/forensics/sample_kit/powder/take_sample(mob/user, atom/supplied)
var/obj/item/sample/print/printcard = ..()
if(!istype(printcard))
return
printcard.pulled = TRUE
printcard.update_appearance(UPDATE_ICON_STATE|UPDATE_DESC)
/obj/item/forensics/swab
name = "sample collection kit"
desc = "An unused sterile cotton swab and test tube for collecting DNA samples and gunpowder residue."
icon_state = "swab"
materials = list(MAT_METAL = 500, MAT_GLASS = 250)
/// currently in machine
var/dispenser = FALSE
/obj/item/forensics/swab/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(isstorage(target)) // Storage handling. Maybe add an intent check?
return ..()
add_fingerprint(user)
in_use = TRUE
to_chat(user, SPAN_NOTICE("You start collecting evidence..."))
if(!do_after(user, 2 SECONDS, target = user))
in_use = FALSE
return ITEM_INTERACT_COMPLETE
var/list/found_blood = list()
// This is utterly hateful, yes, but so is blood_DNA. - Chuga
if(issimulatedturf(target))
for(var/obj/effect/decal/cleanable/C in target.contents)
if(istype(C, /obj/effect/decal/cleanable/blood) || istype(C, /obj/effect/decal/cleanable/trail_holder))
found_blood |= C.blood_DNA
else if(isliving(target))
var/mob/living/L = target
found_blood |= L.get_blood_dna_list()
else
if(target.blood_DNA)
found_blood |= target.blood_DNA
var/list/choices = list()
if(length(found_blood))
choices |= "Blood"
if(istype(target, /obj/item/clothing/gloves))
choices |= "Gunpowder residue"
if(!length(choices))
to_chat(user, SPAN_WARNING("There is no evidence on [target]."))
in_use = FALSE
return ITEM_INTERACT_COMPLETE
var/choice
if(length(choices) == 1)
choice = choices[1]
else
choice = tgui_input_list(user, "What evidence are you looking for?", "Collection of evidence", choices)
in_use = FALSE
if(!choice || !(choice in choices))
return ITEM_INTERACT_COMPLETE
var/spawn_type
var/spawn_data
if(choice == "Blood")
spawn_type = /obj/item/sample/swab/dna
spawn_data = found_blood
else if(choice == "Gunpowder residue")
var/obj/item/clothing/B = target
if(!istype(B) || !B.gunshot_residue)
to_chat(user, SPAN_WARNING("There is not a hint of gunpowder on [target]."))
in_use = FALSE
return ITEM_INTERACT_COMPLETE
spawn_type = /obj/item/sample/swab/gunpowder
spawn_data = B.gunshot_residue
if(spawn_type)
user.visible_message(
SPAN_NOTICE("[user] takes a swab from [target] for analysis."),
SPAN_NOTICE("You take a swab from [target] for analysis."))
if(!dispenser)
qdel(src)
var/obj/item/sample/swab/S = new spawn_type(get_turf(user))
S.set_used(choice, target, spawn_data)
user.put_in_hands(S)
return ITEM_INTERACT_COMPLETE
/obj/item/forensics/swab/cyborg
dispenser = TRUE
/obj/item/sample/swab
name = "sample collection kit"
icon_state = "swab_used"
materials = list(MAT_METAL = 500, MAT_GLASS = 250)
/obj/item/sample/swab/proc/set_used(sample_str, atom/source, data)
name = "[initial(name)] ([sample_str] - [source])"
desc = "[initial(desc)] The label on the bottle reads: 'Sample [sample_str] - [source]'."
evidence = data
/obj/item/sample/swab/dna
desc = "A sterile cotton swab that was used to collect a DNA sample."
/obj/item/sample/swab/dna/report(obj/item/paper/report, obj/machinery/analyzer, report_num)
if(!istype(analyzer, /obj/machinery/dnaforensics))
return ..()
report.name = ("DNA scanner report no. [report_num]: [name]")
// dna data itself
var/data = "No analysis data available."
if(!isnull(evidence))
data = "Spectrometric analysis on the provided sample determined the presence of DNA. DNA String(s) found: [length(evidence)].<br><br>"
for(var/blood in evidence)
data += SPAN_NOTICE("Blood type: [evidence[blood]]<br>\nDNA: [blood]<br><br>")
else
data += "\nNo DNA found.<br>"
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>\nAnalyzed object:</b><br>[name]<br>[desc]<br><br>" + data
/obj/item/sample/swab/gunpowder
desc = "A sterile cotton swab that was used to collect gunpowder residue."
/obj/item/sample/swab/gunpowder/report(obj/item/paper/report, obj/machinery/analyzer, report_num)
if(!istype(analyzer, /obj/machinery/microscope))
return ..()
report.name = "Forensic report no. [report_num]: [name]"
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Analyzed object:</b><br>[name]<br><br>"
if(evidence)
report.info += "Gunpowder residue found. Caliber: [evidence]."
else
report.info += "Powder residue from the bullet was not found."
@@ -7,11 +7,14 @@
anchored = TRUE
density = TRUE
var/obj/item/forensics/swab = null
var/obj/item/sample/swab/swab = null
/// is currently scanning
var/scanning = FALSE
/// Global number of reports ran from that machine type
var/report_num = FALSE
var/list/allowed_types = list(
/obj/item/sample/swab/dna
)
/obj/machinery/dnaforensics/Initialize(mapload)
. = ..()
@@ -29,7 +32,9 @@
. += SPAN_NOTICE("<b>Click with an empty hand</b> to analyze the current sample.")
/obj/machinery/dnaforensics/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/forensics))
if(!is_type_in_list(used, allowed_types))
if(istype(used, /obj/item/sample))
to_chat(user, SPAN_WARNING("[used] isn't compatible with [src]"))
return ..()
if(panel_open)
@@ -40,26 +45,24 @@
to_chat(user, SPAN_WARNING("There is already a sample inside the scanner."))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/forensics/swab))
to_chat(user, SPAN_NOTICE("You insert [used] into [src]."))
user.unequip(used)
used.forceMove(src)
swab = used
update_icon()
else
to_chat(user, SPAN_NOTICE("This is not a compatible sample!"))
to_chat(user, SPAN_NOTICE("You insert [used] into [src]."))
user.unequip(used)
used.forceMove(src)
swab = used
update_icon()
return ITEM_INTERACT_COMPLETE
/obj/machinery/dnaforensics/attack_hand(mob/user)
if(!swab)
to_chat(user, SPAN_WARNING("The scanner is empty!"))
return
scanning = TRUE
update_appearance(UPDATE_ICON)
to_chat(user, SPAN_NOTICE("The scanner begins to hum as you analyze [swab]."))
playsound(src, 'sound/machines/banknote_counter.ogg', 30, FALSE)
if(!do_after(user, 2.5 SECONDS, src) || QDELETED(swab))
if(!do_after(user, 2.5 SECONDS, target = src) || QDELETED(swab))
to_chat(user, SPAN_NOTICE("You have stopped analyzing [swab || "the swab"]."))
scanning = FALSE
update_appearance(UPDATE_ICON)
@@ -70,18 +73,8 @@
report.stamped = list(/obj/item/stamp)
report_num++
var/obj/item/forensics/swab/bloodswab = swab
report.name = ("DNA scanner report no. [++report_num]: [bloodswab.name]")
// dna data itself
var/data = "No analysis data available."
if(!isnull(bloodswab.dna))
data = "Spectrometric analysis on the provided sample determined the presence of DNA. DNA String(s) found: [length(bloodswab.dna)].<br><br>"
for(var/blood in bloodswab.dna)
data += SPAN_NOTICE("Blood type: [bloodswab.dna[blood]]<br>\nDNA: [blood]<br><br>")
else
data += "\nNo DNA found.<br>"
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>\nAnalyzed object:</b><br>[bloodswab.name]<br>[bloodswab.desc]<br><br>" + data
swab.report(report, src, report_num)
report.forceMove(get_turf(src))
report.update_icon()
scanning = FALSE
@@ -135,14 +128,18 @@
// Microscope code itself
/obj/machinery/microscope
name = "microscope"
desc = "A microscope capable of magnifying images up to 3000 times."
desc = "A microscope capable of magnifying images up to 3000 times. Used in analyzing fibers, fingerprints, and gunpower residue samples."
icon = 'icons/obj/forensics/forensics.dmi'
icon_state = "microscope"
anchored = TRUE
density = TRUE
var/obj/item/sample = null
var/obj/item/sample/sample
var/report_num = 0
var/fingerprint_complete = 6
var/list/allowed_types = list(
/obj/item/sample/fibers,
/obj/item/sample/print,
/obj/item/sample/swab/gunpowder
)
/obj/machinery/microscope/Initialize(mapload)
. = ..()
@@ -159,7 +156,9 @@
. += SPAN_NOTICE("<b>Click with an empty hand</b> to study the current sample.")
/obj/machinery/microscope/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/forensics/swab) && !istype(used, /obj/item/sample))
if(!is_type_in_list(used, allowed_types))
if(istype(used, /obj/item/sample))
to_chat(user, SPAN_WARNING("[used] isn't compatible with [src]"))
return ..()
if(panel_open)
@@ -170,13 +169,12 @@
to_chat(user, SPAN_WARNING("There is already a sample in the microscope!"))
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/forensics/swab)|| istype(used, /obj/item/sample/fibers) || istype(used, /obj/item/sample/print))
add_fingerprint(user)
to_chat(user, SPAN_NOTICE("You insert [used] into the microscope."))
user.unequip(used)
used.forceMove(src)
sample = used
update_appearance(UPDATE_ICON_STATE)
add_fingerprint(user)
to_chat(user, SPAN_NOTICE("You insert [used] into the microscope."))
user.unequip(used)
used.forceMove(src)
sample = used
update_appearance(UPDATE_ICON_STATE)
return ITEM_INTERACT_COMPLETE
/obj/machinery/microscope/attack_hand(mob/user)
@@ -188,7 +186,8 @@
add_fingerprint(user)
to_chat(user, SPAN_NOTICE("The microscope buzzes as you study [sample]."))
if(!do_after(user, 2.5 SECONDS, src) || !sample)
playsound(src, 'sound/machines/terminal_processing.ogg', 15, TRUE)
if(!do_after(user, 2.5 SECONDS, target = src) || !sample)
to_chat(user, SPAN_NOTICE("You stop studying [sample]."))
return
@@ -197,52 +196,16 @@
report.stamped = list(/obj/item/stamp)
report_num++
if(istype(sample, /obj/item/forensics/swab))
var/obj/item/forensics/swab/swab = sample
report.name = ("Forensic report no. [++report_num]: [swab.name]")
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Analyzed object:</b><br>[swab.name]<br><br>"
if(swab.gsr)
report.info += "Gunpowder residue found. Caliber: [swab.gsr]."
else
report.info += "Powder residue from the bullet was not found."
else if(istype(sample, /obj/item/sample/fibers))
var/obj/item/sample/fibers/fibers = sample
report.name = ("Report on fiber sample no. [++report_num]: [fibers.name]")
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Analyzed object:</b><br>[fibers.name]<br><br>"
if(fibers.evidence)
report.info += "Molecular analysis on the provided sample determined the presence of the following unique fiber strands:<br><br>"
for(var/fiber in fibers.evidence)
report.info += SPAN_NOTICE("Most Likely Match: [fiber]<br><br>")
else
report.info += "No fibers found."
else if(istype(sample, /obj/item/sample/print))
report.name = ("Fingerprint Analysis Report No. [report_num]: [sample.name]")
report.info = "<b>Report number: [report_num]</b><br>"
report.info += "<b>Fingerprint Analysis Report No. [report_num]</b>: [sample.name]<br>"
var/obj/item/sample/print/card = sample
if(card.evidence && card.evidence.len)
report.info += "<br>Surface analysis identified the following unique fingerprints:<br><br>"
for(var/prints in card.evidence)
report.info += SPAN_NOTICE("Fingerprint: ")
if(!is_complete_print(prints))
report.info += "INCOMPLETE PRINT"
else
report.info += "[prints]"
report.info += "<br>"
else
report.info += "No analysis information available."
sample.report(report, src, report_num)
if(report)
report.update_icon()
if(report.info)
to_chat(user, report.info)
to_chat(user, chat_box_notice(report.info))
return
/obj/machinery/microscope/proc/remove_sample(mob/living/remover)
if(!istype(remover) || remover.incapacitated() || !Adjacent(remover))
return
@@ -255,9 +218,6 @@
sample = null
update_appearance(UPDATE_ICON_STATE)
/obj/machinery/microscope/proc/is_complete_print(print)
return stringpercent(print) <= fingerprint_complete
/obj/machinery/microscope/AltClick()
remove_sample(usr)
-103
View File
@@ -1,103 +0,0 @@
/obj/item/forensics/swab
name = "sample collection kit"
desc = "A sterile cotton swab and test tube for collecting samples."
icon_state = "swab"
materials = list(MAT_METAL = 500, MAT_GLASS = 250)
/// currently in machine
var/dispenser = FALSE
/// gunshot residue data
var/gsr = FALSE
/// DNA sample data
var/list/dna
/// boolean, used or not
var/used
/obj/item/forensics/swab/proc/is_used()
return used
/obj/item/forensics/swab/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(isstorage(target)) // Storage handling. Maybe add an intent check?
return ..()
if(is_used())
to_chat(user, SPAN_WARNING("This sample kit is already used."))
return ITEM_INTERACT_COMPLETE
add_fingerprint(user)
in_use = TRUE
to_chat(user, SPAN_NOTICE("You start collecting evidence..."))
if(do_after(user, 2 SECONDS, target = user))
var/list/choices = list()
var/list/found_blood = list()
// This is utterly hateful, yes, but so is blood_DNA. - Chuga
if(issimulatedturf(target))
for(var/obj/effect/decal/cleanable/C in target.contents)
if(istype(C, /obj/effect/decal/cleanable/blood) || istype(C, /obj/effect/decal/cleanable/trail_holder))
found_blood |= C.blood_DNA
else if(isliving(target))
var/mob/living/L = target
found_blood |= L.get_blood_dna_list()
else
if(target.blood_DNA)
found_blood |= target.blood_DNA
if(length(found_blood))
choices |= "Blood"
if(istype(target, /obj/item/clothing/gloves))
choices |= "Gunpowder particles"
var/choice
if(!length(choices))
to_chat(user, SPAN_WARNING("There is no evidence on [target]."))
in_use = FALSE
return ITEM_INTERACT_COMPLETE
else if(length(choices) == 1)
choice = choices[1]
else
choice = tgui_input_list(user, "What evidence are you looking for?", "Collection of evidence", choices)
if(!choice)
in_use = FALSE
return ITEM_INTERACT_COMPLETE
var/sample_type
var/target_dna
var/target_gsr
if(choice == "Blood")
target_dna = found_blood
sample_type = "blood"
else if(choice == "Gunpowder particles")
var/obj/item/clothing/B = target
if(!istype(B) || !B.gunshot_residue)
to_chat(user, SPAN_WARNING("There is not a hint of gunpowder on [target]."))
in_use = FALSE
return ITEM_INTERACT_COMPLETE
target_gsr = B.gunshot_residue
sample_type = "powder"
if(sample_type)
user.visible_message(
SPAN_NOTICE("[user] takes a swab from [target] for analysis."),
SPAN_NOTICE("You take a swab from [target] for analysis."))
if(!dispenser)
dna = target_dna
gsr = target_gsr
set_used(sample_type, target)
else
var/obj/item/forensics/swab/S = new(get_turf(user))
S.dna = target_dna
S.gsr = target_gsr
S.set_used(sample_type, target)
in_use = FALSE
return ITEM_INTERACT_COMPLETE
/obj/item/forensics/swab/proc/set_used(sample_str, atom/source)
name = "[initial(name)] ([sample_str] - [source])"
desc = "[initial(desc)] The label on the bottle reads: 'Sample [sample_str] - [source].'."
icon_state = "swab_used"
used = TRUE
/obj/item/forensics/swab/cyborg
dispenser = TRUE