mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-16 12:43:09 +00:00
* 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>
31 lines
900 B
Plaintext
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)
|
|
|