Merge pull request #5611 from Citadel-Station-13/upstream-merge-35507
[MIRROR] [READY]NTnet circuit fix
This commit is contained in:
@@ -592,11 +592,12 @@
|
|||||||
desc = "Enables the sending and receiving of messages on NTNet via packet data protocol."
|
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, \
|
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 \
|
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"
|
icon_state = "signal"
|
||||||
complexity = 4
|
complexity = 4
|
||||||
inputs = list(
|
inputs = list(
|
||||||
"target NTNet address" = IC_PINTYPE_STRING,
|
"target NTNet addresses"= IC_PINTYPE_STRING,
|
||||||
"data to send" = IC_PINTYPE_STRING,
|
"data to send" = IC_PINTYPE_STRING,
|
||||||
"secondary text" = 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!
|
"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,
|
"address received" = IC_PINTYPE_STRING,
|
||||||
"data received" = IC_PINTYPE_STRING,
|
"data received" = IC_PINTYPE_STRING,
|
||||||
"secondary text 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)
|
activators = list("send data" = IC_PINTYPE_PULSE_IN, "on data received" = IC_PINTYPE_PULSE_OUT)
|
||||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||||
action_flags = IC_ACTION_LONG_RANGE
|
action_flags = IC_ACTION_LONG_RANGE
|
||||||
power_draw_per_use = 50
|
power_draw_per_use = 50
|
||||||
var/datum/ntnet_connection/exonet = null
|
var/datum/ntnet_connection/exonet = null
|
||||||
|
var/address
|
||||||
|
|
||||||
/obj/item/integrated_circuit/input/ntnet_packet/Initialize()
|
/obj/item/integrated_circuit/input/ntnet_packet/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
var/datum/component/ntnet_interface/net = LoadComponent(/datum/component/ntnet_interface)
|
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()
|
/obj/item/integrated_circuit/input/ntnet_packet/do_work()
|
||||||
var/target_address = get_pin_data(IC_INPUT, 1)
|
var/target_address = get_pin_data(IC_INPUT, 1)
|
||||||
@@ -625,14 +628,15 @@
|
|||||||
var/key = get_pin_data(IC_INPUT, 4)
|
var/key = get_pin_data(IC_INPUT, 4)
|
||||||
|
|
||||||
var/datum/netdata/data = new
|
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 = message
|
||||||
data.plaintext_data_secondary = text
|
data.plaintext_data_secondary = text
|
||||||
data.plaintext_passkey = key
|
data.plaintext_passkey = key
|
||||||
ntnet_send(data)
|
ntnet_send(data)
|
||||||
|
|
||||||
/obj/item/integrated_circuit/input/ntnet_recieve(datum/netdata/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, 2, data.plaintext_data)
|
||||||
set_pin_data(IC_OUTPUT, 3, data.plaintext_data_secondary)
|
set_pin_data(IC_OUTPUT, 3, data.plaintext_data_secondary)
|
||||||
set_pin_data(IC_OUTPUT, 4, data.plaintext_passkey)
|
set_pin_data(IC_OUTPUT, 4, data.plaintext_passkey)
|
||||||
|
|||||||
Reference in New Issue
Block a user