/obj/item/autopsy_scanner name = "autopsy scanner" desc = "Extracts information on wounds." icon = 'icons/obj/surgery.dmi' icon_state = "autopsy_scanner" flags = CONDUCT slot_flags = SLOT_FLAG_BELT w_class = WEIGHT_CLASS_SMALL origin_tech = "magnets=1;biotech=1" var/list/datum/autopsy_data_scanner/wdata = list() var/list/chemtraces = list() var/target_name = null var/target_UID = null var/timeofdeath = null var/target_rank = null /obj/item/autopsy_scanner/Destroy() QDEL_LIST_ASSOC_VAL(wdata) return ..() /datum/autopsy_data_scanner var/weapon = null // this is the DEFINITE weapon type that was used var/list/organs_scanned = list() // this maps a number of scanned organs to // the wounds to those organs with this data's weapon type var/organ_names = "" /datum/autopsy_data_scanner/Destroy() QDEL_LIST_ASSOC_VAL(organs_scanned) return ..() /datum/autopsy_data var/weapon = null var/damage = 0 var/hits = 0 var/time_inflicted = 0 /datum/autopsy_data/proc/copy() var/datum/autopsy_data/W = new() W.weapon = weapon W.damage = damage W.hits = hits W.time_inflicted = time_inflicted return W /obj/item/autopsy_scanner/proc/add_data(obj/item/organ/O) if(length(O.autopsy_data)) for(var/V in O.autopsy_data) var/datum/autopsy_data/W = O.autopsy_data[V] var/datum/autopsy_data_scanner/D = wdata[V] if(!D) D = new() D.weapon = W.weapon wdata[V] = D if(!D.organs_scanned[O.name]) if(D.organ_names == "") D.organ_names = O.name else D.organ_names += ", [O.name]" qdel(D.organs_scanned[O.name]) D.organs_scanned[O.name] = W.copy() if(length(O.trace_chemicals)) for(var/V in O.trace_chemicals) if(O.trace_chemicals[V] > 0 && !chemtraces.Find(V)) chemtraces += V /obj/item/autopsy_scanner/examine(mob/user) . = ..() if(Adjacent(user)) . += "You can use a pen on it to quickly write a coroner's report." /obj/item/autopsy_scanner/attackby(obj/item/P, mob/user) if(!is_pen(P)) return ..() var/dead_name = tgui_input_text(user, "Insert name of deceased individual", default = target_name, title = "Coroner's Report", max_length = 60) var/rank = tgui_input_text(user, "Insert rank of deceased individual", default = target_rank, title = "Coroner's Report", max_length = 60) var/tod = tgui_input_text(user, "Insert time of death", default = station_time_timestamp("hh:mm", timeofdeath), title = "Coroner's Report", max_length = 60) var/cause = tgui_input_text(user, "Insert cause of death", title = "Coroner's Report", max_length = 60) var/chems = tgui_input_text(user, "Insert any chemical traces", multiline = TRUE, title = "Coroner's Report") var/notes = tgui_input_text(user, "Insert any relevant notes", multiline = TRUE, title = "Coroner's Report") var/obj/item/paper/R = new(user.loc) R.name = "Official Coroner's Report - [dead_name]" R.info = "
[station_name()] - Coroner's Report


Name of Deceased: [dead_name]

Rank of Deceased: [rank]

Time of Death: [tod]

Cause of Death: [cause]

Trace Chemicals: [chems]

Additional Coroner's Notes: [notes]

Coroner's Signature: " playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, TRUE) user.put_in_hands(R) /obj/item/autopsy_scanner/attack_self(mob/user) var/scan_data = "" if(timeofdeath) scan_data += "Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]

" else scan_data += "Time of death: Unknown / Still alive

" if(length(wdata)) var/n = 1 for(var/wdata_idx in wdata) var/datum/autopsy_data_scanner/D = wdata[wdata_idx] var/total_hits = 0 var/total_score = 0 var/age = 0 for(var/wound_idx in D.organs_scanned) var/datum/autopsy_data/W = D.organs_scanned[wound_idx] total_hits += W.hits total_score+=W.damage var/wound_age = W.time_inflicted age = max(age, wound_age) var/damage_desc // total score happens to be the total damage switch(total_score) if(1 to 5) damage_desc = "negligible" if(5 to 15) damage_desc = "light" if(15 to 30) damage_desc = "moderate" if(30 to 1000) damage_desc = "severe" else damage_desc = "Unknown" var/damaging_weapon = (total_score != 0) scan_data += "Weapon #[n]
" if(damaging_weapon) scan_data += "Severity: [damage_desc]
" scan_data += "Hits by weapon: [total_hits]
" scan_data += "Approximate time of wound infliction: [station_time_timestamp("hh:mm", age)]
" scan_data += "Affected limbs: [D.organ_names]
" scan_data += "Weapon: [D.weapon]
" scan_data += "
" n++ if(length(chemtraces)) scan_data += "Trace Chemicals:
" for(var/chemID in chemtraces) scan_data += chemID scan_data += "
" user.visible_message("[src] rattles and prints out a sheet of paper.") playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1) sleep(10) var/obj/item/paper/P = new(user.loc) P.name = "Autopsy Data ([target_name])" P.info = "[scan_data]" P.overlays += "paper_words" user.put_in_hands(P) /obj/item/autopsy_scanner/attack(mob/living/carbon/human/M, mob/living/carbon/user) if(!istype(M)) return if(!on_operable_surface(M)) return if(target_UID != M.UID()) target_UID = M.UID() target_name = M.name target_rank = M.get_assignment(if_no_id = "Unknown", if_no_job = null) wdata.Cut() chemtraces.Cut() timeofdeath = null to_chat(user, "A new patient has been registered. Purging data for previous patient.") timeofdeath = M.timeofdeath var/obj/item/organ/external/S = M.get_organ(user.zone_selected) if(!S) to_chat(user, "You can't scan this body part.") return M.visible_message("[user] scans the wounds on [M]'s [S.name] with [src]") add_data(S) return 1