From 42e259d925d4d39b8d528ac393a3020d4a97a623 Mon Sep 17 00:00:00 2001 From: phil235 Date: Fri, 13 May 2016 17:19:07 +0200 Subject: [PATCH] Changes how hidden fingerprints (for admin use) work. Old system: If the player is not the last person to touch the object, we add a new line to the hiddenfingerprints list with key, real name, whether the mob has gloves, and time stamp. Issues: If only one player touches the object then you only know about the first time they touched it. It's not completely spam proof, two players touching the object alternatively can make the list as big as they want. New system: Each player touching an object is attributed one line in the hiddenfingerprints list. The line shows the player key, real name, and time stamp for both first and last time touched, and whether wearing gloves for both. Issues: The list can become relatively big if many different players touch the same object (but not infinite). If multiple players touch the object alternatively, you get more info with the old system. If one player is the only one touching the object and does so multiple times, then you get more info with the new system. --- code/modules/detectivework/detective_work.dm | 81 ++++++++------------ 1 file changed, 30 insertions(+), 51 deletions(-) diff --git a/code/modules/detectivework/detective_work.dm b/code/modules/detectivework/detective_work.dm index fa324c1886c..ae06fcbd7ad 100644 --- a/code/modules/detectivework/detective_work.dm +++ b/code/modules/detectivework/detective_work.dm @@ -47,80 +47,59 @@ //world.log << "Added fibertext: [fibertext]" suit_fibers += "Material from a pair of [M.gloves.name]." + /atom/proc/add_hiddenprint(mob/living/M) - if(isnull(M)) return - if(isnull(M.key)) return + if(!M || !M.key) + return + + if(!fingerprintshidden) //Add the list if it does not exist + fingerprintshidden = list() + + var/hasgloves = "" if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.gloves) - if(fingerprintslast != H.ckey) - fingerprintshidden += "\[[time_stamp()]\] (Wearing gloves). Real name: [H.real_name], Key: [H.key]" - fingerprintslast = H.ckey - return 0 - if(!fingerprints) - if(fingerprintslast != H.ckey) - fingerprintshidden += "\[[time_stamp()]\] Real name: [H.real_name], Key: [H.key]" - fingerprintslast = H.ckey - return 1 + hasgloves = "(gloves)" + + var/current_time = time_stamp() + if(!fingerprintshidden[M.key]) + fingerprintshidden[M.key] = "Real name: [M.real_name]. First: \[[current_time]\][hasgloves]." else - if(fingerprintslast != M.ckey) - fingerprintshidden += "\[[time_stamp()]\] Real name: [M.real_name], Key: [M.key]" - fingerprintslast = M.ckey - return + var/laststamppos = findtext(fingerprintshidden[M.key], " Last: ") + if(laststamppos) + fingerprintshidden[M.key] = copytext(fingerprintshidden[M.key], 1, laststamppos) + fingerprintshidden[M.key] += " Last: \[[current_time]\][hasgloves]." + + fingerprintslast = M.ckey + //Set ignoregloves to add prints irrespective of the mob having gloves on. /atom/proc/add_fingerprint(mob/living/M, ignoregloves = 0) - if(isnull(M)) return - if(isnull(M.key)) return + if(!M || !M.key) + return + + add_hiddenprint(M) + if(ishuman(M)) var/mob/living/carbon/human/H = M - //Add the list if it does not exist. - if(!fingerprintshidden) - fingerprintshidden = list() - //Fibers~ add_fibers(H) - //Now, lets get to the dirty work. - - //Check if the gloves (if any) hide fingerprints - if(H.gloves) + if(H.gloves) //Check if the gloves (if any) hide fingerprints var/obj/item/clothing/gloves/G = H.gloves if(G.transfer_prints) ignoregloves = 1 - //Now, deal with gloves. - if(!ignoregloves) - if(H.gloves && H.gloves != src) - if(fingerprintslast != H.ckey) - fingerprintshidden += text("\[[]\](Wearing gloves). Real name: [], Key: []",time_stamp(), H.real_name, H.key) - fingerprintslast = H.ckey - H.gloves.add_fingerprint(M) - return 0 + if(!ignoregloves) + H.gloves.add_fingerprint(H, 1) //ignoregloves = 1 to avoid infinite loop. + return - //More adminstuffz - if(fingerprintslast != H.ckey) - fingerprintshidden += text("\[[]\]Real name: [], Key: []",time_stamp(), H.real_name, H.key) - fingerprintslast = H.ckey - - //Make the list if it does not exist. - if(!fingerprints) + if(!fingerprints) //Add the list if it does not exist fingerprints = list() - - //Hash this shit. var/full_print = md5(H.dna.uni_identity) - - // Add the fingerprints fingerprints[full_print] = full_print - return 1 - else - //Smudge up dem prints some - if(fingerprintslast != M.ckey) - fingerprintshidden += text("\[[]\]Real name: [], Key: []",time_stamp(), M.real_name, M.key) - fingerprintslast = M.ckey - return /atom/proc/transfer_fingerprints_to(atom/A)