Files
Bubberstation/code/modules/wiremod/components/list/concat.dm
SkyratBot 9e74cd4a03 [MIRROR] Input ports now connect to multiple output ports. Remove combiner. (#7505)
* 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>
2021-08-11 20:27:29 +01:00

49 lines
1.1 KiB
Plaintext

/**
* # Concat List Component
*
* Concatenates a list with a separator
*/
/obj/item/circuit_component/concat_list
display_name = "Concatenate List"
desc = "A component that joins up a list with a separator into a single string."
/// The input port
var/datum/port/input/list_port
/// The seperator
var/datum/port/input/separator
/// The result from the output
var/datum/port/output/output
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
/obj/item/circuit_component/concat_list/Initialize()
. = ..()
list_port = add_input_port("List", PORT_TYPE_LIST)
separator = add_input_port("Seperator", PORT_TYPE_STRING)
output = add_output_port("Output", PORT_TYPE_STRING)
/obj/item/circuit_component/concat_list/input_received(datum/port/input/port)
. = ..()
if(.)
return
var/seperator = separator.value
if(!seperator)
return
var/list/list_input = list_port.value
if(!list_input)
return
var/list/text_list = list()
for(var/entry in list_input)
if(isatom(entry))
text_list += PORT_TYPE_ATOM
else
text_list += "[entry]"
output.set_output(text_list.Join(seperator))