mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
https://github.com/tgstation/tgstation/pull/30118 - Garbage collection tweaks and refactors. https://github.com/tgstation/tgstation/pull/32022 - Find references fix.
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
//
|
|
// Comparators for use with /datum/sortInstance (or wherever you want)
|
|
// They should return negative, zero, or positive numbers for a < b, a == b, and a > b respectively.
|
|
//
|
|
|
|
// Sorts numeric ascending
|
|
/proc/cmp_numeric_asc(a,b)
|
|
return a - b
|
|
|
|
// Sorts subsystems alphabetically
|
|
/proc/cmp_subsystem_display(datum/controller/subsystem/a, datum/controller/subsystem/b)
|
|
return sorttext(b.name, a.name)
|
|
|
|
// Sorts subsystems by init_order
|
|
/proc/cmp_subsystem_init(datum/controller/subsystem/a, datum/controller/subsystem/b)
|
|
return initial(b.init_order) - initial(a.init_order) //uses initial() so it can be used on types
|
|
|
|
// Sorts subsystems by priority
|
|
/proc/cmp_subsystem_priority(datum/controller/subsystem/a, datum/controller/subsystem/b)
|
|
return a.priority - b.priority
|
|
|
|
// Sorts qdel statistics recorsd by time and count
|
|
/proc/cmp_qdel_item_time(datum/qdel_item/A, datum/qdel_item/B)
|
|
. = B.hard_delete_time - A.hard_delete_time
|
|
if (!.)
|
|
. = B.destroy_time - A.destroy_time
|
|
if (!.)
|
|
. = B.failures - A.failures
|
|
if (!.)
|
|
. = B.qdels - A.qdels
|