Files
CHOMPStation2/code/_helpers/sorts/comparators.dm
Leshana 90dff0ae63 Ports /tg's StonedMC Subsystem from Baystation12
* Partial port of @PsiOmegaDelta's https://github.com/Baystation12/Baystation12/pull/16820
* Only ports the StonedMC changes, not the garbage collector (forthcoming in future)
2017-05-30 21:00:37 -04:00

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