mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 20:22:07 +00:00
* Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. (#59635) Adds the multiplexer circuit component - en.wikipedia.org/wiki/Multiplexer Circuit components can now be directly inserted into shells rather than having to take the integrated circuit out. Special information can be accessed from components now through the "Info" button besides the eject button on a component. * Added circuit component UI details, added multiplexer and allowed inserting components directly into shells. Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
/**
|
|
* # Concatenate Component
|
|
*
|
|
* General string concatenation component. Puts strings together.
|
|
*/
|
|
/obj/item/circuit_component/concat
|
|
display_name = "Concatenate"
|
|
display_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/Destroy()
|
|
output = null
|
|
return ..()
|
|
|
|
/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.input_value
|
|
if(isnull(value))
|
|
continue
|
|
|
|
result += "[value]"
|
|
|
|
output.set_output(result)
|
|
|