Merge pull request #4081 from Citadel-Station-13/upstream-merge-32914
[MIRROR] [READY]NTnet refactor, assimilates exonet
This commit is contained in:
29
code/modules/NTNet/netdata.dm
Normal file
29
code/modules/NTNet/netdata.dm
Normal file
@@ -0,0 +1,29 @@
|
||||
/datum/netdata //this requires some thought later on but for now it's fine.
|
||||
var/network_id
|
||||
|
||||
var/list/recipient_ids = list()
|
||||
var/sender_id
|
||||
|
||||
var/plaintext_data
|
||||
var/plaintext_data_secondary
|
||||
var/plaintext_passkey
|
||||
|
||||
/datum/netdata/proc/json_list_generation_admin() //for admin logs and such.
|
||||
. = list()
|
||||
. |= json_list_generation()
|
||||
|
||||
/datum/netdata/proc/json_list_generation()
|
||||
. = list()
|
||||
. |= json_list_generation_netlog()
|
||||
.["network_id"] = network_id
|
||||
|
||||
/datum/netdata/proc/json_list_generation_netlog()
|
||||
. = list()
|
||||
.["recipient_ids"] = recipient_ids
|
||||
.["sender_id"] = sender_id
|
||||
.["plaintext_data"] = plaintext_data
|
||||
.["plaintext_data_secondary"] = plaintext_data_secondary
|
||||
.["plaintext_passkey"] = plaintext_passkey
|
||||
|
||||
/datum/netdata/proc/generate_netlog()
|
||||
return "[json_encode(json_list_generation_netlog())]"
|
||||
@@ -1,8 +1,7 @@
|
||||
GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
|
||||
|
||||
// This is the NTNet datum. There can be only one NTNet datum in game at once. Modular computers read data from this.
|
||||
/datum/ntnet
|
||||
var/network_id = "Network"
|
||||
var/connected_interfaces_by_id = list() //id = datum/component/ntnet_interface
|
||||
|
||||
var/list/relays = list()
|
||||
var/list/logs = list()
|
||||
var/list/available_station_software = list()
|
||||
@@ -14,25 +13,59 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
var/setting_maxlogcount = 100
|
||||
|
||||
// These only affect wireless. LAN (consoles) are unaffected since it would be possible to create scenario where someone turns off NTNet, and is unable to turn it back on since it refuses connections
|
||||
var/setting_softwaredownload = 1
|
||||
var/setting_peertopeer = 1
|
||||
var/setting_communication = 1
|
||||
var/setting_systemcontrol = 1
|
||||
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software.
|
||||
var/setting_softwaredownload = TRUE
|
||||
var/setting_peertopeer = TRUE
|
||||
var/setting_communication = TRUE
|
||||
var/setting_systemcontrol = TRUE
|
||||
var/setting_disabled = FALSE // Setting to 1 will disable all wireless, independently on relays status.
|
||||
|
||||
var/intrusion_detection_enabled = TRUE // Whether the IDS warning system is enabled
|
||||
var/intrusion_detection_alarm = FALSE // Set when there is an IDS warning due to malicious (antag) software.
|
||||
|
||||
// If new NTNet datum is spawned, it replaces the old one.
|
||||
/datum/ntnet/New()
|
||||
if(GLOB.ntnet_global && (GLOB.ntnet_global != src))
|
||||
GLOB.ntnet_global = src // There can be only one.
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
||||
relays.Add(R)
|
||||
R.NTNet = src
|
||||
/datum/ntnet/New(_netid)
|
||||
build_software_lists()
|
||||
add_log("NTNet logging system activated.")
|
||||
if(_netid)
|
||||
network_id = _netid
|
||||
if(!SSnetworks.register_network(src))
|
||||
stack_trace("Network [type] with ID [network_id] failed to register and has been deleted.")
|
||||
qdel(src)
|
||||
|
||||
/datum/ntnet/proc/interface_connect(datum/component/ntnet_interface/I)
|
||||
connected_interfaces_by_id[I.hardware_id] = I
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/interface_disconnect(datum/component/ntnet_interface/I)
|
||||
connected_interfaces_by_id -= I.hardware_id
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/find_interface_id(id)
|
||||
return connected_interfaces_by_id[id]
|
||||
|
||||
/datum/ntnet/proc/process_data_transmit(datum/component/ntnet_interface/sender, datum/netdata/data)
|
||||
data.network_id = src
|
||||
log_data_transfer(data)
|
||||
if(!check_relay_operation())
|
||||
return FALSE
|
||||
for(var/i in data.recipient_ids)
|
||||
var/datum/component/ntnet_interface/reciever = find_interface_id(i)
|
||||
if(reciever)
|
||||
reciever.__network_recieve(data)
|
||||
return TRUE
|
||||
|
||||
/datum/ntnet/proc/check_relay_operation(zlevel) //can be expanded later but right now it's true/false.
|
||||
for(var/i in relays)
|
||||
var/obj/machinery/ntnet_relay/n = i
|
||||
if(zlevel && n.z != zlevel)
|
||||
continue
|
||||
if(n.is_operational())
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/ntnet/proc/log_data_transfer(datum/netdata/data)
|
||||
logs += "[worldtime2text()] - [data.generate_netlog()]"
|
||||
return
|
||||
|
||||
// Simplified logging: Adds a log. log_string is mandatory parameter, source is optional.
|
||||
/datum/ntnet/proc/add_log(log_string, obj/item/computer_hardware/network_card/source = null)
|
||||
@@ -44,7 +77,6 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
log_text += log_string
|
||||
logs.Add(log_text)
|
||||
|
||||
|
||||
// We have too many logs, remove the oldest entries until we get into the limit
|
||||
if(logs.len > setting_maxlogcount)
|
||||
logs = logs.Copy(logs.len-setting_maxlogcount,0)
|
||||
@@ -55,28 +87,23 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
if(!relays || !relays.len) // No relays found. NTNet is down
|
||||
return FALSE
|
||||
|
||||
var/operating = FALSE
|
||||
|
||||
// Check all relays. If we have at least one working relay, network is up.
|
||||
for(var/M in relays)
|
||||
var/obj/machinery/ntnet_relay/R = M
|
||||
if(R.is_operational())
|
||||
operating = TRUE
|
||||
break
|
||||
if(!check_relay_operation())
|
||||
return FALSE
|
||||
|
||||
if(setting_disabled)
|
||||
return FALSE
|
||||
|
||||
switch(specific_action)
|
||||
if(NTNET_SOFTWAREDOWNLOAD)
|
||||
return (operating && setting_softwaredownload)
|
||||
return setting_softwaredownload
|
||||
if(NTNET_PEERTOPEER)
|
||||
return (operating && setting_peertopeer)
|
||||
return setting_peertopeer
|
||||
if(NTNET_COMMUNICATION)
|
||||
return (operating && setting_communication)
|
||||
return setting_communication
|
||||
if(NTNET_SYSTEMCONTROL)
|
||||
return (operating && setting_systemcontrol)
|
||||
return operating
|
||||
return setting_systemcontrol
|
||||
return TRUE
|
||||
|
||||
// Builds lists that contain downloadable software.
|
||||
/datum/ntnet/proc/build_software_lists()
|
||||
@@ -106,7 +133,7 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
|
||||
// Resets the IDS alarm
|
||||
/datum/ntnet/proc/resetIDS()
|
||||
intrusion_detection_alarm = 0
|
||||
intrusion_detection_alarm = FALSE
|
||||
|
||||
/datum/ntnet/proc/toggleIDS()
|
||||
resetIDS()
|
||||
@@ -143,3 +170,11 @@ GLOBAL_DATUM_INIT(ntnet_global, /datum/ntnet, new)
|
||||
if(NTNET_SYSTEMCONTROL)
|
||||
setting_systemcontrol = !setting_systemcontrol
|
||||
add_log("Configuration Updated. Wireless network firewall now [setting_systemcontrol ? "allows" : "disallows"] remote control of station's systems.")
|
||||
|
||||
/datum/ntnet/station
|
||||
network_id = "SS13-NTNET"
|
||||
|
||||
/datum/ntnet/station/proc/register_map_supremecy() //called at map init to make this what station networks use.
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.machines)
|
||||
relays.Add(R)
|
||||
R.NTNet = src
|
||||
@@ -17,7 +17,6 @@
|
||||
var/uid
|
||||
var/static/gl_uid = 1
|
||||
|
||||
|
||||
// Denial of Service attack variables
|
||||
var/dos_overload = 0 // Amount of DoS "packets" in this relay's buffer
|
||||
var/dos_capacity = 500 // Amount of DoS "packets" in buffer required to crash the relay
|
||||
@@ -27,12 +26,12 @@
|
||||
// TODO: Implement more logic here. For now it's only a placeholder.
|
||||
/obj/machinery/ntnet_relay/is_operational()
|
||||
if(stat & (BROKEN | NOPOWER | EMPED))
|
||||
return 0
|
||||
return FALSE
|
||||
if(dos_failure)
|
||||
return 0
|
||||
return FALSE
|
||||
if(!enabled)
|
||||
return 0
|
||||
return 1
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/ntnet_relay/update_icon()
|
||||
if(is_operational())
|
||||
@@ -55,12 +54,12 @@
|
||||
if((dos_overload > dos_capacity) && !dos_failure)
|
||||
dos_failure = 1
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay switched from normal operation mode to overload recovery mode.")
|
||||
// If the DoS buffer reaches 0 again, restart.
|
||||
if((dos_overload == 0) && dos_failure)
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.")
|
||||
..()
|
||||
|
||||
/obj/machinery/ntnet_relay/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
@@ -89,13 +88,12 @@
|
||||
dos_overload = 0
|
||||
dos_failure = 0
|
||||
update_icon()
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
SSnetworks.station_network.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.")
|
||||
if("toggle")
|
||||
enabled = !enabled
|
||||
GLOB.ntnet_global.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
SSnetworks.station_network.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/ntnet_relay/attack_hand(mob/living/user)
|
||||
ui_interact(user)
|
||||
|
||||
@@ -103,16 +101,16 @@
|
||||
uid = gl_uid++
|
||||
component_parts = list()
|
||||
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Add(src)
|
||||
NTNet = GLOB.ntnet_global
|
||||
GLOB.ntnet_global.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.relays.Add(src)
|
||||
NTNet = SSnetworks.station_network
|
||||
SSnetworks.station_network.add_log("New quantum relay activated. Current amount of linked relays: [NTNet.relays.len]")
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/ntnet_relay/Destroy()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.relays.Remove(src)
|
||||
GLOB.ntnet_global.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.relays.Remove(src)
|
||||
SSnetworks.station_network.add_log("Quantum relay connection severed. Current amount of linked relays: [NTNet.relays.len]")
|
||||
NTNet = null
|
||||
|
||||
for(var/datum/computer_file/program/ntnet_dos/D in dos_sources)
|
||||
@@ -543,55 +543,55 @@
|
||||
for(var/mob/O in hearers(1, get_turf(src)))
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep*", null, 1)
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2
|
||||
name = "EPv2 circuit"
|
||||
desc = "Enables the sending and receiving of messages on the Exonet with the EPv2 protocol."
|
||||
extended_desc = "An EPv2 address is a string with the format of XXXX:XXXX:XXXX:XXXX. Data can be send or received using the \
|
||||
/obj/item/integrated_circuit/input/ntnet_packet
|
||||
name = "NTNet networking circuit"
|
||||
desc = "Enables the sending and receiving of messages on NTNet with 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."
|
||||
icon_state = "signal"
|
||||
complexity = 4
|
||||
inputs = list(
|
||||
"target EPv2 address" = IC_PINTYPE_STRING,
|
||||
"target NTNet address" = 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!
|
||||
)
|
||||
outputs = list(
|
||||
"address 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
|
||||
)
|
||||
activators = list("send data" = IC_PINTYPE_PULSE_IN, "on data received" = IC_PINTYPE_PULSE_OUT)
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2)
|
||||
power_draw_per_use = 50
|
||||
var/datum/exonet_protocol/exonet = null
|
||||
var/datum/ntnet_connection/exonet = null
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/New()
|
||||
..()
|
||||
exonet = new(src)
|
||||
exonet.make_address("EPv2_circuit-[REF(src)]")
|
||||
desc += "<br>This circuit's EPv2 address is: [exonet.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]"
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/Destroy()
|
||||
if(exonet)
|
||||
exonet.remove_address()
|
||||
qdel(exonet)
|
||||
exonet = null
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/do_work()
|
||||
/obj/item/integrated_circuit/input/ntnet_packet/do_work()
|
||||
var/target_address = get_pin_data(IC_INPUT, 1)
|
||||
var/message = get_pin_data(IC_INPUT, 2)
|
||||
var/text = get_pin_data(IC_INPUT, 3)
|
||||
var/key = get_pin_data(IC_INPUT, 4)
|
||||
|
||||
if(target_address && istext(target_address))
|
||||
exonet.send_message(target_address, message, text)
|
||||
var/datum/netdata/data = new
|
||||
data.recipient_ids += target_address
|
||||
data.plaintext_data = message
|
||||
data.plaintext_data_secondary = text
|
||||
data.plaintext_passkey = key
|
||||
ntnet_send(data)
|
||||
|
||||
/obj/item/integrated_circuit/input/receive_exonet_message(var/atom/origin_atom, var/origin_address, var/message, var/text)
|
||||
set_pin_data(IC_OUTPUT, 1, origin_address)
|
||||
set_pin_data(IC_OUTPUT, 2, message)
|
||||
set_pin_data(IC_OUTPUT, 3, text)
|
||||
/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, 2, data.plaintext_data)
|
||||
set_pin_data(IC_OUTPUT, 3, data.plaintext_data_secondary)
|
||||
set_pin_data(IC_OUTPUT, 4, data.plaintext_passkey)
|
||||
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
/datum/ntnet_conversation/New()
|
||||
id = ntnrc_uid++
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.chat_channels.Add(src)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.chat_channels.Add(src)
|
||||
..()
|
||||
|
||||
/datum/ntnet_conversation/Destroy()
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.chat_channels.Remove(src)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.chat_channels.Remove(src)
|
||||
return ..()
|
||||
|
||||
/datum/ntnet_conversation/proc/add_message(message, username)
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
if(!get_ntnet_status())
|
||||
return FALSE
|
||||
var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET]
|
||||
return GLOB.ntnet_global.add_log(text, network_card)
|
||||
return SSnetworks.station_network.add_log(text, network_card)
|
||||
|
||||
/obj/item/device/modular_computer/proc/shutdown_computer(loud = 1)
|
||||
kill_program(forced = TRUE)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
return 1
|
||||
switch(action)
|
||||
if("PRG_target_relay")
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
if("[R.uid]" == params["targid"])
|
||||
target = R
|
||||
return 1
|
||||
@@ -61,14 +61,14 @@
|
||||
if(target)
|
||||
executed = 1
|
||||
target.dos_sources.Add(src)
|
||||
if(GLOB.ntnet_global.intrusion_detection_enabled)
|
||||
if(SSnetworks.station_network.intrusion_detection_enabled)
|
||||
var/obj/item/computer_hardware/network_card/network_card = computer.all_components[MC_NET]
|
||||
GLOB.ntnet_global.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
|
||||
GLOB.ntnet_global.intrusion_detection_alarm = 1
|
||||
SSnetworks.station_network.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
|
||||
SSnetworks.station_network.intrusion_detection_alarm = 1
|
||||
return 1
|
||||
|
||||
/datum/computer_file/program/ntnet_dos/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return
|
||||
|
||||
var/list/data = list()
|
||||
@@ -93,7 +93,7 @@
|
||||
data["dos_strings"] += list(list("nums" = string))
|
||||
else
|
||||
data["relays"] = list()
|
||||
for(var/obj/machinery/ntnet_relay/R in GLOB.ntnet_global.relays)
|
||||
for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays)
|
||||
data["relays"] += list(list("id" = R.uid))
|
||||
data["focus"] = target ? target.uid : null
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
if(downloaded_file)
|
||||
return 0
|
||||
|
||||
var/datum/computer_file/program/PRG = GLOB.ntnet_global.find_ntnet_file_by_name(filename)
|
||||
var/datum/computer_file/program/PRG = SSnetworks.station_network.find_ntnet_file_by_name(filename)
|
||||
|
||||
if(!PRG || !istype(PRG))
|
||||
return 0
|
||||
@@ -39,10 +39,10 @@
|
||||
|
||||
ui_header = "downloader_running.gif"
|
||||
|
||||
if(PRG in GLOB.ntnet_global.available_station_software)
|
||||
if(PRG in SSnetworks.station_network.available_station_software)
|
||||
generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.")
|
||||
hacked_download = 0
|
||||
else if(PRG in GLOB.ntnet_global.available_antag_software)
|
||||
else if(PRG in SSnetworks.station_network.available_antag_software)
|
||||
generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.")
|
||||
hacked_download = 1
|
||||
else
|
||||
@@ -127,7 +127,7 @@
|
||||
data["disk_size"] = hard_drive.max_capacity
|
||||
data["disk_used"] = hard_drive.used_capacity
|
||||
var/list/all_entries[0]
|
||||
for(var/A in GLOB.ntnet_global.available_station_software)
|
||||
for(var/A in SSnetworks.station_network.available_station_software)
|
||||
var/datum/computer_file/program/P = A
|
||||
// Only those programs our user can run will show in the list
|
||||
if(!P.can_run(user,transfer = 1) || hard_drive.find_file_by_name(P.filename))
|
||||
@@ -142,7 +142,7 @@
|
||||
data["hackedavailable"] = 0
|
||||
if(computer.emagged) // If we are running on emagged computer we have access to some "bonus" software
|
||||
var/list/hacked_programs[0]
|
||||
for(var/S in GLOB.ntnet_global.available_antag_software)
|
||||
for(var/S in SSnetworks.station_network.available_antag_software)
|
||||
var/datum/computer_file/program/P = S
|
||||
if(hard_drive.find_file_by_name(P.filename))
|
||||
continue
|
||||
|
||||
@@ -15,22 +15,22 @@
|
||||
switch(action)
|
||||
if("resetIDS")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.resetIDS()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.resetIDS()
|
||||
return 1
|
||||
if("toggleIDS")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.toggleIDS()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.toggleIDS()
|
||||
return 1
|
||||
if("toggleWireless")
|
||||
. = 1
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
|
||||
// NTNet is disabled. Enabling can be done without user prompt
|
||||
if(GLOB.ntnet_global.setting_disabled)
|
||||
GLOB.ntnet_global.setting_disabled = 0
|
||||
if(SSnetworks.station_network.setting_disabled)
|
||||
SSnetworks.station_network.setting_disabled = 0
|
||||
return 1
|
||||
|
||||
// NTNet is enabled and user is about to shut it down. Let's ask them if they really want to do it, as wirelessly connected computers won't connect without NTNet being enabled (which may prevent people from turning it back on)
|
||||
@@ -39,43 +39,43 @@
|
||||
return 1
|
||||
var/response = alert(user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", "Yes", "No")
|
||||
if(response == "Yes")
|
||||
GLOB.ntnet_global.setting_disabled = 1
|
||||
SSnetworks.station_network.setting_disabled = 1
|
||||
return 1
|
||||
if("purgelogs")
|
||||
. = 1
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.purge_logs()
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.purge_logs()
|
||||
if("updatemaxlogs")
|
||||
. = 1
|
||||
var/mob/user = usr
|
||||
var/logcount = text2num(input(user,"Enter amount of logs to keep in memory ([MIN_NTNET_LOGS]-[MAX_NTNET_LOGS]):"))
|
||||
if(GLOB.ntnet_global)
|
||||
GLOB.ntnet_global.update_max_log_count(logcount)
|
||||
if(SSnetworks.station_network)
|
||||
SSnetworks.station_network.update_max_log_count(logcount)
|
||||
if("toggle_function")
|
||||
. = 1
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return 1
|
||||
GLOB.ntnet_global.toggle_function(text2num(params["id"]))
|
||||
SSnetworks.station_network.toggle_function(text2num(params["id"]))
|
||||
|
||||
/datum/computer_file/program/ntnetmonitor/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global)
|
||||
if(!SSnetworks.station_network)
|
||||
return
|
||||
var/list/data = get_header_data()
|
||||
|
||||
data["ntnetstatus"] = GLOB.ntnet_global.check_function()
|
||||
data["ntnetrelays"] = GLOB.ntnet_global.relays.len
|
||||
data["idsstatus"] = GLOB.ntnet_global.intrusion_detection_enabled
|
||||
data["idsalarm"] = GLOB.ntnet_global.intrusion_detection_alarm
|
||||
data["ntnetstatus"] = SSnetworks.station_network.check_function()
|
||||
data["ntnetrelays"] = SSnetworks.station_network.relays.len
|
||||
data["idsstatus"] = SSnetworks.station_network.intrusion_detection_enabled
|
||||
data["idsalarm"] = SSnetworks.station_network.intrusion_detection_alarm
|
||||
|
||||
data["config_softwaredownload"] = GLOB.ntnet_global.setting_softwaredownload
|
||||
data["config_peertopeer"] = GLOB.ntnet_global.setting_peertopeer
|
||||
data["config_communication"] = GLOB.ntnet_global.setting_communication
|
||||
data["config_systemcontrol"] = GLOB.ntnet_global.setting_systemcontrol
|
||||
data["config_softwaredownload"] = SSnetworks.station_network.setting_softwaredownload
|
||||
data["config_peertopeer"] = SSnetworks.station_network.setting_peertopeer
|
||||
data["config_communication"] = SSnetworks.station_network.setting_communication
|
||||
data["config_systemcontrol"] = SSnetworks.station_network.setting_systemcontrol
|
||||
|
||||
data["ntnetlogs"] = list()
|
||||
|
||||
for(var/i in GLOB.ntnet_global.logs)
|
||||
for(var/i in SSnetworks.station_network.logs)
|
||||
data["ntnetlogs"] += list(list("entry" = i))
|
||||
data["ntnetmaxlogs"] = GLOB.ntnet_global.setting_maxlogcount
|
||||
data["ntnetmaxlogs"] = SSnetworks.station_network.setting_maxlogcount
|
||||
|
||||
return data
|
||||
@@ -39,7 +39,7 @@
|
||||
if("PRG_joinchannel")
|
||||
. = 1
|
||||
var/datum/ntnet_conversation/C
|
||||
for(var/datum/ntnet_conversation/chan in GLOB.ntnet_global.chat_channels)
|
||||
for(var/datum/ntnet_conversation/chan in SSnetworks.station_network.chat_channels)
|
||||
if(chan.id == text2num(params["id"]))
|
||||
C = chan
|
||||
break
|
||||
@@ -183,7 +183,7 @@
|
||||
..()
|
||||
|
||||
/datum/computer_file/program/chatclient/ui_data(mob/user)
|
||||
if(!GLOB.ntnet_global || !GLOB.ntnet_global.chat_channels)
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.chat_channels)
|
||||
return
|
||||
|
||||
var/list/data = list()
|
||||
@@ -212,7 +212,7 @@
|
||||
|
||||
else // Channel selection screen
|
||||
var/list/all_channels[0]
|
||||
for(var/C in GLOB.ntnet_global.chat_channels)
|
||||
for(var/C in SSnetworks.station_network.chat_channels)
|
||||
var/datum/ntnet_conversation/conv = C
|
||||
if(conv && conv.title)
|
||||
all_channels.Add(list(list(
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
return 1
|
||||
switch(action)
|
||||
if("PRG_downloadfile")
|
||||
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
|
||||
for(var/datum/computer_file/program/nttransfer/P in SSnetworks.station_network.fileservers)
|
||||
if("[P.unique_token]" == params["id"])
|
||||
remote = P
|
||||
break
|
||||
@@ -106,8 +106,8 @@
|
||||
error = ""
|
||||
upload_menu = 0
|
||||
finalize_download()
|
||||
if(src in GLOB.ntnet_global.fileservers)
|
||||
GLOB.ntnet_global.fileservers.Remove(src)
|
||||
if(src in SSnetworks.station_network.fileservers)
|
||||
SSnetworks.station_network.fileservers.Remove(src)
|
||||
for(var/datum/computer_file/program/nttransfer/T in connected_clients)
|
||||
T.crash_download("Remote server has forcibly closed the connection")
|
||||
provided_file = null
|
||||
@@ -133,7 +133,7 @@
|
||||
if(!P.can_run(usr,transfer = 1))
|
||||
error = "Access Error: Insufficient rights to upload file."
|
||||
provided_file = F
|
||||
GLOB.ntnet_global.fileservers.Add(src)
|
||||
SSnetworks.station_network.fileservers.Add(src)
|
||||
return
|
||||
error = "I/O Error: Unable to locate file on hard drive."
|
||||
return 1
|
||||
@@ -171,7 +171,7 @@
|
||||
data["upload_filelist"] = all_files
|
||||
else
|
||||
var/list/all_servers[0]
|
||||
for(var/datum/computer_file/program/nttransfer/P in GLOB.ntnet_global.fileservers)
|
||||
for(var/datum/computer_file/program/nttransfer/P in SSnetworks.station_network.fileservers)
|
||||
all_servers.Add(list(list(
|
||||
"uid" = P.unique_token,
|
||||
"filename" = "[P.provided_file.filename].[P.provided_file.filetype]",
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
if(ethernet) // Computer is connected via wired connection.
|
||||
return 3
|
||||
|
||||
if(!GLOB.ntnet_global || !GLOB.ntnet_global.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return 0
|
||||
|
||||
if(holder)
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
build_path = /obj/item/circuitboard/machine/telecomms/receiver
|
||||
category = list("Subspace Telecomms")
|
||||
|
||||
/datum/design/board/exonet_node
|
||||
name = "Machine Design (Exonet Node)"
|
||||
desc = "Allows for the construction of Exonet Node."
|
||||
id = "e-node"
|
||||
req_tech = list("programming" = 2, "engineering" = 3, "bluespace" = 1)
|
||||
build_path = /obj/item/circuitboard/machine/exonet_node
|
||||
category = list("Subspace Telecomms")
|
||||
|
||||
/datum/design/board/telecomms_bus
|
||||
name = "Machine Design (Bus Mainframe)"
|
||||
desc = "Allows for the construction of Telecommunications Bus Mainframes."
|
||||
|
||||
Reference in New Issue
Block a user