fix ntnet circuit components (#60917) (#7633)

* fix ntnet

* fix typos and switcheroos

* whoops, tracked a test circuit json.

Co-authored-by: Gurkenglas <gurkenglas@hotmail.de>
This commit is contained in:
SkyratBot
2021-08-19 17:44:07 +02:00
committed by GitHub
parent a04e7e45ec
commit af632bec7f
8 changed files with 24 additions and 39 deletions

View File

@@ -1,12 +1,12 @@
/**
* # NTNet Reciever Component
* # NTNet Receiver Component
*
* Recieves data through NTNet.
* Receives data through NTNet.
*/
/obj/item/circuit_component/ntnet_receive
display_name = "NTNet Receiver"
desc = "Recieves data packages through NTNet. If Encryption Key is set then only signals with the same Encryption Key will be received."
desc = "Receives data packages through NTNet. If Encryption Key is set then only signals with the same Encryption Key will be received."
circuit_flags = CIRCUIT_FLAG_OUTPUT_SIGNAL //trigger_output
@@ -22,7 +22,6 @@
/obj/item/circuit_component/ntnet_receive/Initialize()
. = ..()
AddComponent(/datum/component/ntnet_interface)
data_package = add_output_port("Data Package", PORT_TYPE_ANY)
secondary_package = add_output_port("Secondary Package", PORT_TYPE_ANY)
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
@@ -50,6 +49,8 @@
if(COMPONENT_TRIGGERED_BY(secondary_data_type_options, port))
secondary_package.set_datatype(secondary_data_type_options.value)
return TRUE
/obj/item/circuit_component/ntnet_receive/proc/ntnet_receive(datum/source, datum/netdata/data)
SIGNAL_HANDLER

View File

@@ -6,7 +6,7 @@
/obj/item/circuit_component/ntnet_send
display_name = "NTNet Transmitter"
desc = "Sends a data package through NTNet when triggered. If target HID is not provided, data will be sent to all circuits in the network. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
desc = "Sends a data package through NTNet. If Encryption Key is set then transmitted data will be only picked up by receivers with the same Encryption Key."
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
@@ -24,14 +24,6 @@
/obj/item/circuit_component/ntnet_send/input_received(datum/port/input/port)
. = ..()
if(. || !data_package.value)
if(.)
return
var/list/datalist = list("data" = data_package.value)
if(secondary_package.value)
datalist["data_secondary"] = secondary_package.value
if(enc_key.value)
datalist["enc_key"] = enc_key.value
var/datum/netdata/data = new(datalist)
data.network_id = __NETWORK_CIRCUITS
ntnet_send(data)
ntnet_send(list("data" = data_package.value, "data_secondary" = secondary_package.value, "enc_key" = enc_key.value))