Files
Bubberstation/code/modules/admin/verbs/hiddenprints.dm
SkyratBot 7bb8ecb768 [MIRROR] Fixup list helpers, remove listoflist footgun from generic list procs, remove duplicated procs. [MDB IGNORE] (#17749)
* Fixup list helpers, remove listoflist footgun from generic list procs, remove duplicated procs. (#71280)

Add helper defines for handling list values in lists to remove the
footgun where `+=` and `-=` with lists as the Right hand side argument
causes the list contents to be added or removed, not the list itself.

Use said helpers to remove the footgun from list helpers that could
reasonably be expected to get called on list of lists.

Remove duplicated clear nulls from list proc. this pr will fail to
compile until i go move those over to the preexisting one, but the
compile errors will tell me where all the consumers are.

This likely fixes some bug(s) in the issue tracker, but we don't know
what they are.

* Fixup list helpers, remove listoflist footgun from generic list procs, remove duplicated procs.

Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
2022-11-25 15:01:04 +00: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 = GET_ATOM_HIDDENPRINTS(victim)
if(!islist(victim_hiddenprints))
victim_hiddenprints = list()
var/list/hiddenprints = flatten_list(victim_hiddenprints)
list_clear_nulls(hiddenprints)
if(!length(hiddenprints))
hiddenprints = list("Nobody has touched this yet!")
hiddenprints = sort_list(hiddenprints, GLOBAL_PROC_REF(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)