Files
Bubberstation/code/modules/admin/verbs/hiddenprints.dm
SkyratBot c9cee159a5 [MIRROR] Add Show Hiddenprints action to VV on atoms (#5212)
* Add Show Hiddenprints action to VV on atoms (#58657)

This displays the hiddenprint log from /datum/component/forensics in a simple to view form, sorted by last touch. I didn't make it fancy, it's very bare bones.

I could have refactored hiddenprints to use lists in lists, which would make getting data out a lot easier, but I worry about the additional memory overhead on every atom that gets touched, so I left it as strings in lists. I did reformat it a little bit, however, to make it simpler to sort, and it looks a little nicer. Namely moving the timestamp in front of the name.

It can help a lot in admin investigations on whodunnit. Right now they have to look at the forensics component, and that's if they even know about it. This way it is discoverable by using the VV tool.

* Add Show Hiddenprints action to VV on atoms

Co-authored-by: Jonathan Rubenstein <jrubcop@gmail.com>
2021-04-26 11:55:11 +01:00

31 lines
1.0 KiB
Plaintext

/client/proc/cmd_show_hiddenprints(atom/victim)
if(!check_rights(R_ADMIN))
return
var/interface = "A log of every player who has touched [victim], sorted by last touch.<br><br><ol>"
var/victim_hiddenprints = victim.return_hiddenprints()
if(!islist(victim_hiddenprints))
victim_hiddenprints = list()
var/list/hiddenprints = flatten_list(victim_hiddenprints)
removeNullsFromList(hiddenprints)
if(!length(hiddenprints))
hiddenprints = list("Nobody has touched this yet!")
hiddenprints = sortList(hiddenprints, /proc/cmp_hiddenprint_lasttime_dsc)
for(var/record in hiddenprints)
interface += "<li>[record]</li><br>"
interface += "</ol>"
var/datum/browser/hiddenprint_view = new(usr, "view_hiddenprints_[REF(victim)]", "[victim]'s hiddenprints", 450, 760)
hiddenprint_view.set_content(interface)
hiddenprint_view.open()
/proc/cmp_hiddenprint_lasttime_dsc(a, b)
var/last_a = copytext(a, findtext(a, "\nLast: "))
var/last_b = copytext(b, findtext(b, "\nLast: "))
return cmp_text_dsc(last_a, last_b)