diff --git a/code/__DEFINES/modular_computer.dm b/code/__DEFINES/modular_computer.dm index 4afb811809f..db1460c2b0f 100644 --- a/code/__DEFINES/modular_computer.dm +++ b/code/__DEFINES/modular_computer.dm @@ -1,12 +1,4 @@ //NTNet stuff, for modular computers -// NTNet module-configuration values. Do not change these. If you need to add another use larger number (5..6..7 etc) -#define NTNET_SOFTWAREDOWNLOAD 1 // Downloads of software from NTNet -#define NTNET_COMMUNICATION 2 // Communication (messaging) - -//NTNet transfer speeds, used when downloading/uploading a file/program. -#define NTNETSPEED_LOWSIGNAL 0.5 // GQ/s transfer speed when the device is wirelessly connected and on Low signal -#define NTNETSPEED_HIGHSIGNAL 1 // GQ/s transfer speed when the device is wirelessly connected and on High signal -#define NTNETSPEED_ETHERNET 2 // GQ/s transfer speed when the device is using wired connection //Caps for NTNet logging. Less than 10 would make logging useless anyway, more than 500 may make the log browser too laggy. Defaults to 100 unless user changes it. #define MAX_NTNET_LOGS 300 @@ -31,6 +23,11 @@ #define DETOMATIX_RESIST_MINOR 1 #define DETOMATIX_RESIST_MAJOR 2 +//NTNet transfer speeds, used when downloading/uploading a file/program. +#define NTNETSPEED_LOWSIGNAL 0.5 // GQ/s transfer speed when the device is wirelessly connected and on Low signal +#define NTNETSPEED_HIGHSIGNAL 1 // GQ/s transfer speed when the device is wirelessly connected and on High signal +#define NTNETSPEED_ETHERNET 2 // GQ/s transfer speed when the device is using wired connection + // NTNet connection signals ///When you're away from the station/mining base and not on a console, you can't access the internet #define NTNET_NO_SIGNAL 0 diff --git a/code/__DEFINES/networks.dm b/code/__DEFINES/networks.dm index f76a3e252f1..f37337819c8 100644 --- a/code/__DEFINES/networks.dm +++ b/code/__DEFINES/networks.dm @@ -14,35 +14,21 @@ #define NETWORK_NAME_COMBINE(L,R) ((L) + "." + (R)) /// Station network names. Used as the root networks for main parts of the station -#define __STATION_NETWORK_ROOT "SS13" -#define __CENTCOM_NETWORK_ROOT "CENTCOM" -#define __SYNDICATE_NETWORK_ROOT "SYNDI" -#define __LIMBO_NETWORK_ROOT "LIMBO" // Limbo is a dead network +#define HOLODECK_NETWORK_ROOT "HOLODECK" +#define STATION_NETWORK_ROOT "SS13" +#define CENTCOM_NETWORK_ROOT "CENTCOM" +#define SYNDICATE_NETWORK_ROOT "SYNDI" +#define LIMBO_NETWORK_ROOT "LIMBO" // Limbo is a dead network + /// various sub networks pieces -#define __NETWORK_LIMBO "LIMBO" -#define __NETWORK_TOOLS "TOOLS" -#define __NETWORK_CONTROL "CONTROL" -#define __NETWORK_STORAGE "STORAGE" #define __NETWORK_CARGO "CARGO" #define __NETWORK_BOTS "BOTS" -#define __NETWORK_COMPUTER "COMPUTER" -#define __NETWORK_TABLETS "TABLETS" #define __NETWORK_CIRCUITS "CIRCUITS" /// Various combined subnetworks -#define NETWORK_TABLETS NETWORK_NAME_COMBINE(__NETWORK_COMPUTER, __NETWORK_TABLETS) #define NETWORK_BOTS_CARGO NETWORK_NAME_COMBINE(__NETWORK_CARGO, __NETWORK_BOTS) - -// Finally turn eveything into strings -#define STATION_NETWORK_ROOT __STATION_NETWORK_ROOT -#define CENTCOM_NETWORK_ROOT __CENTCOM_NETWORK_ROOT -#define SYNDICATE_NETWORK_ROOT __SYNDICATE_NETWORK_ROOT -#define LIMBO_NETWORK_ROOT __LIMBO_NETWORK_ROOT - - - /// Network name should be all caps and no punctuation except for _ and . between domains /// This does a quick an dirty fix to a network name to make sure it works /proc/simple_network_name_fix(name) diff --git a/code/controllers/subsystem/modular_computers.dm b/code/controllers/subsystem/modular_computers.dm index 5998ba5db21..c6e1a9a111f 100644 --- a/code/controllers/subsystem/modular_computers.dm +++ b/code/controllers/subsystem/modular_computers.dm @@ -9,11 +9,6 @@ SUBSYSTEM_DEF(modular_computers) ///List of all chat channels created by Chat Client. var/list/chat_channels = list() - ///Boolean on whether downloading software works. - var/setting_softwaredownload = TRUE - ///Boolean on whether downloading communication apps like the Chat client works. - var/setting_communication = TRUE - ///Boolean on whether the IDS warning system is enabled var/intrusion_detection_enabled = TRUE ///Boolean to show a message warning if there's an active intrusion for Wirecarp users. @@ -48,34 +43,6 @@ SUBSYSTEM_DEF(modular_computers) return TRUE return FALSE -/datum/controller/subsystem/modular_computers/proc/toggle_function(function) - if(!function) - return - function = text2num(function) - switch(function) - if(NTNET_SOFTWAREDOWNLOAD) - setting_softwaredownload = !setting_softwaredownload - SSnetworks.add_log("Configuration Updated. Wireless network firewall now [setting_softwaredownload ? "allows" : "disallows"] connection to software repositories.") - if(NTNET_COMMUNICATION) - setting_communication = !setting_communication - SSnetworks.add_log("Configuration Updated. Wireless network firewall now [setting_communication ? "allows" : "disallows"] instant messaging and similar communication services.") - -///Checks whether NTNet is available for a specific function, checking NTNet relays and shutdowns. If none is passed, none is needed. -/datum/controller/subsystem/modular_computers/proc/check_function(specific_action = NONE) - // No relays found. NTNet is down - if(!length(ntnet_relays)) - return FALSE - // Check all relays. If we have at least one working relay, network is up. - if(!check_relay_operation()) - return FALSE - - switch(specific_action) - if(NTNET_SOFTWAREDOWNLOAD) - return setting_softwaredownload - if(NTNET_COMMUNICATION) - return setting_communication - return TRUE - ///Attempts to find a new file through searching the available stores with its name. /datum/controller/subsystem/modular_computers/proc/find_ntnet_file_by_name(filename) for(var/datum/computer_file/program/programs as anything in available_station_software + available_antag_software) diff --git a/code/controllers/subsystem/processing/networks.dm b/code/controllers/subsystem/processing/networks.dm index 10226564edb..279e7994c0f 100644 --- a/code/controllers/subsystem/processing/networks.dm +++ b/code/controllers/subsystem/processing/networks.dm @@ -272,9 +272,11 @@ SUBSYSTEM_DEF(networks) // Anything in Centcom is completely isolated // Special case for holodecks. if(istype(A,/area/station/holodeck)) - A.network_root_id = "HOLODECK" // isolated from the station network + A.network_root_id = HOLODECK_NETWORK_ROOT // isolated from the station network else if(SSmapping.level_trait(A.z, ZTRAIT_CENTCOM)) A.network_root_id = CENTCOM_NETWORK_ROOT + else if(SSmapping.level_trait(A.z, ZTRAIT_RESERVED)) + A.network_root_id = SYNDICATE_NETWORK_ROOT // Otherwise the default is the station else A.network_root_id = STATION_NETWORK_ROOT diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index 7669288a514..6669129a307 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -34,7 +34,6 @@ else if(!dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //Turned on set_is_operational(TRUE) - ///Proc called to change the value of the `dos_failure` variable and append behavior related to its change. /obj/machinery/ntnet_relay/proc/set_dos_failure(new_value) if(new_value == dos_failure) @@ -47,7 +46,6 @@ else //Failure started set_is_operational(FALSE) - /obj/machinery/ntnet_relay/on_set_machine_stat(old_value) if(old_value & (NOPOWER|BROKEN|MAINT)) if(relay_enabled && !dos_failure && !(machine_stat & (NOPOWER|BROKEN|MAINT))) //From off to on. @@ -55,7 +53,6 @@ else if(machine_stat & (NOPOWER|BROKEN|MAINT)) //From on to off. set_is_operational(FALSE) - /obj/machinery/ntnet_relay/update_icon_state() icon_state = "bus[is_operational ? null : "_off"]" return ..() diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index c8557519682..952271d1550 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -135,7 +135,6 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar update_appearance() register_context() - init_network_id(NETWORK_TABLETS) Add_Messenger() install_default_programs() @@ -468,7 +467,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar shutdown_computer() return - if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature)) + if(active_program && active_program.requires_ntnet && !get_ntnet_status()) active_program.event_networkfailure(FALSE) // Active program requires NTNet to run but we've just lost connection. Crash. for(var/datum/computer_file/program/idle_programs as anything in idle_threads) @@ -476,7 +475,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar idle_threads.Remove(idle_programs) continue idle_programs.process_tick(delta_time) - idle_programs.ntnet_status = get_ntnet_status(idle_programs.requires_ntnet_feature) + idle_programs.ntnet_status = get_ntnet_status() if(idle_programs.requires_ntnet && !idle_programs.ntnet_status) idle_programs.event_networkfailure(TRUE) @@ -607,7 +606,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar to_chat(user, span_danger("\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error.")) return FALSE - if(program.requires_ntnet && !get_ntnet_status(program.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet. + if(program.requires_ntnet && !get_ntnet_status()) // The program requires NTNet connection, but we are not connected to NTNet. to_chat(user, span_danger("\The [src]'s screen shows \"Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning.")) return FALSE @@ -621,9 +620,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar return TRUE // Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on) -/obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0) +/obj/item/modular_computer/proc/get_ntnet_status() // NTNet is down and we are not connected via wired connection. No signal. - if(!SSmodular_computers.check_function(specific_action)) + if(!SSmodular_computers.check_relay_operation()) return NTNET_NO_SIGNAL // computers are connected through ethernet @@ -647,7 +646,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar if(!get_ntnet_status()) return FALSE - return SSnetworks.add_log(text, network_id) + return SSnetworks.add_log("[src]: [text]", network_id) /obj/item/modular_computer/proc/shutdown_computer(loud = 1) kill_program(forced = TRUE) diff --git a/code/modules/modular_computers/computers/item/pda.dm b/code/modules/modular_computers/computers/item/pda.dm index c80f04154ba..3d952731372 100644 --- a/code/modules/modular_computers/computers/item/pda.dm +++ b/code/modules/modular_computers/computers/item/pda.dm @@ -322,7 +322,7 @@ return ..() return FALSE -/obj/item/modular_computer/pda/silicon/get_ntnet_status(specific_action = 0) +/obj/item/modular_computer/pda/silicon/get_ntnet_status() //No borg found if(!silicon_owner) return FALSE diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index 44b35ff1975..b952e4e1f1c 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -21,8 +21,6 @@ var/header_program = FALSE /// Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes. var/requires_ntnet = FALSE - /// Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD and NTNET_COMMUNICATION) - var/requires_ntnet_feature = 0 /// NTNet status, updated every tick by computer running this program. Don't use this for checks if NTNet works, computers do that. Use this for calculations, etc. var/ntnet_status = 1 /// Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL @@ -52,7 +50,6 @@ temp.filedesc = filedesc temp.program_icon_state = program_icon_state temp.requires_ntnet = requires_ntnet - temp.requires_ntnet_feature = requires_ntnet_feature temp.usage_flags = usage_flags return temp @@ -61,11 +58,11 @@ if(computer) computer.update_appearance() -// Attempts to create a log in global ntnet datum. Returns 1 on success, 0 on fail. +///Attempts to generate an Ntnet log, returns the log on success, FALSE otherwise. /datum/computer_file/program/proc/generate_network_log(text) if(computer) return computer.add_log(text) - return 0 + return FALSE /** *Runs when the device is used to attack an atom in non-combat mode using right click (secondary). @@ -153,10 +150,10 @@ **/ /datum/computer_file/program/proc/on_start(mob/living/user) SHOULD_CALL_PARENT(TRUE) - if(can_run(user, 1)) + if(can_run(user, loud = TRUE)) if(requires_ntnet) var/obj/item/card/id/ID = computer.computer_id_slot?.GetID() - generate_network_log("Connection opened -- Program ID: [filename] User:[ID?"[ID.registered_name]":"None"]") + generate_network_log("Connection opened -- Program ID:[filename] User:[ID?"[ID.registered_name]":"None"]") program_state = PROGRAM_STATE_ACTIVE return TRUE return FALSE diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index dce6dd5dd91..48b0fd5ef13 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -6,7 +6,6 @@ undeletable = TRUE size = 4 requires_ntnet = TRUE - requires_ntnet_feature = NTNET_SOFTWAREDOWNLOAD available_on_ntnet = FALSE ui_header = "downloader_finished.gif" tgui_id = "NtosNetDownloader" diff --git a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm index 4ae73086712..095b89f6d06 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -12,7 +12,6 @@ extended_desc = "This program allows communication over NTNRC network" size = 8 requires_ntnet = TRUE - requires_ntnet_feature = NTNET_COMMUNICATION ui_header = "ntnrc_idle.gif" available_on_ntnet = TRUE tgui_id = "NtosNetChat" diff --git a/code/modules/modular_computers/file_system/programs/wirecarp.dm b/code/modules/modular_computers/file_system/programs/wirecarp.dm index f12b8949673..3d107405f10 100644 --- a/code/modules/modular_computers/file_system/programs/wirecarp.dm +++ b/code/modules/modular_computers/file_system/programs/wirecarp.dm @@ -22,6 +22,12 @@ if("toggleIDS") SSmodular_computers.intrusion_detection_enabled = !SSmodular_computers.intrusion_detection_enabled return TRUE + if("toggle_relay") + var/obj/machinery/ntnet_relay/target_relay = locate(params["ref"]) in SSmodular_computers.ntnet_relays + if(!istype(target_relay)) + return + target_relay.set_relay_enabled(!target_relay.relay_enabled) + return TRUE if("purgelogs") SSnetworks.purge_logs() return TRUE @@ -29,24 +35,25 @@ var/logcount = params["new_number"] SSnetworks.update_max_log_count(logcount) return TRUE - if("toggle_function") - SSmodular_computers.toggle_function(text2num(params["id"])) - return TRUE if("toggle_mass_pda") var/obj/item/modular_computer/target_tablet = locate(params["ref"]) in GLOB.TabletMessengers if(!istype(target_tablet)) return for(var/datum/computer_file/program/messenger/messenger_app in target_tablet.stored_files) messenger_app.spam_mode = !messenger_app.spam_mode + return TRUE /datum/computer_file/program/ntnetmonitor/ui_data(mob/user) var/list/data = list() - data["ntnetstatus"] = SSmodular_computers.check_function() - data["ntnetrelays"] = SSmodular_computers.ntnet_relays.len + data["ntnetrelays"] = list() + for(var/obj/machinery/ntnet_relay/relays as anything in SSmodular_computers.ntnet_relays) + var/list/relay_data = list() + relay_data["is_operational"] = !!relays.is_operational + relay_data["name"] = relays.name + relay_data["ref"] = REF(relays) - data["config_softwaredownload"] = SSmodular_computers.setting_softwaredownload - data["config_communication"] = SSmodular_computers.setting_communication + data["ntnetrelays"] += list(relay_data) data["idsstatus"] = SSmodular_computers.intrusion_detection_enabled data["idsalarm"] = SSmodular_computers.intrusion_detection_alarm diff --git a/code/modules/unit_tests/ntnetwork_tests.dm b/code/modules/unit_tests/ntnetwork_tests.dm index 865904af765..21e3925f685 100644 --- a/code/modules/unit_tests/ntnetwork_tests.dm +++ b/code/modules/unit_tests/ntnetwork_tests.dm @@ -1,17 +1,20 @@ /datum/unit_test/ntnetwork - var/list/valid_network_names = list( + var/number_of_names_to_test = 50 + var/length_of_test_network = 5 + + var/static/list/valid_network_names = list( "SS13.ATMOS.SCRUBBERS.SM", "DEEPSPACE.HYDRO.PLANT", "SINDIE.STINKS.BUTT", ) - var/list/invalid_network_names = list( + var/static/list/invalid_network_names = list( ".SS13.BOB", "SS13.OHMAN.", "SS13.HAS A SPACE", ) - var/list/valid_network_trees = list( + var/static/list/valid_network_trees = list( list( "SS13", "ATMOS", @@ -30,26 +33,19 @@ ), ) - var/list/network_roots = list( - __STATION_NETWORK_ROOT, - __CENTCOM_NETWORK_ROOT, - __SYNDICATE_NETWORK_ROOT, - __LIMBO_NETWORK_ROOT, + var/static/list/network_roots = list( + HOLODECK_NETWORK_ROOT, + STATION_NETWORK_ROOT, + CENTCOM_NETWORK_ROOT, + SYNDICATE_NETWORK_ROOT, + LIMBO_NETWORK_ROOT, ) - var/list/random_words_for_testing = list( - __NETWORK_TOOLS, - __NETWORK_CONTROL, - __NETWORK_STORAGE, + var/static/list/random_words_for_testing = list( __NETWORK_CARGO, __NETWORK_BOTS, - __NETWORK_COMPUTER, - __NETWORK_TABLETS, ) - var/number_of_names_to_test = 50 - var/length_of_test_network = 5 - /datum/unit_test/proc/mangle_word(word) var/len = length(word) var/space_pos = round(len/2) diff --git a/tgui/packages/tgui/interfaces/NtosNetMonitor.js b/tgui/packages/tgui/interfaces/NtosNetMonitor.js index 321a6250b86..b8c7b2b5b94 100644 --- a/tgui/packages/tgui/interfaces/NtosNetMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosNetMonitor.js @@ -7,9 +7,6 @@ export const NtosNetMonitor = (props, context) => { const [tab_main, setTab_main] = useSharedState(context, 'tab_main', 1); const { ntnetrelays, - ntnetstatus, - config_softwaredownload, - config_communication, idsalarm, idsstatus, ntnetmaxlogs, @@ -43,9 +40,6 @@ export const NtosNetMonitor = (props, context) => { { const MainPage = (props, context) => { const { ntnetrelays, - ntnetstatus, - config_softwaredownload, - config_communication, idsalarm, idsstatus, ntnetmaxlogs, @@ -86,41 +77,23 @@ const MainPage = (props, context) => { may prevent you from reenabling them!
- {ntnetrelays ? ( - - - {ntnetrelays} - - - ) : ( - 'No Relays Connected' - )} -
-
- - ( +
act('toggle_function', { id: '1' })} + + act('toggle_relay', { + ref: relay.ref, + }) + } /> } /> - act('toggle_function', { id: '2' })} - /> - } - /> - + ))}
{!!idsalarm && ( @@ -171,7 +144,6 @@ const MainPage = (props, context) => {