diff --git a/.tgs.yml b/.tgs.yml index 91d2401153..fb78890c55 100644 --- a/.tgs.yml +++ b/.tgs.yml @@ -3,7 +3,7 @@ version: 1 # The BYOND version to use (kept in sync with dependencies.sh by the "TGS Test Suite" CI job) # Must be interpreted as a string, keep quoted -byond: "516.1669" +byond: "516.1673" # Folders to create in "/Configuration/GameStaticFiles/" static_files: # Config directory should be static diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm index 0af2af7f4a..1c10ec753f 100644 --- a/code/__byond_version_compat.dm +++ b/code/__byond_version_compat.dm @@ -8,11 +8,11 @@ //Update this whenever you need to take advantage of more recent byond features #define MIN_COMPILER_VERSION 516 -#define MIN_COMPILER_BUILD 1664 +#define MIN_COMPILER_BUILD 1667 #if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM) && !defined(OPENDREAM) //Don't forget to update this part #error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update. -#error You need version 516.1664 or higher +#error You need version 516.1667 or higher #endif // Keep savefile compatibilty at minimum supported level diff --git a/code/__defines/__globals.dm b/code/__defines/__globals.dm index d355da20bc..f634abbcd5 100644 --- a/code/__defines/__globals.dm +++ b/code/__defines/__globals.dm @@ -48,6 +48,18 @@ /// Create a typed list global that is initialized as an empty list #define GLOBAL_LIST_EMPTY_TYPED(X, Typepath) GLOBAL_LIST_INIT_TYPED(X, Typepath, list()) +/// Create an alist global with an initializer expression +#define GLOBAL_ALIST_INIT(X, InitValue) GLOBAL_RAW(/alist/##X); GLOBAL_MANAGED(X, InitValue) + +/// Create an alist global that is initialized as an empty list +#define GLOBAL_ALIST_EMPTY(X) GLOBAL_ALIST_INIT(X, alist()) + +/// Create a typed alist global with an initializer expression +//#define GLOBAL_ALIST_INIT_TYPED(X, Typepath, InitValue) GLOBAL_RAW(/alist##Typepath/X); GLOBAL_MANAGED(X, InitValue) // Missing in spacemandmm + +/// Create a typed alist global that is initialized as an empty list +//#define GLOBAL_ALIST_EMPTY_TYPED(X, Typepath) GLOBAL_ALIST_INIT_TYPED(X, Typepath, alist()) // Missing in spacemandmm + /// Create a typed global with an initializer expression #define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue) @@ -57,5 +69,8 @@ /// Create a null global list #define GLOBAL_LIST(X) GLOBAL_RAW(/list/##X); GLOBAL_UNMANAGED(X) +/// Create a null global alist +#define GLOBAL_ALIST(X) GLOBAL_RAW(/alist/##X); GLOBAL_UNMANAGED(X) + /// Create a typed null global #define GLOBAL_DATUM(X, Typepath) GLOBAL_RAW(Typepath/##X); GLOBAL_UNMANAGED(X) diff --git a/code/_helpers/_lists.dm b/code/_helpers/_lists.dm index 8fe7dbf9c8..3e92c6ff18 100644 --- a/code/_helpers/_lists.dm +++ b/code/_helpers/_lists.dm @@ -1060,3 +1060,26 @@ GLOBAL_LIST_EMPTY(json_cache) else if(value_1 != value_2) return FALSE return TRUE + +/** + * Attempts to convert a numeric keyed alist of (2=second, 1=first) to a list of (first, second). + * + * If you instead want to discard values and keep only keys, just do list + alist. + * + * Arguments: + * * to_flatten - The alist with sequential numeric keys to extract values from into a normal list. + * * assert - Whether to assert every key is numeric and in bounds. + */ +/proc/flatten_numeric_alist(alist/to_flatten, assert=TRUE) + RETURN_TYPE(/list) + + var/count = length(to_flatten) + if(assert) + for(var/key in to_flatten) + if(!isnum(key) || key < 1 || key > count) + CRASH("flatten_numeric_alist not possible for alist: [json_encode(to_flatten)]") + + var/list/retval = list() + for(var/i in 1 to count) + retval += to_flatten[i] + return retval diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index 79e259b88f..489a2dffb4 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -1214,7 +1214,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle = new GLOBAL_LIST_EMPTY(gun_choices) -GLOBAL_LIST_INIT(severity_to_string, list( +GLOBAL_ALIST_INIT(severity_to_string, alist( EVENT_LEVEL_MUNDANE = "Mundane", EVENT_LEVEL_MODERATE = "Moderate", EVENT_LEVEL_MAJOR = "Major" diff --git a/code/controllers/subsystems/events.dm b/code/controllers/subsystems/events.dm index 25dcebb81f..f8261ed7f1 100644 --- a/code/controllers/subsystems/events.dm +++ b/code/controllers/subsystems/events.dm @@ -11,13 +11,13 @@ SUBSYSTEM_DEF(events) var/list/datum/event/finished_events = list() var/list/datum/event/allEvents - var/list/datum/event_container/event_containers + var/alist/event_containers var/datum/event_meta/new_event = new /datum/controller/subsystem/events/Initialize() allEvents = subtypesof(/datum/event) - event_containers = list( + event_containers = alist( EVENT_LEVEL_MUNDANE = new/datum/event_container/mundane, EVENT_LEVEL_MODERATE = new/datum/event_container/moderate, EVENT_LEVEL_MAJOR = new/datum/event_container/major diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index 6361b4d2c2..4640fc1119 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -379,7 +379,7 @@ SUBSYSTEM_DEF(timer) var/spent = 0 /// Holds info about this timer, stored from the moment it was created /// Used to create a visible "name" whenever the timer is stringified - var/list/timer_info + var/alist/timer_info /// Next timed event in the bucket var/datum/timedevent/next /// Previous timed event in the bucket @@ -521,7 +521,7 @@ SUBSYSTEM_DEF(timer) /datum/timedevent/proc/bucketJoin() #if defined(TIMER_DEBUG) // Generate debug-friendly list for timer, more complex but also more expensive - timer_info = list( + timer_info = alist( 1 = id, 2 = timeToRun, 3 = wait, @@ -536,7 +536,7 @@ SUBSYSTEM_DEF(timer) ) #else // Generate a debuggable list for the timer, simpler but wayyyy cheaper, string generation (and ref/copy memes) is a bitch and this saves a LOT of time - timer_info = list( + timer_info = alist( 1 = id, 2 = timeToRun, 3 = wait, diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm index 3cf0dab812..2eb8d5a3ca 100644 --- a/code/modules/admin/verbs/atmosdebug.dm +++ b/code/modules/admin/verbs/atmosdebug.dm @@ -7,38 +7,38 @@ feedback_add_details("admin_verb","CP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - if(tgui_alert(usr, "WARNING: This command should not be run on a live server. Do you want to continue?", "Check Piping", list("No", "Yes")) != "Yes") + if(tgui_alert(src, "WARNING: This command should not be run on a live server. Do you want to continue?", "Check Piping", list("No", "Yes")) != "Yes") return - to_chat(usr, "Checking for disconnected pipes...") + to_chat(src, "Checking for disconnected pipes...") //all plumbing - yes, some things might get stated twice, doesn't matter. for (var/obj/machinery/atmospherics/plumbing in GLOB.machines) if (plumbing.nodealert) - to_chat(usr, span_filter_adminlog(span_warning("Unconnected [plumbing.name] located at [plumbing.x],[plumbing.y],[plumbing.z] ([get_area(plumbing.loc)])"))) + to_chat(src, span_filter_adminlog(span_warning("Unconnected [plumbing.name] located at [plumbing.x],[plumbing.y],[plumbing.z] ([get_area(plumbing.loc)])"))) //Manifolds for (var/obj/machinery/atmospherics/pipe/manifold/pipe in GLOB.machines) if (!pipe.node1 || !pipe.node2 || !pipe.node3) - to_chat(usr, span_filter_adminlog(span_warning("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])"))) + to_chat(src, span_filter_adminlog(span_warning("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])"))) //Pipes for (var/obj/machinery/atmospherics/pipe/simple/pipe in GLOB.machines) if (!pipe.node1 || !pipe.node2) - to_chat(usr, span_filter_adminlog(span_warning("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])"))) + to_chat(src, span_filter_adminlog(span_warning("Unconnected [pipe.name] located at [pipe.x],[pipe.y],[pipe.z] ([get_area(pipe.loc)])"))) - to_chat(usr, "Checking for overlapping pipes...") + to_chat(src, "Checking for overlapping pipes...") next_turf: for(var/turf/T in world) for(var/dir in GLOB.cardinal) - var/list/connect_types = list(1 = 0, 2 = 0, 3 = 0) + var/alist/connect_types = alist(1 = 0, 2 = 0, 3 = 0) for(var/obj/machinery/atmospherics/pipe in T) if(dir & pipe.initialize_directions) for(var/connect_type in pipe.connect_types) connect_types[connect_type] += 1 if(connect_types[1] > 1 || connect_types[2] > 1 || connect_types[3] > 1) - to_chat(usr, span_filter_adminlog(span_warning("Overlapping pipe ([pipe.name]) located at [T.x],[T.y],[T.z] ([get_area(T)])"))) + to_chat(src, span_filter_adminlog(span_warning("Overlapping pipe ([pipe.name]) located at [T.x],[T.y],[T.z] ([get_area(T)])"))) continue next_turf - to_chat(usr, "Done") + to_chat(src, "Done") /client/proc/powerdebug() set category = "Mapping" diff --git a/dependencies.sh b/dependencies.sh index 73038e0985..9e68b1001f 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -5,7 +5,7 @@ # byond version export BYOND_MAJOR=516 -export BYOND_MINOR=1669 +export BYOND_MINOR=1673 # Macro Count export MACRO_COUNT=6