Forensics re-destroyed, but better this time.
All lists are LAZYINITLIST, cleaning code is preserved, examine is preserved. We should be back in buisness, but this is just a 'holy fuck finally' commit
This commit is contained in:
@@ -1,158 +1,107 @@
|
||||
//CONTAINS: Suit fibers and Detective's Scanning Computer
|
||||
|
||||
/atom/proc/return_fingerprints()
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
. = D.fingerprints
|
||||
/atom/proc/add_fibers(mob/living/carbon/human/M)
|
||||
if(M.gloves && istype(M.gloves, /obj/item/clothing/))
|
||||
var/obj/item/clothing/gloves/G = M.gloves
|
||||
if(G.transfer_blood > 1) //bloodied gloves transfer blood to touched objects
|
||||
if(add_blood_DNA(G.blood_DNA)) //only reduces the bloodiness of our gloves if the item wasn't already bloody
|
||||
G.transfer_blood--
|
||||
else if(M.bloody_hands > 1)
|
||||
if(add_blood_DNA(M.blood_DNA))
|
||||
M.bloody_hands--
|
||||
if(!suit_fibers)
|
||||
suit_fibers = list()
|
||||
var/fibertext
|
||||
var/item_multiplier = isitem(src)?1.2:1
|
||||
if(M.wear_suit)
|
||||
fibertext = "Material from \a [M.wear_suit]."
|
||||
if(prob(10*item_multiplier) && !(fibertext in suit_fibers))
|
||||
suit_fibers += fibertext
|
||||
if(!(M.wear_suit.body_parts_covered & CHEST))
|
||||
if(M.w_uniform)
|
||||
fibertext = "Fibers from \a [M.w_uniform]."
|
||||
if(prob(12*item_multiplier) && !(fibertext in suit_fibers)) //Wearing a suit means less of the uniform exposed.
|
||||
suit_fibers += fibertext
|
||||
if(!(M.wear_suit.body_parts_covered & HANDS))
|
||||
if(M.gloves)
|
||||
fibertext = "Material from a pair of [M.gloves.name]."
|
||||
if(prob(20*item_multiplier) && !(fibertext in suit_fibers))
|
||||
suit_fibers += fibertext
|
||||
else if(M.w_uniform)
|
||||
fibertext = "Fibers from \a [M.w_uniform]."
|
||||
if(prob(15*item_multiplier) && !(fibertext in suit_fibers))
|
||||
// "Added fibertext: [fibertext]"
|
||||
suit_fibers += fibertext
|
||||
if(M.gloves)
|
||||
fibertext = "Material from a pair of [M.gloves.name]."
|
||||
if(prob(20*item_multiplier) && !(fibertext in suit_fibers))
|
||||
suit_fibers += "Material from a pair of [M.gloves.name]."
|
||||
else if(M.gloves)
|
||||
fibertext = "Material from a pair of [M.gloves.name]."
|
||||
if(prob(20*item_multiplier) && !(fibertext in suit_fibers))
|
||||
suit_fibers += "Material from a pair of [M.gloves.name]."
|
||||
|
||||
/atom/proc/return_hiddenprints()
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
. = D.hiddenprints
|
||||
|
||||
/atom/proc/return_blood_DNA()
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
. = D.blood_DNA
|
||||
/atom/proc/add_hiddenprint(mob/living/M)
|
||||
if(!M || !M.key)
|
||||
return
|
||||
|
||||
/atom/proc/blood_DNA_length()
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
. = length(D.blood_DNA)
|
||||
if(!fingerprintshidden) //Add the list if it does not exist
|
||||
fingerprintshidden = list()
|
||||
|
||||
/atom/proc/return_fibers()
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
. = D.fibers
|
||||
var/hasgloves = ""
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.gloves)
|
||||
hasgloves = "(gloves)"
|
||||
|
||||
var/current_time = TIME_STAMP("hh:mm:ss", FALSE)
|
||||
if(!fingerprintshidden[M.key])
|
||||
fingerprintshidden[M.key] = "First: [M.real_name]\[[current_time]\][hasgloves]. Ckey: [M.ckey]"
|
||||
else
|
||||
var/laststamppos = findtext(fingerprintshidden[M.key], " Last: ")
|
||||
if(laststamppos)
|
||||
fingerprintshidden[M.key] = copytext(fingerprintshidden[M.key], 1, laststamppos)
|
||||
fingerprintshidden[M.key] += " Last: [M.real_name]\[[current_time]\][hasgloves]. Ckey: [M.ckey]"
|
||||
|
||||
fingerprintslast = M.ckey
|
||||
|
||||
/atom/proc/add_fingerprint_list(list/fingerprints) //ASSOC LIST FINGERPRINT = FINGERPRINT
|
||||
if(length(fingerprints))
|
||||
. = AddComponent(/datum/component/forensics, fingerprints)
|
||||
|
||||
//Set ignoregloves to add prints irrespective of the mob having gloves on.
|
||||
/atom/proc/add_fingerprint(mob/living/M, ignoregloves = FALSE)
|
||||
var/datum/component/forensics/D = AddComponent(/datum/component/forensics)
|
||||
. = D.add_fingerprint(M, ignoregloves)
|
||||
if(!M || !M.key)
|
||||
return
|
||||
|
||||
/atom/proc/add_fiber_list(list/fibertext) //ASSOC LIST FIBERTEXT = FIBERTEXT
|
||||
if(length(fibertext))
|
||||
. = AddComponent(/datum/component/forensics, null, null, null, fibertext)
|
||||
add_hiddenprint(M)
|
||||
|
||||
/atom/proc/add_fibers(mob/living/carbon/human/M)
|
||||
var/old = 0
|
||||
if(M.gloves && istype(M.gloves, /obj/item/clothing))
|
||||
var/obj/item/clothing/gloves/G = M.gloves
|
||||
old = length(G.return_blood_DNA())
|
||||
if(G.transfer_blood > 1) //bloodied gloves transfer blood to touched objects
|
||||
if(add_blood_DNA(G.return_blood_DNA()) && length(G.return_blood_DNA()) > old) //only reduces the bloodiness of our gloves if the item wasn't already bloody
|
||||
G.transfer_blood--
|
||||
else if(M.bloody_hands > 1)
|
||||
old = length(M.return_blood_DNA())
|
||||
if(add_blood_DNA(M.return_blood_DNA()) && length(M.return_blood_DNA()) > old)
|
||||
M.bloody_hands--
|
||||
var/datum/component/forensics/D = AddComponent(/datum/component/forensics)
|
||||
. = D.add_fibers(M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
|
||||
/atom/proc/add_hiddenprint_list(list/hiddenprints) //NOTE: THIS IS FOR ADMINISTRATION FINGERPRINTS, YOU MUST CUSTOM SET THIS TO INCLUDE CKEY/REAL NAMES! CHECK FORENSICS.DM
|
||||
if(length(hiddenprints))
|
||||
. = AddComponent(/datum/component/forensics, null, hiddenprints)
|
||||
add_fibers(H)
|
||||
|
||||
/atom/proc/add_hiddenprint(mob/living/M)
|
||||
var/datum/component/forensics/D = AddComponent(/datum/component/forensics)
|
||||
. = D.add_hiddenprint(M)
|
||||
if(H.gloves) //Check if the gloves (if any) hide fingerprints
|
||||
var/obj/item/clothing/gloves/G = H.gloves
|
||||
if(G.transfer_prints)
|
||||
ignoregloves = TRUE
|
||||
|
||||
/atom/proc/add_blood_DNA(list/dna) //ASSOC LIST DNA = BLOODTYPE
|
||||
return FALSE
|
||||
if(!ignoregloves)
|
||||
H.gloves.add_fingerprint(H, TRUE) //ignoregloves = TRUE to avoid infinite loop.
|
||||
return
|
||||
|
||||
/obj/add_blood_DNA(list/dna)
|
||||
. = ..()
|
||||
if(length(dna))
|
||||
. = AddComponent(/datum/component/forensics, null, null, dna)
|
||||
|
||||
/obj/item/clothing/gloves/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
|
||||
. = ..()
|
||||
transfer_blood = rand(2, 4)
|
||||
|
||||
/turf/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
|
||||
var/obj/effect/decal/cleanable/blood/splatter/B = locate() in src
|
||||
if(!B)
|
||||
B = new /obj/effect/decal/cleanable/blood/splatter(src, diseases)
|
||||
B.add_blood_DNA(blood_dna) //give blood info to the blood decal.
|
||||
B.update_icon()
|
||||
return TRUE //we bloodied the floor
|
||||
|
||||
/mob/living/carbon/human/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
|
||||
if(wear_suit)
|
||||
wear_suit.add_blood_DNA(blood_dna)
|
||||
update_inv_wear_suit()
|
||||
else if(w_uniform)
|
||||
w_uniform.add_blood_DNA(blood_dna)
|
||||
update_inv_w_uniform()
|
||||
if(gloves)
|
||||
var/obj/item/clothing/gloves/G = gloves
|
||||
G.add_blood_DNA(blood_dna)
|
||||
else if(length(blood_dna))
|
||||
AddComponent(/datum/component/forensics, null, null, blood_dna)
|
||||
bloody_hands = rand(2, 4)
|
||||
if(head)
|
||||
head.add_blood_DNA(blood_dna)
|
||||
update_inv_head()
|
||||
else if(wear_mask)
|
||||
wear_mask.add_blood_DNA(blood_dna)
|
||||
update_inv_wear_mask()
|
||||
if(wear_neck)
|
||||
wear_neck.add_blood_DNA(blood_dna)
|
||||
update_inv_neck()
|
||||
update_inv_gloves() //handles bloody hands overlays and updating
|
||||
return TRUE
|
||||
LAZYINITLIST(fingerprints) //Add the list if it does not exist
|
||||
var/full_print = md5(H.dna.uni_identity)
|
||||
fingerprints[full_print] = full_print
|
||||
|
||||
/atom/proc/transfer_fingerprints_to(atom/A)
|
||||
A.add_fingerprint_list(return_fingerprints())
|
||||
A.add_hiddenprint_list(return_hiddenprints())
|
||||
A.fingerprintslast = fingerprintslast
|
||||
// Make sure everything are lists.
|
||||
LAZYINITLIST(A.fingerprints)
|
||||
LAZYINITLIST(A.fingerprintshidden)
|
||||
LAZYINITLIST(fingerprints)
|
||||
LAZYINITLIST(fingerprintshidden)
|
||||
|
||||
//to add blood dna info to the object's blood_DNA list
|
||||
/atom/proc/transfer_blood_dna(list/blood_dna)
|
||||
var/list/blood_DNA
|
||||
GET_COMPONENT(D, /datum/component/forensics)
|
||||
if(D)
|
||||
blood_DNA = D.blood_DNA
|
||||
if(!blood_DNA)
|
||||
blood_DNA = list()
|
||||
var/old_length = blood_DNA.len
|
||||
blood_DNA |= blood_dna
|
||||
if(blood_DNA.len > old_length)
|
||||
return TRUE//some new blood DNA was added
|
||||
|
||||
/atom/proc/blood_DNA_to_color()
|
||||
return
|
||||
|
||||
/obj/effect/decal/cleanable/blood/blood_DNA_to_color()
|
||||
var/list/colors = list()//first we make a list of all bloodtypes present
|
||||
for(var/bloop in Blood_DNA)
|
||||
if(colors[Blood_DNA[bloop]])
|
||||
colors[Blood_DNA[bloop]]++
|
||||
else
|
||||
colors[Blood_DNA[bloop]] = 1
|
||||
|
||||
var/final_rgb = BLOOD_COLOR_HUMAN
|
||||
|
||||
if(colors.len)
|
||||
var/sum = 0 //this is all shitcode, but it works; trust me
|
||||
final_rgb = bloodtype_to_color(colors[1])
|
||||
sum = colors[colors[1]]
|
||||
if(colors.len > 1)
|
||||
var/i = 2
|
||||
while(i <= colors.len)
|
||||
var/tmp = colors[colors[i]]
|
||||
final_rgb = BlendRGB(final_rgb, bloodtype_to_color(colors[i]), tmp/(tmp+sum))
|
||||
sum += tmp
|
||||
i++
|
||||
|
||||
return final_rgb
|
||||
|
||||
/obj/item/clothing/blood_DNA_to_color()
|
||||
var/final_rgb = BLOOD_COLOR_HUMAN
|
||||
if(last_bloodtype)
|
||||
final_rgb = bloodtype_to_color(last_bloodtype)
|
||||
return final_rgb
|
||||
// Transfer
|
||||
if(fingerprints)
|
||||
A.fingerprints |= fingerprints.Copy() //detective
|
||||
if(fingerprintshidden)
|
||||
A.fingerprintshidden |= fingerprintshidden.Copy() //admin
|
||||
A.fingerprintslast = fingerprintslast
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
/obj/item/evidencebag/attackby(obj/item/I, mob/user, params)
|
||||
if(evidencebagEquip(I, user))
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/evidencebag/handle_atom_del(atom/A)
|
||||
cut_overlays()
|
||||
@@ -25,12 +25,12 @@
|
||||
desc = initial(desc)
|
||||
|
||||
/obj/item/evidencebag/proc/evidencebagEquip(obj/item/I, mob/user)
|
||||
if(!istype(I) || I.anchored == 1)
|
||||
if(!istype(I) || I.anchored == TRUE)
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/evidencebag))
|
||||
to_chat(user, "<span class='notice'>You find putting an evidence bag in another evidence bag to be slightly absurd.</span>")
|
||||
return 1 //now this is podracing
|
||||
return TRUE //now this is podracing
|
||||
|
||||
if(I.w_class > WEIGHT_CLASS_NORMAL)
|
||||
to_chat(user, "<span class='notice'>[I] won't fit in [src].</span>")
|
||||
@@ -62,7 +62,7 @@
|
||||
desc = "An evidence bag containing [I]. [I.desc]"
|
||||
I.forceMove(src)
|
||||
w_class = I.w_class
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/evidencebag/attack_self(mob/user)
|
||||
if(contents.len)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
flags_1 = CONDUCT_1
|
||||
item_flags = NOBLUDGEON
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
var/scanning = 0
|
||||
var/scanning = FALSE
|
||||
var/list/log = list()
|
||||
var/range = 8
|
||||
var/view_check = TRUE
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
/obj/item/detective_scanner/attack_self(mob/user)
|
||||
if(log.len && !scanning)
|
||||
scanning = 1
|
||||
scanning = TRUE
|
||||
to_chat(user, "<span class='notice'>Printing report, please wait...</span>")
|
||||
addtimer(CALLBACK(src, .proc/PrintReport), 100)
|
||||
else
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
// Clear the logs
|
||||
log = list()
|
||||
scanning = 0
|
||||
scanning = FALSE
|
||||
|
||||
/obj/item/detective_scanner/afterattack(atom/A, mob/user, params)
|
||||
. = ..()
|
||||
@@ -70,7 +70,7 @@
|
||||
if((get_dist(A, user) > range) || (!(A in view(range, user)) && view_check) || (loc != user))
|
||||
return
|
||||
|
||||
scanning = 1
|
||||
scanning = TRUE
|
||||
|
||||
user.visible_message("\The [user] points the [src.name] at \the [A] and performs a forensic scan.")
|
||||
to_chat(user, "<span class='notice'>You scan \the [A]. The scanner is now analysing the results...</span>")
|
||||
@@ -80,14 +80,20 @@
|
||||
|
||||
//Make our lists
|
||||
var/list/fingerprints = list()
|
||||
var/list/blood = A.return_blood_DNA()
|
||||
var/list/fibers = A.return_fibers()
|
||||
var/list/blood = list()
|
||||
var/list/fibers = list()
|
||||
var/list/reagents = list()
|
||||
|
||||
var/target_name = A.name
|
||||
|
||||
// Start gathering
|
||||
|
||||
if(A.blood_DNA && A.blood_DNA.len)
|
||||
blood = A.blood_DNA.Copy()
|
||||
|
||||
if(A.suit_fibers && A.suit_fibers.len)
|
||||
fibers = A.suit_fibers.Copy()
|
||||
|
||||
if(ishuman(A))
|
||||
|
||||
var/mob/living/carbon/human/H = A
|
||||
@@ -96,7 +102,8 @@
|
||||
|
||||
else if(!ismob(A))
|
||||
|
||||
fingerprints = A.return_fingerprints()
|
||||
if(A.fingerprints && A.fingerprints.len)
|
||||
fingerprints = A.fingerprints.Copy()
|
||||
|
||||
// Only get reagents from non-mobs.
|
||||
if(A.reagents && A.reagents.reagent_list.len)
|
||||
@@ -115,40 +122,40 @@
|
||||
|
||||
// We gathered everything. Create a fork and slowly display the results to the holder of the scanner.
|
||||
|
||||
var/found_something = 0
|
||||
var/found_something = FALSE
|
||||
add_log("<B>[STATION_TIME_TIMESTAMP("hh:mm:ss")][get_timestamp()] - [target_name]</B>", 0)
|
||||
|
||||
// Fingerprints
|
||||
if(length(fingerprints))
|
||||
sleep(30)
|
||||
sleep(3 SECONDS)
|
||||
add_log("<span class='info'><B>Prints:</B></span>")
|
||||
for(var/finger in fingerprints)
|
||||
add_log("[finger]")
|
||||
found_something = 1
|
||||
found_something = TRUE
|
||||
|
||||
// Blood
|
||||
if (length(blood))
|
||||
sleep(30)
|
||||
sleep(3 SECONDS)
|
||||
add_log("<span class='info'><B>Blood:</B></span>")
|
||||
found_something = 1
|
||||
found_something = TRUE
|
||||
for(var/B in blood)
|
||||
add_log("Type: <font color='red'>[blood[B]]</font> DNA: <font color='red'>[B]</font>")
|
||||
|
||||
//Fibers
|
||||
if(length(fibers))
|
||||
sleep(30)
|
||||
sleep(3 SECONDS)
|
||||
add_log("<span class='info'><B>Fibers:</B></span>")
|
||||
for(var/fiber in fibers)
|
||||
add_log("[fiber]")
|
||||
found_something = 1
|
||||
found_something = TRUE
|
||||
|
||||
//Reagents
|
||||
if(length(reagents))
|
||||
sleep(30)
|
||||
sleep(3 SECONDS)
|
||||
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
|
||||
found_something = TRUE
|
||||
|
||||
// Get a new user
|
||||
var/mob/holder = null
|
||||
@@ -164,10 +171,10 @@
|
||||
to_chat(holder, "<span class='notice'>You finish scanning \the [target_name].</span>")
|
||||
|
||||
add_log("---------------------------------------------------------", 0)
|
||||
scanning = 0
|
||||
scanning = FALSE
|
||||
return
|
||||
|
||||
/obj/item/detective_scanner/proc/add_log(msg, broadcast = 1)
|
||||
/obj/item/detective_scanner/proc/add_log(msg, broadcast = TRUE)
|
||||
if(scanning)
|
||||
if(broadcast && ismob(loc))
|
||||
var/mob/M = loc
|
||||
|
||||
Reference in New Issue
Block a user