mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 09:01:40 +00:00
* Input ports now connect to multiple output ports. Remove combiner. (#60494) * tgui bsod * debug disconnections * prelim * recomment * set_value -> put ._. * DAMN IT * reinsert subsystem * prepare * unditch signals * remove combiner * remove combiner some more * how did router.dm get here? deleting. * These two COMSIGS should be one. * critical typo * inline cast * have your signals * Have your set_input & set_output. * make compile * upgrade save/load to n-to-n-wires * have your documentation * have your unsafe proc * pay no attention to the compile errors * unlist the ref * paste my for block back in ._. * fix manual input * oops pushed too soon * Have your !port.connected_to?.length Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com> Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com> * Input ports now connect to multiple output ports. Remove combiner. Co-authored-by: Gurkenglas <gurkenglas@hotmail.de> Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>
43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
/**
|
|
* # Index Table Component
|
|
*
|
|
* Gets the row of a table using the index inputted. Will return no value if the index is invalid or a proper table is not returned.
|
|
*/
|
|
/obj/item/circuit_component/index_table
|
|
display_name = "Index Table"
|
|
desc = "Gets the row of a table using the index inputted. Will return no value if the index is invalid or a proper table is not returned."
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
|
|
|
/// The list to perform the filter on
|
|
var/datum/port/input/received_table
|
|
|
|
/// The target index
|
|
var/datum/port/input/target_index
|
|
|
|
/// The filtered list
|
|
var/datum/port/output/output_list
|
|
|
|
/obj/item/circuit_component/index_table/Initialize()
|
|
. = ..()
|
|
received_table = add_input_port("Input", PORT_TYPE_TABLE)
|
|
target_index = add_input_port("Index", PORT_TYPE_NUMBER)
|
|
|
|
output_list = add_output_port("Output", PORT_TYPE_LIST)
|
|
|
|
/obj/item/circuit_component/index_table/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/list/target_list = received_table.value
|
|
if(!islist(target_list) || !length(target_list))
|
|
output_list.set_output(null)
|
|
return
|
|
|
|
var/index = target_index.value
|
|
if(index < 1 || index > length(target_list))
|
|
output_list.set_output(null)
|
|
return
|
|
|
|
output_list.set_output(target_list[index])
|