Files
kiwistation/code/modules/detectivework/scanner.dm
T
giacomand@gmail.com 19439f85c2 - NTSL returns! Thanks muskets! I will be responsible for anything that goes wrong with NTSL.
- Wire datums arrive! These are wire datums which allows you to easily add wires in a maintainable manner. All wires by default will be allowed to have a signallers attached to it. I have converted cyborg wires, airlock wires, camera wires and mulebot wires to the new system.
 - Cameras will no longer have random wires for each camera. The power wire will toggle the power of the camera when pulsed.
 - Robots have a new wire! The lockdown wire will toggle the lockdown status of robots. You can now fix cyborgs that have been locked down and had the robotics computer destroyed. Should be interesting now that you can remotely pulse all datum wires.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5663 316c924e-a436-60f5-8080-3fe189b3f50e
2013-02-07 23:49:17 +00:00

166 lines
4.7 KiB
Plaintext

//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 << "<span class='notice'>Printing report, please wait...</span>"
spawn(100)
// Create our paper
var/obj/item/weapon/paper/P = new(get_turf(src))
P.name = "paper- 'Scanner Report'"
P.info = "<center><font size='6'><B>Scanner Report</B></font></center><HR><BR>"
P.info += dd_list2text(log, "<BR>")
P.info += "<HR><B>Notes:</B><BR>"
P.info_links = P.info
if(ismob(loc))
var/mob/M = loc
M.put_in_hands(P)
M << "<span class='notice'>Report printed. Log cleared.<span>"
// Clear the logs
log = list()
scanning = 0
else
user << "<span class='notice'>The scanner has no logs or is in use.</span>"
/obj/item/device/detective_scanner/attack(mob/living/M as mob, mob/user as mob)
scan(M, user)
/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
scan(A, user)
/obj/item/device/detective_scanner/proc/scan(var/atom/A, var/mob/user)
if(!scanning)
scanning = 1
user.visible_message("\The [user] scans \the [A] with \the [src], the air around [user.gender == MALE ? "him" : "her"] humming[prob(70) ? " gently." : "."]")
user << "<span class='notice'>You scan [A]. The scanner is analysing the results...</span>"
// GATHER INFORMATION
//Make our lists
var/list/fingerprints = list()
var/list/blood = list()
var/list/fibers = list()
var/list/reagents = list()
var/target_name = A.name
// Start gathering
if(ishuman(A))
var/mob/living/carbon/human/H = A
if (istype(H.dna, /datum/dna) && !H.gloves)
fingerprints += md5(H.dna.uni_identity)
if(H.blood_DNA && H.blood_DNA.len)
blood = H.blood_DNA.Copy()
else
if(A.fingerprints && A.fingerprints.len)
fingerprints = A.fingerprints.Copy()
if(A.blood_DNA && A.blood_DNA.len)
blood = A.blood_DNA.Copy()
if(A.reagents && A.reagents.reagent_list.len)
for(var/datum/reagent/R in A.reagents.reagent_list)
reagents[R.name] = R.volume
if(A.suit_fibers && A.suit_fibers.len)
fibers = A.suit_fibers.Copy()
// We gathered everything. Create a fork and slowly display the results to the holder of the scanner.
spawn(0)
var/found_something = 0
add_log("<B>[get_timestamp()] - [target_name]</B>", 0)
// Fingerprints
if(fingerprints && fingerprints.len)
sleep(30)
add_log("<span class='info'><B>Prints:</B></span>")
for(var/finger in fingerprints)
add_log("[finger]")
found_something = 1
// Blood
if (blood && blood.len)
sleep(30)
add_log("<span class='info'><B>Blood:</B></span>")
found_something = 1
for(var/B in blood)
add_log("Type: <font color='red'>[blood[B]]</font> DNA: <font color='red'>[B]</font>")
//Fibers
if(fibers && fibers.len)
sleep(30)
add_log("<span class='info'><B>Fibers:</B></span>")
for(var/fiber in fibers)
add_log("[fiber]")
found_something = 1
//Reagents
if(reagents && reagents.len)
sleep(30)
add_log("<span class='info'><B>Reagents:</B></span>")
for(var/R in reagents)
add_log("Reagent: <font color='red'>[R]</font> Volume: <font color='red'>[reagents[R]]</font>")
found_something = 1
// Get a new user
var/mob/holder = null
if(ismob(src.loc))
holder = src.loc
if(!found_something)
add_log("<I># No forensic traces found #</I>", 0) // Don't display this to the holder user
if(holder)
holder << "<span class='notice'>Unable to locate any fingerprints, materials, fibers, or blood on [target_name]!</span>"
else
if(holder)
holder << "<span class='notice'>You finish scanning \the [target_name].</span>"
add_log("---------------------------------------------------------", 0)
scanning = 0
return
/obj/item/device/detective_scanner/proc/add_log(var/msg, var/broadcast = 1)
if(scanning)
if(broadcast && ismob(loc))
var/mob/M = loc
M << msg
log += "&nbsp;&nbsp;[msg]"
else
CRASH("[src] \ref[src] is adding a log when it was never put in scanning mode!")
/proc/get_timestamp()
return time2text(world.time + 432000, "hh:mm:ss")