Fixes for detective work. Should fix some of the massive lag, probably caused by all those list()s that were being made for every atom. And this is why I should not code at 2AM. (A UI overhaul-ish thing will come soon for the detective computer.)

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3257 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
joe.heinemeyer@gmail.com
2012-03-06 00:01:53 +00:00
parent f89dbfd276
commit cb5a57549d
6 changed files with 45 additions and 20 deletions
+3 -3
View File
@@ -3,8 +3,8 @@
var/level = 2
var/flags = FPRINT
var/flags_inv //This flag is used to determine when items in someone's inventory cover others. IE helmets making it so you can't see glasses, etc.
var/list/fingerprints = list()
var/list/fingerprintshidden = list()
var/list/fingerprints
var/list/fingerprintshidden
var/fingerprintslast = null
var/list/blood_DNA = list()
var/last_bumped = 0
@@ -18,7 +18,7 @@
///Chemistry.
//Detective Work, used for the duplicate data points kept in the scanners
var/atom/movable/original_atom = null
var/list/original_atom
proc/assume_air(datum/air_group/giver)
del(giver)
+12 -3
View File
@@ -106,6 +106,8 @@
if (!( src.flags ) & 256)
return
if (ishuman(M))
if(!fingerprintshidden)
fingerprintshidden = list()
add_fibers(M)
var/mob/living/carbon/human/H = M
if (!istype(H.dna, /datum/dna) || !H.dna.uni_identity || (length(H.dna.uni_identity) != 32))
@@ -116,7 +118,7 @@
if(src.fingerprintslast != H.key)
src.fingerprintshidden += text("(Wearing gloves). Real name: [], Key: []",H.real_name, H.key)
src.fingerprintslast = H.key
H.gloves.add_fingerprint(M)
H.gloves.add_fingerprint(M)
if(H.gloves != src)
if(prob(75) && istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0
@@ -143,13 +145,14 @@
src.fingerprints[j-1] = src.fingerprints[j]
src.fingerprints.len--
else
src.fingerprints[i] = "1=" + L[num2text(1)] + "&2=" + test_print
src.fingerprints[i] = "1=[L[num2text(1)]]&2=[test_print]"
if(new_prints)
src.fingerprints[new_prints] = text("1=[]&2=[]", md5(H.dna.uni_identity), stringmerge(prints,stars(md5(H.dna.uni_identity), (H.gloves ? rand(10,20) : rand(25,40)))))
else if(new_prints == 0)
if(!src.fingerprints)
src.fingerprints = list(text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40))))
src.fingerprints += text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40)))
else
src.fingerprints += text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40)))
for(var/i = 1, i <= src.fingerprints.len, i++)
if(length(src.fingerprints[i]) != 69)
src.fingerprints.Remove(src.fingerprints[i])
@@ -294,6 +297,9 @@
source2.blood_DNA = list()
//var/icon/I = new /icon(source2.icon_old, source2.icon_state) //doesnt have icon_old
//source2.icon = I
if(ishuman(src))
var/mob/living/carbon/human/M = src
M.bloody_hands = 0
if (istype (src, /obj/item))
var/obj/item/source2 = src
source2.blood_DNA = list()
@@ -304,6 +310,9 @@
else
source2.icon = initial(icon)
source2.update_icon()
if(istype(src, /obj/item/clothing/gloves))
var/obj/item/clothing/gloves/G = src
G.transfer_blood = 0
if (istype(src, /turf/simulated))
var/obj/item/source2 = src
source2.blood_DNA = list()
+10 -3
View File
@@ -401,6 +401,12 @@
src.attack_hand(usr)
/obj/machinery/turretid/proc/updateTurrets()
if(control_area)
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
aTurret.setState(enabled, lethal)
update_icons()
/obj/machinery/turretid/proc/update_icons()
if (src.enabled)
if (src.lethal)
icon_state = "motion1"
@@ -408,10 +414,11 @@
icon_state = "motion3"
else
icon_state = "motion0"
if(control_area)
for (var/obj/machinery/turret/aTurret in get_area_all_atoms(control_area))
aTurret.setState(enabled, lethal)
for (var/obj/machinery/turretid/aTurret in get_area_all_atoms(control_area))
aTurret.icon_state = icon_state
aTurret.enabled = enabled
aTurret.lethal = lethal
+5 -6
View File
@@ -144,6 +144,8 @@ MASS SPECTROMETER
if(istype(A,/obj/item/weapon/f_card))
user << "Haha, nice try. Cheater. (It would break stuff anyways.)"
return
if(!A.fingerprints)
A.fingerprints = list()
src.add_fingerprint(user)
if (istype(A, /obj/effect/decal/cleanable/blood) || istype(A, /obj/effect/rune))
if(!isnull(A.blood_DNA.len))
@@ -209,7 +211,8 @@ MASS SPECTROMETER
for(var/i = 1, i < (stored.len + 1), i++) //Lets see if the object is already in there!
var/list/temp = stored[i]
var/atom/checker = temp[1]
if(checker.original_atom == A || checker.original_atom == A.original_atom) //It is! Merge!
var/atom_checker_scan = (A.original_atom ? checker.original_atom[1] == A.original_atom[1] : 0)
if(checker.original_atom[1] == A || atom_checker_scan) //It is! Merge!
merged = 1
var/list/prints = temp[2]
if(!prints)
@@ -252,11 +255,7 @@ MASS SPECTROMETER
if(!merged) //Uh, oh! New data point!
var/list/sum_list[4] //Pack it back up!
sum_list[1] = A.get_duplicate(src)
if(!A.fingerprints)
world << "Report this to a dev! [A] was lacking a list() for fingerprints!"
sum_list[2] = list()
else
sum_list[2] = A.fingerprints
sum_list[2] = A.fingerprints
sum_list[3] = A.suit_fibers
sum_list[4] = A.blood_DNA
stored.len++
+7 -3
View File
@@ -61,7 +61,7 @@ atom/proc/get_duplicate(var/atom/location)
if(src.original_atom)
temp_atom.original_atom = src.original_atom
else
temp_atom.original_atom = src
temp_atom.original_atom = list(src)
return temp_atom
#define FINGERPRINT_COMPLETE 6 //This is the output of the stringpercent(print) proc, and means about 80% of
@@ -407,6 +407,8 @@ obj/machinery/computer/forensic_scanning
scan_data += "-Blood type: [templist[2]]\nDNA: [templist[1]]<br><br>"
else
scan_data += "No Blood Found<br><br>"
if(!scanning.fingerprints)
scanning.fingerprints = list()
if (!length(scanning.fingerprints))
scan_data += "No Fingerprints Found<br><br>"
else
@@ -518,7 +520,8 @@ obj/machinery/computer/forensic_scanning
for(var/i = 1, i <= misc.len, i++) //Lets see if we can find it.
var/list/templist = misc[i]
var/atom/check = templist[1]
if(check.original_atom == A || check.original_atom == A.original_atom) //There it is!
var/atom_checker_scan = (A.original_atom ? check.original_atom[1] == A.original_atom[1] : 0)
if(check.original_atom[1] == A || atom_checker_scan) //There it is!
merged = 1
var/list/fibers = templist[2]
if(!fibers)
@@ -567,7 +570,8 @@ obj/machinery/computer/forensic_scanning
for(var/n = 2, n <= perp_list.len, n++) //Lets see if it is already in the database
var/list/target = perp_list[n]
var/atom/atom_checker = target[1]
if(atom_checker.original_atom == A || atom_checker.original_atom == A.original_atom) //Found the original object!
var/atom_checker_scan = (A.original_atom.len ? atom_checker.original_atom[1] == A.original_atom[1] : 0)
if(atom_checker.original_atom[1] == A || atom_checker_scan) //Found the original object!
found2 = 1
var/list/prints = target[2]
if(!prints)
@@ -107,10 +107,16 @@ emp_act
location.add_blood(src)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.gloves) H.gloves.add_blood(src)
else H.add_blood(src)
if(H.wear_suit) H.wear_suit.add_blood(src)
else if(H.w_uniform) H.w_uniform.add_blood(src)
if (H.gloves)
H.gloves.add_blood(H)
H.gloves.transfer_blood = 2
H.gloves.bloody_hands_mob = H
else
H.add_blood(H)
H.bloody_hands = 2
H.bloody_hands_mob = H
switch(hit_area)
if("head")//Harder to score a stun but if you do it lasts a bit longer