mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 20:22:07 +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.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
/**
|
|
* # Concatenate Component
|
|
*
|
|
* General string concatenation component. Puts strings together.
|
|
*/
|
|
/obj/item/circuit_component/concat
|
|
display_name = "Concatenate"
|
|
desc = "A component that combines strings."
|
|
|
|
/// The amount of input ports to have
|
|
var/input_port_amount = 4
|
|
|
|
/// 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/Initialize()
|
|
. = ..()
|
|
for(var/port_id in 1 to input_port_amount)
|
|
var/letter = ascii2text(text2ascii("A") + (port_id-1))
|
|
add_input_port(letter, PORT_TYPE_STRING)
|
|
|
|
output = add_output_port("Output", PORT_TYPE_STRING)
|
|
|
|
/obj/item/circuit_component/concat/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
var/result = ""
|
|
var/list/ports = input_ports.Copy()
|
|
ports -= trigger_input
|
|
|
|
for(var/datum/port/input/input_port as anything in ports)
|
|
var/value = input_port.value
|
|
if(isnull(value))
|
|
continue
|
|
|
|
result += "[value]"
|
|
|
|
output.set_output(result)
|
|
|