mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
* Partial port of @PsiOmegaDelta's https://github.com/Baystation12/Baystation12/pull/16820 * Only ports the StonedMC changes, not the garbage collector (forthcoming in future)
21 lines
714 B
Plaintext
21 lines
714 B
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 b.init_order - a.init_order
|
|
|
|
// Sorts subsystems by priority
|
|
/proc/cmp_subsystem_priority(datum/controller/subsystem/a, datum/controller/subsystem/b)
|
|
return a.priority - b.priority
|