mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 03:55:11 +01: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>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* # Getter Component
|
||||
*
|
||||
* Gets the current value from a variable.
|
||||
*/
|
||||
/obj/item/circuit_component/variable/getter
|
||||
display_name = "Variable Getter"
|
||||
desc = "A component that gets a variable globally on the circuit."
|
||||
|
||||
/// The value of the variable
|
||||
var/datum/port/output/value
|
||||
|
||||
circuit_size = 0
|
||||
|
||||
/obj/item/circuit_component/variable/getter/populate_ports()
|
||||
value = add_output_port("Value", PORT_TYPE_ANY)
|
||||
|
||||
/obj/item/circuit_component/variable/getter/pre_input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(current_variable)
|
||||
value.set_datatype(current_variable.datatype)
|
||||
value.set_value(current_variable.value)
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* # 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)
|
||||
|
||||
Reference in New Issue
Block a user