mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-04 22:11:27 +00:00
* Adds USB to arrest consoles. Adds list circuit components. (#59850) Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com> * Adds USB to arrest consoles. Adds list circuit components. Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> Co-authored-by: Mothblocks <35135081+Mothblocks@ users.noreply.github.com>
55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
/**
|
|
* # Concat List Component
|
|
*
|
|
* Concatenates a list with a separator
|
|
*/
|
|
/obj/item/circuit_component/concat_list
|
|
display_name = "Concatenate List"
|
|
display_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/Destroy()
|
|
list_port = null
|
|
separator = null
|
|
output = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/concat_list/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/seperator = separator.input_value
|
|
if(!seperator)
|
|
return
|
|
|
|
var/list/list_input = list_port.input_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))
|
|
|