mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-16 03:27:06 +01:00
tl;dr level collections that can easily be logically restructured/moved as necessary will eventually be used for radio and overmaps location resolution. this is the last part of https://github.com/Citadel-Station-13/Citadel-Station-13-RP/pull/4841 that has not yet been integrated. this will be a draft for a while. --------- Co-authored-by: LetterN <24603524+LetterN@users.noreply.github.com>
29 lines
939 B
Plaintext
29 lines
939 B
Plaintext
//* This file is explicitly licensed under the MIT license. *//
|
|
//* Copyright (c) 2024 Citadel Station Developers *//
|
|
|
|
/**
|
|
* Sort by ascending struct z
|
|
*/
|
|
/proc/cmp_map_level_struct_z_asc(datum/map_level/A, datum/map_level/B)
|
|
return A.struct_z - B.struct_z
|
|
|
|
/**
|
|
* Returns load order. This is needed because z-mimic requires levels to be ascending in order for two
|
|
* given multi-z levels.
|
|
*/
|
|
/proc/cmp_map_level_load_sequence(datum/map_level/A, datum/map_level/B)
|
|
// shit with no struct always goes last
|
|
var/A_has_struct = A.is_in_struct()
|
|
var/B_has_struct = B.is_in_struct()
|
|
if(A_has_struct != B_has_struct)
|
|
if(A_has_struct && !B_has_struct)
|
|
return -1 // A before B
|
|
else if(B_has_struct && !A_has_struct)
|
|
return 1 // B before A
|
|
CRASH("unreachable")
|
|
if(A.struct_x != B.struct_x)
|
|
return A.struct_x - B.struct_x
|
|
if(A.struct_y != B.struct_y)
|
|
return A.struct_y - B.struct_y
|
|
return A.struct_z - B.struct_z
|