mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-17 13:12:37 +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.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
/**
|
|
* # Get Variable Component
|
|
*
|
|
* A component that gets a variable on an object
|
|
*/
|
|
/obj/item/circuit_component/get_variable
|
|
display_name = "Get Variable"
|
|
desc = "A component that gets a variable on an object."
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL|CIRCUIT_FLAG_ADMIN
|
|
|
|
/// Entity to get variable of
|
|
var/datum/port/input/entity
|
|
|
|
/// Variable name
|
|
var/datum/port/input/variable_name
|
|
|
|
/// Variable value
|
|
var/datum/port/output/output_value
|
|
|
|
|
|
/obj/item/circuit_component/get_variable/Initialize()
|
|
. = ..()
|
|
entity = add_input_port("Target", PORT_TYPE_ATOM)
|
|
variable_name = add_input_port("Variable Name", PORT_TYPE_STRING)
|
|
|
|
output_value = add_output_port("Output Value", PORT_TYPE_ANY)
|
|
|
|
/obj/item/circuit_component/get_variable/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
var/atom/object = entity.value
|
|
var/var_name = variable_name.value
|
|
if(!var_name || !object)
|
|
output_value.set_output(null)
|
|
return
|
|
|
|
if(!object.can_vv_get(var_name) || !(var_name in object.vars))
|
|
output_value.set_output(null)
|
|
return
|
|
|
|
output_value.set_output(object.vars[var_name])
|