//CONTAINS: Detective's Scanner // TODO: Split everything into easy to manage procs. /obj/item/device/detective_scanner name = "Scanner" desc = "Used to scan objects for DNA and fingerprints. Can print a report of the findings." icon_state = "forensic1" w_class = 3.0 item_state = "electronic" flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY slot_flags = SLOT_BELT var/scanning = 0 var/list/log = list() /obj/item/device/detective_scanner/attack_self(var/mob/user) if(log.len && !scanning) scanning = 1 user << "Printing report, please wait..." spawn(100) var/obj/item/weapon/paper/P = new(get_turf(src)) P.name = "paper- 'Scanner Report'" P.info = "
Scanner Report


" P.info += dd_list2text(log, "
") P.info += "
Notes:
" P.info_links = P.info user.put_in_hands(P) log = list() scanning = 0 if(user) user << "Report printed. Log cleared." else user << "The scanner has no logs or is in use." /obj/item/device/detective_scanner/attack(mob/living/carbon/human/M as mob, mob/user as mob) if(!scanning) scanning = 1 spawn(0) var/found_something = 0 user << "You scan [M]. The scanner is analysing the results..." add_log(null, "[time2text(world.time + 432000, "hh:mm:ss")] - [M]") // Fingerprints if(ishuman(M)) if (istype(M.dna, /datum/dna) && !M.gloves) sleep(30) add_log(user, "Prints:") add_log(user, "[md5(M.dna.uni_identity)]") found_something = 1 // Blood if ( !M.blood_DNA || !M.blood_DNA.len ) if(M.blood_DNA) del(M.blood_DNA) else sleep(30) add_log(user, "Blood:") found_something = 1 for(var/blood in M.blood_DNA) add_log(user, "Type: [M.blood_DNA[blood]] DNA: [blood]") //Reagents if(M.reagents && M.reagents.reagent_list.len) sleep(30) add_log(user, "Reagents:") for(var/datum/reagent/R in M.reagents.reagent_list) add_log(user, "Reagent: [R.name] Volume: [R.volume]") found_something = 1 if(!found_something) add_log(null, "# No forensic traces found #") user.visible_message("\The [user] scans \the [M] with \a [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]" ,\ "Unable to locate any fingerprints, materials, fibers, or blood on [M]!",\ "You hear a faint hum of electrical equipment.") else user.visible_message("\The [user] scans \the [M] with \a [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]" ,\ "You finish scanning \the [M].",\ "You hear a faint hum of electrical equipment.") add_log(null, "---------------------------------------------------------") scanning = 0 return /obj/item/device/detective_scanner/afterattack(atom/A as obj|turf|area, mob/user as mob) // Note, don't add formating, such as , as it won't show up in the logs. if(!in_range(A,user)) return if(!isturf(A) && !isobj(A)) return if(loc != user) return if(!scanning) scanning = 1 add_fingerprint(user) spawn(0) var/found_something = 0 user << "You scan [A]. The scanner is analysing the results..." add_log(null, "[time2text(world.time + 432000, "hh:mm:ss")] - [capitalize(A.name)]") //PRINTS if(!A.fingerprints || !A.fingerprints.len) if(A.fingerprints) del(A.fingerprints) else var/list/completed_prints = list() // Bah this looks awful but basically it loop throught the last 15 entries. for(var/i in A.fingerprints) var/print = A.fingerprints[i] completed_prints += print if(completed_prints.len) sleep(30) add_log(user, "Prints:") for(var/i in completed_prints) add_log(user, "[i]") found_something = 1 //FIBERS if(A.suit_fibers && A.suit_fibers.len) sleep(30) add_log(user, "Fibers:") for(var/fiber in A.suit_fibers) add_log(user, "[fiber]") found_something = 1 //Blood if (A.blood_DNA && A.blood_DNA.len) sleep(30) add_log(user, "Blood:") for(var/blood in A.blood_DNA) add_log(user, "Type: [A.blood_DNA[blood]] DNA: [blood]") found_something = 1 //Reagents if(A.reagents && A.reagents.reagent_list.len) sleep(30) add_log(user, "Reagents:") for(var/datum/reagent/R in A.reagents.reagent_list) add_log(user, "Reagent: [R.name] Volume: [R.volume]") found_something = 1 //General if (!found_something) add_log(null, "# No forensic traces found #") user.visible_message("\The [user] scans \the [A] with \a [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]" ,\ "Unable to locate any fingerprints, materials, fibers, or blood on [A]!",\ "You hear a faint hum of electrical equipment.") else user.visible_message("\The [user] scans \the [A] with \a [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]" ,\ "You finish analysing \the [A].",\ "You hear a faint hum of electrical equipment.") add_log(null, "---------------------------------------------------------") scanning = 0 return 0 /obj/item/device/detective_scanner/proc/add_log(var/mob/user, var/msg) if(scanning) if(user) user << msg log += "  [msg]" else CRASH("[src] \ref[src] is adding a log when it was never put in scanning mode!")