Some optimizations for fingerprints. General debugging.

This commit is contained in:
SkyMarshal
2012-03-05 16:33:47 -07:00
parent 8ae86d253f
commit 43f7487429
5 changed files with 33 additions and 19 deletions

View File

@@ -2,8 +2,8 @@
layer = 2 layer = 2
var/level = 2 var/level = 2
var/flags = FPRINT var/flags = FPRINT
var/list/fingerprints = list() var/list/fingerprints
var/list/fingerprintshidden = list() var/list/fingerprintshidden
var/fingerprintslast = null var/fingerprintslast = null
var/list/blood_DNA = list() var/list/blood_DNA = list()
var/last_bumped = 0 var/last_bumped = 0
@@ -13,7 +13,7 @@
var/datum/reagents/reagents = null var/datum/reagents/reagents = null
//Detective Work, used for the duplicate data points kept in the scanners //Detective Work, used for the duplicate data points kept in the scanners
var/atom/movable/original_atom = null var/list/original_atom = list()
//var/chem_is_open_container = 0 //var/chem_is_open_container = 0
// replaced by OPENCONTAINER flags and atom/proc/is_open_container() // replaced by OPENCONTAINER flags and atom/proc/is_open_container()

View File

@@ -84,6 +84,8 @@
if (!( src.flags ) & 256) if (!( src.flags ) & 256)
return return
if (ishuman(M)) if (ishuman(M))
if(!fingerprintshidden)
fingerprintshidden = list()
add_fibers(M) add_fibers(M)
if (M.mutations2 & mFingerprints) if (M.mutations2 & mFingerprints)
if(src.fingerprintslast != M.key) if(src.fingerprintslast != M.key)
@@ -99,7 +101,7 @@
if(src.fingerprintslast != H.key) if(src.fingerprintslast != H.key)
src.fingerprintshidden += text("(Wearing gloves). Real name: [], Key: []",H.real_name, H.key) src.fingerprintshidden += text("(Wearing gloves). Real name: [], Key: []",H.real_name, H.key)
src.fingerprintslast = H.key src.fingerprintslast = H.key
H.gloves.add_fingerprint(M) H.gloves.add_fingerprint(M)
if(H.gloves != src) if(H.gloves != src)
if(prob(75) && istype(H.gloves, /obj/item/clothing/gloves/latex)) if(prob(75) && istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0 return 0
@@ -128,13 +130,14 @@
src.fingerprints[j] = src.fingerprints[j+1] src.fingerprints[j] = src.fingerprints[j+1]
src.fingerprints.len-- src.fingerprints.len--
else else
src.fingerprints[i] = "1=" + L[num2text(1)] + "&2=" + test_print src.fingerprints[i] = "1=[L[num2text(1)]]&2=[test_print]"
if(new_prints) 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))))) 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) else if(new_prints == 0)
if(!src.fingerprints || !src.fingerprints.len) if(!src.fingerprints || !src.fingerprints.len)
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 = 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++) for(var/i = 1, i <= src.fingerprints.len, i++)
if(length(src.fingerprints[i]) != 69) if(length(src.fingerprints[i]) != 69)
src.fingerprints.Remove(src.fingerprints[i]) src.fingerprints.Remove(src.fingerprints[i])
@@ -279,6 +282,9 @@
if (istype (src, /mob/living/carbon)) if (istype (src, /mob/living/carbon))
var/obj/item/source2 = src var/obj/item/source2 = src
source2.blood_DNA = list() source2.blood_DNA = list()
if(ishuman(src))
var/mob/living/carbon/human/M = src
M.bloody_hands = 0
//var/icon/I = new /icon(source2.icon_old, source2.icon_state) //doesnt have icon_old //var/icon/I = new /icon(source2.icon_old, source2.icon_state) //doesnt have icon_old
//source2.icon = I //source2.icon = I
if (istype (src, /obj/item)) if (istype (src, /obj/item))
@@ -291,6 +297,9 @@
else else
source2.icon = initial(icon) source2.icon = initial(icon)
source2.update_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)) if (istype(src, /turf/simulated))
var/obj/item/source2 = src var/obj/item/source2 = src
source2.blood_DNA = list() source2.blood_DNA = list()

View File

@@ -143,6 +143,8 @@ MASS SPECTROMETER
if(istype(A,/obj/item/weapon/f_card)) if(istype(A,/obj/item/weapon/f_card))
user << "Haha, nice try. Cheater. (It would break stuff anyways.)" user << "Haha, nice try. Cheater. (It would break stuff anyways.)"
return return
if(!A.fingerprints)
A.fingerprints = list()
src.add_fingerprint(user) src.add_fingerprint(user)
if (istype(A, /obj/effect/decal/cleanable/blood) || istype(A, /obj/effect/rune)) if (istype(A, /obj/effect/decal/cleanable/blood) || istype(A, /obj/effect/rune))
if(!isnull(A.blood_DNA.len)) if(!isnull(A.blood_DNA.len))
@@ -208,7 +210,8 @@ MASS SPECTROMETER
for(var/i = 1, i < (stored.len + 1), i++) //Lets see if the object is already in there! for(var/i = 1, i < (stored.len + 1), i++) //Lets see if the object is already in there!
var/list/temp = stored[i] var/list/temp = stored[i]
var/atom/checker = temp[1] 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.len ? checker.original_atom[1] == A.original_atom[1] : 0)
if(checker.original_atom[1] == A || atom_checker_scan) //It is! Merge!
merged = 1 merged = 1
var/list/prints = temp[2] var/list/prints = temp[2]
if(!prints) if(!prints)
@@ -251,11 +254,7 @@ MASS SPECTROMETER
if(!merged) //Uh, oh! New data point! if(!merged) //Uh, oh! New data point!
var/list/sum_list[4] //Pack it back up! var/list/sum_list[4] //Pack it back up!
sum_list[1] = A.get_duplicate(src) sum_list[1] = A.get_duplicate(src)
if(!A.fingerprints) sum_list[2] = 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[3] = A.suit_fibers sum_list[3] = A.suit_fibers
sum_list[4] = A.blood_DNA sum_list[4] = A.blood_DNA
stored.len++ stored.len++

View File

@@ -58,10 +58,10 @@ atom/proc/get_duplicate(var/atom/location)
temp_atom.fingerprints = src.fingerprints temp_atom.fingerprints = src.fingerprints
temp_atom.blood_DNA = src.blood_DNA temp_atom.blood_DNA = src.blood_DNA
temp_atom.suit_fibers = src.suit_fibers temp_atom.suit_fibers = src.suit_fibers
if(src.original_atom) if(src.original_atom.len)
temp_atom.original_atom = src.original_atom temp_atom.original_atom = src.original_atom
else else
temp_atom.original_atom = src temp_atom.original_atom = list(src)
return temp_atom return temp_atom
#define FINGERPRINT_COMPLETE 6 //This is the output of the stringpercent(print) proc, and means about 80% of #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>" scan_data += "-Blood type: [templist[2]]\nDNA: [templist[1]]<br><br>"
else else
scan_data += "No Blood Found<br><br>" scan_data += "No Blood Found<br><br>"
if(!scanning.fingerprints)
scanning.fingerprints = list()
if (!length(scanning.fingerprints)) if (!length(scanning.fingerprints))
scan_data += "No Fingerprints Found<br><br>" scan_data += "No Fingerprints Found<br><br>"
else 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. for(var/i = 1, i <= misc.len, i++) //Lets see if we can find it.
var/list/templist = misc[i] var/list/templist = misc[i]
var/atom/check = templist[1] 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.len ? check.original_atom[1] == A.original_atom[1] : 0)
if(check.original_atom[1] == A || atom_checker_scan) //There it is!
merged = 1 merged = 1
var/list/fibers = templist[2] var/list/fibers = templist[2]
if(!fibers) 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 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/list/target = perp_list[n]
var/atom/atom_checker = target[1] 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 found2 = 1
var/list/prints = target[2] var/list/prints = target[2]
if(!prints) if(!prints)

View File

@@ -85,8 +85,8 @@
else if(target && M == target) else if(target && M == target)
PreFire(M,user) PreFire(M,user)
return return
else if(user.a_intent == "hurt" && (istype(src.in_chamber, /obj/item/projectile/beam) || istype(src.in_chamber, /obj/item/projectile/energy)\ else if(user.a_intent == "hurt" && load_into_chamber() && (istype(src.in_chamber, /obj/item/projectile/beam) || istype(src.in_chamber, /obj/item/projectile/energy)\
|| istype(src.in_chamber, /obj/item/projectile/bullet)) && !istype(src.in_chamber, /obj/item/projectile/bullet/stunshot) && load_into_chamber()) || istype(src.in_chamber, /obj/item/projectile/bullet)))
//Lets shoot them, then. //Lets shoot them, then.
user.visible_message("\red <b> [user] fires \the [src] point blank at [M]!</b>") user.visible_message("\red <b> [user] fires \the [src] point blank at [M]!</b>")
M.bullet_act(in_chamber,"head") M.bullet_act(in_chamber,"head")
@@ -97,9 +97,11 @@
if (M.weakened < 10) if (M.weakened < 10)
M.weakened = 10 M.weakened = 10
if(M.stat != 2) M.stat = 1 if(M.stat != 2) M.stat = 1
if(M.health <= -50) //I pumped 7 more rounds into the guy, and only did an extra 26 damage :|
M.apply_damage(45) //So we'll put him an inch from death.
del(in_chamber) del(in_chamber)
return return
else if(user.a_intent != "hurt" && istype(src,/obj/item/weapon/gun/energy/taser) && load_into_chamber()) else if(user.a_intent != "hurt" && load_into_chamber() && istype(src,/obj/item/weapon/gun/energy/taser))
if (prob(50)) if (prob(50))
if (M.paralysis < 60 && (!(M.mutations & 8)) ) if (M.paralysis < 60 && (!(M.mutations & 8)) )
M.paralysis = 60 M.paralysis = 60