DCS Update + Footstep element (#17076)

* DCS Update + Footstep element

* Steppy

* Revert "Steppy"

This reverts commit fab0590fb7.

* Reapply "Steppy"

This reverts commit 1f7ad8f8f7.

* Ough

* Oops! Wrong map.

* lil stuff

* Update

* Only loud

* Missed one

* NO MORE SILENT

* ...parenthesis.
This commit is contained in:
Guti
2025-02-08 18:19:59 -05:00
committed by GitHub
parent d1b65c3635
commit a081d48590
79 changed files with 1695 additions and 579 deletions
+77 -22
View File
@@ -5,10 +5,34 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
var/list/elements_by_type = list()
/datum/controller/subsystem/processing/dcs/Recover()
comp_lookup = SSdcs.comp_lookup
/**
* A nested assoc list of bespoke element types (keys) and superlists containing all lists used as arguments (values).
* Inside the superlists, lists that've been sorted alphabetically are keys, while the original unsorted lists are values.
*
* e.g. list(
* /datum/element/first = list(list(A, B, C) = list(B, A, C), list(A, B) = list(A, B)),
* /datum/element/second = list(list(B, C) = list(C, B), list(D) = list(D)),
* )
*
* Used by the dcs_check_list_arguments unit test.
*/
var/list/arguments_that_are_lists_by_element = list()
/**
* An assoc list of list instances and their sorted counterparts.
*
* e.g. list(
* list(B, A, C) = list(A, B, C),
* list(C, B) = list(B, C),
* )
*
* Used to make sure each list instance is sorted no more than once, or the unit test won't work.
*/
var/list/sorted_arguments_that_are_lists = list()
/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments)
/datum/controller/subsystem/processing/dcs/Recover()
_listen_lookup = SSdcs._listen_lookup
/datum/controller/subsystem/processing/dcs/proc/GetElement(list/arguments, init_element = TRUE)
var/datum/element/eletype = arguments[1]
var/element_id = eletype
@@ -16,10 +40,10 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
CRASH("Attempted to instantiate [eletype] as a /datum/element")
if(initial(eletype.element_flags) & ELEMENT_BESPOKE)
element_id = GetIdFromArguments(arguments)
element_id = length(arguments) == 1 ? "[arguments[1]]" : GetIdFromArguments(arguments)
. = elements_by_type[element_id]
if(.)
if(. || !init_element)
return
. = elements_by_type[element_id] = new eletype
@@ -31,24 +55,55 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
**/
/datum/controller/subsystem/processing/dcs/proc/GetIdFromArguments(list/arguments)
var/datum/element/eletype = arguments[1]
var/list/fullid = list("[eletype]")
var/list/named_arguments = list()
for(var/i in initial(eletype.id_arg_index) to length(arguments))
var/list/fullid = list(eletype)
var/list/named_arguments
for(var/i in initial(eletype.argument_hash_start_idx) to length(arguments))
var/key = arguments[i]
var/value
if(istext(key))
value = arguments[key]
if(!(istext(key) || isnum(key)))
key = REF(key)
key = "[key]" // Key is stringified so numbers dont break things
if(!isnull(value))
if(!(istext(value) || isnum(value)))
value = REF(value)
named_arguments["[key]"] = value
else
fullid += "[key]"
if(length(named_arguments))
named_arguments = sortList(named_arguments)
if(istext(key))
var/value = arguments[key]
if (isnull(value))
fullid += key
else
if (!istext(value) && !isnum(value))
//if(PERFORM_ALL_TESTS(dcs_check_list_arguments) && islist(value)) // Unit test stuff we dont have
//add_to_arguments_that_are_lists(value, eletype) // Unit test stuff we dont have
value = REF(value)
if (!named_arguments)
named_arguments = list()
named_arguments[key] = value
continue
if (isnum(key))
fullid += key
else
//if(PERFORM_ALL_TESTS(dcs_check_list_arguments) && islist(key)) // Unit test stuff we dont have
//add_to_arguments_that_are_lists(key, eletype) // Unit test stuff we dont have
fullid += REF(key)
if(named_arguments)
named_arguments = sortTim(named_arguments, GLOBAL_PROC_REF(cmp_text_asc))
fullid += named_arguments
return list2params(fullid)
/**
* Offloading the first half of the dcs_check_list_arguments here, which is populating the superlist
* with sublists that will be later compared with each other by the dcs_check_list_arguments unit test.
*/
/datum/controller/subsystem/processing/dcs/proc/add_to_arguments_that_are_lists(list/argument, datum/element/element_type)
if(initial(element_type.element_flags) & ELEMENT_NO_LIST_UNIT_TEST)
return
var/list/element_type_superlist = arguments_that_are_lists_by_element[element_type]
if(!element_type_superlist)
arguments_that_are_lists_by_element[element_type] = element_type_superlist = list()
var/list/sorted_argument = argument
if(!(initial(element_type.element_flags) & ELEMENT_DONT_SORT_LIST_ARGS))
sorted_argument = sorted_arguments_that_are_lists[argument]
if(!sorted_argument)
sorted_arguments_that_are_lists[argument] = sorted_argument = sortTim(argument.Copy(), GLOBAL_PROC_REF(cmp_embed_text_asc))
element_type_superlist[sorted_argument] = argument
+8 -8
View File
@@ -171,9 +171,9 @@ SUBSYSTEM_DEF(tgui)
*/
/datum/controller/subsystem/tgui/proc/get_open_ui(mob/user, datum/src_object)
// No UIs opened for this src_object
if(!LAZYLEN(src_object?.open_uis))
if(!LAZYLEN(src_object?.open_tguis))
return null
for(var/datum/tgui/ui in src_object.open_uis)
for(var/datum/tgui/ui in src_object.open_tguis)
// Make sure we have the right user
if(ui.user == user)
return ui
@@ -190,10 +190,10 @@ SUBSYSTEM_DEF(tgui)
*/
/datum/controller/subsystem/tgui/proc/update_uis(datum/src_object)
// No UIs opened for this src_object
if(!LAZYLEN(src_object?.open_uis))
if(!LAZYLEN(src_object?.open_tguis))
return 0
var/count = 0
for(var/datum/tgui/ui in src_object.open_uis)
for(var/datum/tgui/ui in src_object.open_tguis)
// Check if UI is valid.
if(ui?.src_object && ui.user && ui.src_object.tgui_host(ui.user))
INVOKE_ASYNC(ui, TYPE_PROC_REF(/datum/tgui, process), wait * 0.1, TRUE)
@@ -211,10 +211,10 @@ SUBSYSTEM_DEF(tgui)
*/
/datum/controller/subsystem/tgui/proc/close_uis(datum/src_object)
// No UIs opened for this src_object
if(!LAZYLEN(src_object?.open_uis))
if(!LAZYLEN(src_object?.open_tguis))
return 0
var/count = 0
for(var/datum/tgui/ui in src_object.open_uis)
for(var/datum/tgui/ui in src_object.open_tguis)
// Check if UI is valid.
if(ui?.src_object && ui.user && ui.src_object.tgui_host(ui.user))
ui.close()
@@ -286,7 +286,7 @@ SUBSYSTEM_DEF(tgui)
*/
/datum/controller/subsystem/tgui/proc/on_open(datum/tgui/ui)
ui.user?.tgui_open_uis |= ui
LAZYOR(ui.src_object.open_uis, ui)
LAZYOR(ui.src_object.open_tguis, ui)
all_uis |= ui
/**
@@ -306,7 +306,7 @@ SUBSYSTEM_DEF(tgui)
if(ui.user)
ui.user.tgui_open_uis -= ui
if(ui.src_object)
LAZYREMOVE(ui.src_object.open_uis, ui)
LAZYREMOVE(ui.src_object.open_tguis, ui)
return TRUE
/**