[MIRROR] Adds a Datum port type for Admin Circuits (#8333)

* Adds a Datum port type for Admin Circuits (#61582)

Admin circuit components were limited in their utility due to the setvar, getvar, proccall, and signal handler components only being able to operate on atoms. I have improved them by adding the datum datatype, which is used exclusively by the aforementioned components in place of the atom datatype their target port currently uses. Furthermore, an option for the expected output type has been added to the getvar and proccall components. This option defaults to any.

* Adds a Datum port type for Admin Circuits

Co-authored-by: Y0SH1M4S73R <legoboyo@earthlink.net>
This commit is contained in:
SkyratBot
2021-09-23 02:47:25 +02:00
committed by GitHub
parent b7c7b6654a
commit 03e4ccf68e
8 changed files with 47 additions and 6 deletions
@@ -14,6 +14,9 @@
var/datum/port/input/option/proccall_options
/// Expected type of output
var/datum/port/input/option/expected_output_type
/// Entity to proccall on
var/datum/port/input/entity
@@ -34,13 +37,20 @@
proccall_options = add_option_port("Proccall Options", component_options)
expected_output_type = add_option_port("Expected Output Type", GLOB.wiremod_fundamental_types)
/obj/item/circuit_component/proccall/populate_ports()
entity = add_input_port("Target", PORT_TYPE_ATOM)
entity = add_input_port("Target", PORT_TYPE_DATUM)
proc_name = add_input_port("Proc Name", PORT_TYPE_STRING)
arguments = add_input_port("Arguments", PORT_TYPE_LIST)
output_value = add_output_port("Output Value", PORT_TYPE_ANY)
/obj/item/circuit_component/proccall/pre_input_received(datum/port/input/port)
if(port == expected_output_type)
if(output_value.datatype != expected_output_type.value)
output_value.set_datatype(expected_output_type.value)
/obj/item/circuit_component/proccall/input_received(datum/port/input/port)
var/called_on
if(proccall_options.value == COMP_PROC_OBJECT)