Merge pull request #5611 from Citadel-Station-13/upstream-merge-35507

[MIRROR] [READY]NTnet circuit fix
This commit is contained in:
deathride58
2018-02-20 15:25:59 +00:00
committed by GitHub

View File

@@ -592,11 +592,12 @@
desc = "Enables the sending and receiving of messages on NTNet via packet data protocol."
extended_desc = "Data can be send or received using the second pin on each side, \
with additonal data reserved for the third pin. When a message is received, the second activation pin \
will pulse whatever's connected to it. Pulsing the first activation pin will send a message."
will pulse whatever's connected to it. Pulsing the first activation pin will send a message. Message \
can be send to multiple recepients. Addresses must be separated with ; symbol."
icon_state = "signal"
complexity = 4
inputs = list(
"target NTNet address" = IC_PINTYPE_STRING,
"target NTNet addresses"= IC_PINTYPE_STRING,
"data to send" = IC_PINTYPE_STRING,
"secondary text" = IC_PINTYPE_STRING,
"passkey" = IC_PINTYPE_STRING, //No this isn't a real passkey encryption scheme but that's why you keep your nodes secure so no one can find it out!
@@ -605,18 +606,20 @@
"address received" = IC_PINTYPE_STRING,
"data received" = IC_PINTYPE_STRING,
"secondary text received" = IC_PINTYPE_STRING,
"passkey" = IC_PINTYPE_STRING
"passkey" = IC_PINTYPE_STRING
)
activators = list("send data" = IC_PINTYPE_PULSE_IN, "on data received" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
action_flags = IC_ACTION_LONG_RANGE
power_draw_per_use = 50
var/datum/ntnet_connection/exonet = null
var/address
/obj/item/integrated_circuit/input/ntnet_packet/Initialize()
. = ..()
var/datum/component/ntnet_interface/net = LoadComponent(/datum/component/ntnet_interface)
desc += "<br>This circuit's NTNet hardware address is: [net.hardware_id]"
address = net.hardware_id
desc += "<br>This circuit's NTNet hardware address is: [address]"
/obj/item/integrated_circuit/input/ntnet_packet/do_work()
var/target_address = get_pin_data(IC_INPUT, 1)
@@ -625,14 +628,15 @@
var/key = get_pin_data(IC_INPUT, 4)
var/datum/netdata/data = new
data.recipient_ids += target_address
data.recipient_ids = splittext(target_address, ";")
data.sender_id = address
data.plaintext_data = message
data.plaintext_data_secondary = text
data.plaintext_passkey = key
ntnet_send(data)
/obj/item/integrated_circuit/input/ntnet_recieve(datum/netdata/data)
set_pin_data(IC_OUTPUT, 1, length(data.recipient_ids) >= 1? data.recipient_ids[1] : null)
set_pin_data(IC_OUTPUT, 1, data.sender_id)
set_pin_data(IC_OUTPUT, 2, data.plaintext_data)
set_pin_data(IC_OUTPUT, 3, data.plaintext_data_secondary)
set_pin_data(IC_OUTPUT, 4, data.plaintext_passkey)