Files
CHOMPStation2/code/modules/detectivework/scanner.dm
giacomand@gmail.com f1d24f27f9 Simplified Detective.
-Changed the focus from the high-res scanner to the regular scanner. It will simply scan the fingerprints and display them to the detective. For extra functionality, it'll store it's findings in a log and then you can print it out in a report by using attack_self().

-Detectives can now use the medical computer.
-Removed the pda forensic scanning functionality.
-Got rid of now useless high-res scanner computer. Got rid of the now useless fingerprint cards.
-Added a medical computer to the detective's office and replaced the useless medical cabinet with an empty one.

Other

-Got rid of diseases magically moving down a stage.
-Optimized playsound()
-Added an attack_self() to sprayers so that you can change the reagent use of them between 5 and 10.




git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5168 316c924e-a436-60f5-8080-3fe189b3f50e
2012-11-23 00:39:18 +00:00

130 lines
4.9 KiB
Plaintext

//CONTAINS: Detective's Scanner
/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 << "<span class='notice'>Printing report, please wait...</span>"
spawn(100)
var/obj/item/weapon/paper/P = new(get_turf(src))
P.info = "<center><font size='4'>Scanner Report</font></center><HR><BR>"
P.info += dd_list2text(log, "<BR>")
P.info_links = P.info
user.put_in_hands(P)
log = list()
scanning = 0
if(user)
user << "<span class='notice'>Report printed. Log cleared.<span>"
else
user << "<span class='notice'>The scanner has no logs or is in use.</span>"
/obj/item/device/detective_scanner/attack(mob/living/carbon/human/M as mob, mob/user as mob)
if(!scanning)
scanning = 1
spawn(0)
add_log(user, "<font color='blue'>Scanning [M]...</font>")
if (!ishuman(M))
add_log(user, "<span class='warning'>[M] is not human and cannot have the fingerprints.</span>")
else
if (( !( istype(M.dna, /datum/dna) ) || M.gloves) )
add_log(user, "<span class='info'>No fingerprints found on [M]</span>")
else
add_log(user, "<span class='info'>Fingerprints found on [M]. Analysing...</span>")
sleep(30)
add_log(user, "<span class='info'>[M]'s Fingerprints: [md5(M.dna.uni_identity)]</span>")
if ( !M.blood_DNA || !M.blood_DNA.len )
add_log(user, "<span class='info'>No blood found on [M]</span>")
if(M.blood_DNA)
del(M.blood_DNA)
else
add_log(user, "<span class='info'>Blood found on [M]. Analysing...</span>")
sleep(30)
for(var/blood in M.blood_DNA)
add_log(user, "<span class='info'>Blood type: [M.blood_DNA[blood]]\nDNA: [blood]</span>")
add_log(null, "<font color='blue'>Ending scan report.</font>")
scanning = 0
return
/obj/item/device/detective_scanner/afterattack(atom/A as obj|turf|area, mob/user as mob)
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)
add_log(user, "<font color='blue'>Scanning [A]...</font>")
//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 < 1)
add_log(user, "<span class='info'>No intact prints found</span>")
else
add_log(user, "<span class='info'>Found [completed_prints.len] intact print[completed_prints.len == 1 ? "" : "s"]. Analysing...</span>")
sleep(30)
for(var/i in completed_prints)
add_log(user, "&nbsp;&nbsp;&nbsp;&nbsp;[i]")
//FIBERS
if(A.suit_fibers && A.suit_fibers.len)
add_log(user, "<span class='info'>Fibers found. Analysing...</span>")
sleep(30)
for(var/fiber in A.suit_fibers)
add_log(user, "&nbsp;&nbsp;&nbsp;&nbsp;[fiber]")
//Blood
if (A.blood_DNA && A.blood_DNA.len)
add_log(user, "<span class='info'>Blood found. Analysing...</span>")
sleep(30)
for(var/blood in A.blood_DNA)
add_log(user, "&nbsp;&nbsp;&nbsp;&nbsp;Blood type: <font color='red'>[A.blood_DNA[blood]]</font> DNA: <font color='red'>[blood]</font>")
//General
if ((!A.fingerprints || !A.fingerprints.len) && (!A.suit_fibers || !A.suit_fibers.len) && (!A.blood_DNA || !A.blood_DNA.len))
add_log(null, "Unable to locate any fingerprints, materials, fibers, or blood.")
user.visible_message("\The [user] scans \the [A] with \a [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]" ,\
"<span class='notice'>Unable to locate any fingerprints, materials, fibers, or blood on [A]!</span>",\
"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 scanning \the [A].",\
"You hear a faint hum of electrical equipment.")
add_log(null, "<font color='blue'>Ending scan report.</font>")
scanning = 0
return 0
/obj/item/device/detective_scanner/proc/add_log(var/mob/user, var/msg)
if(scanning)
if(user)
user << msg
log += "<span class='prefix'>[time2text(world.time + 432000, "hh:mm:ss")]</span>:&nbsp;&nbsp;[msg]"
else
CRASH("[src] \ref[src] is adding a log when it was never put in scanning mode!")