Files
Bubberstation/code/modules/wiremod/components/variables/setter.dm
SkyratBot 30e071673f [MIRROR] Refactors the list datatype to support composite lists. Adapts a lot of circuits to be able to properly use composite lists. Adds the dispenser shell [MDB IGNORE] (#8650)
* Refactors the list datatype to support composite lists. Adapts a lot of circuits to be able to properly use composite lists. Adds the dispenser shell (#61856)

Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
Co-authored-by: Colovorat <35225170+Colovorat@ users.noreply.github.com>

* Refactors the list datatype to support composite lists. Adapts a lot of circuits to be able to properly use composite lists. Adds the dispenser shell

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
Co-authored-by: Colovorat <35225170+Colovorat@ users.noreply.github.com>
2021-10-08 14:19:46 +01:00

31 lines
900 B
Plaintext

/**
* # Setter Component
*
* Stores the current input when triggered into a variable.
*/
/obj/item/circuit_component/variable/setter
display_name = "Variable Setter"
desc = "A component that sets a variable globally on the circuit."
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
/// The input to store
var/datum/port/input/input_port
circuit_size = 0
/obj/item/circuit_component/variable/setter/populate_ports()
input_port = add_input_port("Input", PORT_TYPE_ANY)
trigger_input = add_input_port("Store", PORT_TYPE_SIGNAL)
/obj/item/circuit_component/variable/setter/pre_input_received(datum/port/input/port)
. = ..()
if(port == variable_name)
input_port.set_datatype(current_variable.datatype)
/obj/item/circuit_component/variable/setter/input_received(datum/port/input/port)
if(!current_variable)
return
current_variable.set_value(input_port.value)