Files
Bubberstation/code/modules/wiremod/components/ntnet/ntnet_send.dm
SkyratBot b1067980e0 [MIRROR] Fixes ntnet circuits [MDB IGNORE] (#20191)
* Fixes ntnet circuits (#74338)

## About The Pull Request

I underestimated SEND_GLOBAL_SIGNAL and assumed it worked differently to
SEND_SIGNAL, as in I thought it would not be sending the source as the
first arg.
Because it does, it meant that the list of data was actually just ntnet
sending circuit. This fixes it and makes the args work properly.

I've shamelessly stolen the circuit in the screenshot of the issue to
test it in-game

![image](https://user-images.githubusercontent.com/53777086/228451819-4ffdb2e4-542e-46c1-9947-6266d8550f4a.png)

## Why It's Good For The Game

Closes https://github.com/tgstation/tgstation/issues/74327

## Changelog

🆑
fix: NtNet receive/send circuits should work now.
/🆑

* Fixes ntnet circuits

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
2023-03-31 02:59:36 +01:00

39 lines
1.3 KiB
Plaintext

/**
* # NTNet Transmitter Component
*
* Sends a data package through NTNet
*/
/obj/item/circuit_component/ntnet_send
display_name = "NTNet Transmitter"
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."
category = "NTNet"
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL
/// The list type
var/datum/port/input/option/list_options
/// Data being sent
var/datum/port/input/data_package
/// Encryption key
var/datum/port/input/enc_key
/obj/item/circuit_component/ntnet_send/populate_options()
list_options = add_option_port("List Type", GLOB.wiremod_basic_types)
/obj/item/circuit_component/ntnet_send/populate_ports()
data_package = add_input_port("Data Package", PORT_TYPE_LIST(PORT_TYPE_ANY))
enc_key = add_input_port("Encryption Key", PORT_TYPE_STRING)
/obj/item/circuit_component/ntnet_send/pre_input_received(datum/port/input/port)
if(port == list_options)
var/new_datatype = list_options.value
data_package.set_datatype(PORT_TYPE_LIST(new_datatype))
/obj/item/circuit_component/ntnet_send/input_received(datum/port/input/port)
if(!find_functional_ntnet_relay())
return
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CIRCUIT_NTNET_DATA_SENT, list("data" = data_package.value, "enc_key" = enc_key.value, "port" = WEAKREF(data_package)))