diff --git a/code/__DEFINES/dcs/signals/signals_ntnet.dm b/code/__DEFINES/dcs/signals/signals_ntnet.dm deleted file mode 100644 index 4989fd46d479..000000000000 --- a/code/__DEFINES/dcs/signals/signals_ntnet.dm +++ /dev/null @@ -1,13 +0,0 @@ -// Format: -// When the signal is called: (signal arguments) -// All signals send the source datum of the signal as the first argument - -//NTnet -#define COMSIG_COMPONENT_NTNET_RECEIVE "ntnet_receive" /// called on an object by its NTNET connection component on receive. (data(datum/netdata)) -#define COMSIG_COMPONENT_NTNET_PORT_UPDATE "ntnet_port_update" /// called on an object by its NTNET connection component on a port update (hardware_id, port)) -#define COMSIG_COMPONENT_NTNET_ACK "ntnet_ack" /// called when packet was accepted by the target (datum/netdata, error_code) -#define COMSIG_COMPONENT_NTNET_NAK "ntnet_nack" /// called when packet was not acknoledged by the target (datum/netdata, error_code) - -// Some internal NTnet signals used on ports -#define COMSIG_COMPONENT_NTNET_PORT_DESTROYED "ntnet_port_destroyed" /// called on an object by its NTNET connection component on a port distruction (port, list/data)) -#define COMSIG_COMPONENT_NTNET_PORT_UPDATED "ntnet_port_updated" /// called on an object by its NTNET connection component on a port distruction (port, list/data)) diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 9d0efd909944..2f9b922c7d5a 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -42,64 +42,6 @@ #define RACK_CREATOR (1<<9) //For AI non-physical AI hardware. (RAM expansions) //Note: More than one of these can be added to a design but imprinter and lathe designs are incompatable. -//Modular computer/NTNet defines - -//Modular computer part defines -#define MC_CPU "CPU" -#define MC_HDD "HDD" -#define MC_SDD "SDD" -#define MC_CARD "CARD" -#define MC_CARD2 "CARD2" -#define MC_NET "NET" -#define MC_PRINT "PRINT" -#define MC_CELL "CELL" -#define MC_CHARGE "CHARGE" -#define MC_AI "AI" -#define MC_SENSORS "SENSORS" -#define MC_AI_NETWORK "AINETWORK" - -//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_PEERTOPEER 2 // P2P transfers of files between devices -#define NTNET_COMMUNICATION 3 // Communication (messaging) -#define NTNET_SYSTEMCONTROL 4 // Control of various systems, RCon, air alarm control, etc. - -//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 3 // 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 -#define MIN_NTNET_LOGS 10 - -//Program bitflags -#define PROGRAM_ALL (~0) -#define PROGRAM_CONSOLE (1<<0) -#define PROGRAM_LAPTOP (1<<1) -#define PROGRAM_TABLET (1<<2) -#define PROGRAM_PHONE (1<<3) -#define PROGRAM_PDA (1<<4) -#define PROGRAM_TELESCREEN (1<<5) -#define PROGRAM_INTEGRATED (1<<6) - -#define PROGRAM_PORTABLE PROGRAM_LAPTOP | PROGRAM_TABLET | PROGRAM_PHONE | PROGRAM_PDA -#define PROGRAM_STATIONARY PROGRAM_CONSOLE | PROGRAM_TELESCREEN - -//Program states -#define PROGRAM_STATE_KILLED 0 -#define PROGRAM_STATE_BACKGROUND 1 -#define PROGRAM_STATE_ACTIVE 2 -//Program categories -#define PROGRAM_CATEGORY_CMD "Command" -#define PROGRAM_CATEGORY_SEC "Security" -#define PROGRAM_CATEGORY_ENGI "Engineering" -#define PROGRAM_CATEGORY_SCI "Science" -#define PROGRAM_CATEGORY_MED "Medical" -#define PROGRAM_CATEGORY_SUPL "Supply" -#define PROGRAM_CATEGORY_MISC "Other" - #define FIREDOOR_OPEN 1 #define FIREDOOR_CLOSED 2 diff --git a/code/__DEFINES/modular_computer.dm b/code/__DEFINES/modular_computer.dm new file mode 100644 index 000000000000..60ccaac8473c --- /dev/null +++ b/code/__DEFINES/modular_computer.dm @@ -0,0 +1,116 @@ +// Used to stringify message targets before sending the signal datum. +#define STRINGIFY_PDA_TARGET(name, job) "[name] ([job])" +/** + * program_flags + * Used by programs to tell the ModPC any special functions it has. + */ +/* //TODO: Add these back in when TG ModPCs are ported. +///If the program requires NTNet to be online for it to work. +#define PROGRAM_REQUIRES_NTNET (1<<0) +///The program can be downloaded from the default NTNet downloader store. +#define PROGRAM_ON_NTNET_STORE (1<<1) +///The program can only be downloaded from the Syndinet store, usually nukie/emagged pda. +#define PROGRAM_ON_SYNDINET_STORE (1<<2) +///The program is unique and will delete itself upon being transferred to ensure only one copy exists. +#define PROGRAM_UNIQUE_COPY (1<<3) +///The program is a header and will show up at the top of the ModPC's UI. +#define PROGRAM_HEADER (1<<4) +///The program will run despite the ModPC not having any power in it. +#define PROGRAM_RUNS_WITHOUT_POWER (1<<5) +///The circuit ports of this program can be triggered even if the program is not open +#define PROGRAM_CIRCUITS_RUN_WHEN_CLOSED (1<<6) +*/ + +//Program categories +#define PROGRAM_CATEGORY_DEVICE "Device Tools" +#define PROGRAM_CATEGORY_EQUIPMENT "Equipment" +#define PROGRAM_CATEGORY_GAMES "Games" +#define PROGRAM_CATEGORY_SECURITY "Security & Records" +#define PROGRAM_CATEGORY_ENGINEERING "Engineering" +#define PROGRAM_CATEGORY_SUPPLY "Supply" +#define PROGRAM_CATEGORY_SCIENCE "Science" + +///The default amount a program should take in cell use. +#define PROGRAM_BASIC_CELL_USE 15 + +///This app grants a minor protection against being PDA bombed if installed. +///(can sometimes prevent it from being sent, while wasting a PDA bomb from the sender). +#define DETOMATIX_RESIST_MINOR 1 +///This app grants a larger protection against being PDA bombed if installed. +///(can sometimes prevent it from being sent, while wasting a PDA bomb from the sender). +#define DETOMATIX_RESIST_MAJOR 2 +///This app gives a diminished protection against being PDA bombed if installed. +#define DETOMATIX_RESIST_MALUS -4 + +/** + * NTNet transfer speeds, used when downloading/uploading a file/program. + * The define is how fast it will download an app every program's process_tick. + */ +///Used for wireless devices with low signal. +#define NTNETSPEED_LOWSIGNAL 0.5 +///Used for wireless devices with high signal. +#define NTNETSPEED_HIGHSIGNAL 1 +///Used for laptops with a high signal, or computers, which is connected regardless of z level. +#define NTNETSPEED_ETHERNET 2 + +/** + * NTNet connection signals + * Used to calculate the defines above from NTNet Downloader, this is how + * good a ModPC's signal is. + */ +///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 +///Low signal, so away from the station, but still connected +#define NTNET_LOW_SIGNAL 1 +///On station with good signal. +#define NTNET_GOOD_SIGNAL 2 +///Using a Computer or Laptop with good signal, ethernet-connected. +#define NTNET_ETHERNET_SIGNAL 3 + +/// The default ringtone of the Messenger app. +#define MESSENGER_RINGTONE_DEFAULT "beep" + +/// The maximum length of the ringtone of the Messenger app. +#define MESSENGER_RINGTONE_MAX_LENGTH 20 + +//Modular computer part defines +#define MC_CPU "CPU" +#define MC_HDD "HDD" +#define MC_SDD "SDD" +#define MC_CARD "CARD" +#define MC_CARD2 "CARD2" +#define MC_NET "NET" +#define MC_PRINT "PRINT" +#define MC_CELL "CELL" +#define MC_CHARGE "CHARGE" +#define MC_AI "AI" +#define MC_SENSORS "SENSORS" +#define MC_AI_NETWORK "AINETWORK" + +//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) + + +//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 +#define MIN_NTNET_LOGS 10 + +//Program bitflags +#define PROGRAM_ALL (~0) +#define PROGRAM_CONSOLE (1<<0) +#define PROGRAM_LAPTOP (1<<1) +#define PROGRAM_TABLET (1<<2) +#define PROGRAM_PHONE (1<<3) +#define PROGRAM_PDA (1<<4) +#define PROGRAM_TELESCREEN (1<<5) +#define PROGRAM_INTEGRATED (1<<6) + +#define PROGRAM_PORTABLE PROGRAM_LAPTOP | PROGRAM_TABLET | PROGRAM_PHONE | PROGRAM_PDA +#define PROGRAM_STATIONARY PROGRAM_CONSOLE | PROGRAM_TELESCREEN + +//Program states +#define PROGRAM_STATE_KILLED 0 +#define PROGRAM_STATE_BACKGROUND 1 +#define PROGRAM_STATE_ACTIVE 2 diff --git a/code/__DEFINES/networks.dm b/code/__DEFINES/networks.dm deleted file mode 100644 index 115c1653493c..000000000000 --- a/code/__DEFINES/networks.dm +++ /dev/null @@ -1,3 +0,0 @@ -#define HID_RESTRICTED_END 101 //the first nonrestricted ID, automatically assigned on connection creation. - -#define NETWORK_BROADCAST_ID "ALL" diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 54cd8b3c06e2..968901d86ef9 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -150,7 +150,6 @@ #define INIT_ORDER_TICKER 55 #define INIT_ORDER_MAPPING 50 #define INIT_ORDER_EARLY_ASSETS 48 -#define INIT_ORDER_NETWORKS 45 #define INIT_ORDER_ECONOMY 40 #define INIT_ORDER_OUTPUTS 35 #define INIT_ORDER_ATOMS 30 @@ -199,7 +198,6 @@ #define FIRE_PRIORITY_SPACEDRIFT 30 #define FIRE_PRIORITY_FIELDS 30 #define FIRE_PRIORITY_SMOOTHING 35 -#define FIRE_PRIORITY_NETWORKS 40 #define FIRE_PRIORITY_OBJ 40 #define FIRE_PRIORITY_ACID 40 #define FIRE_PRIORITY_BURNING 40 diff --git a/code/__HELPERS/names.dm b/code/__HELPERS/names.dm index 9f80401ceff1..bd066fcb2e15 100644 --- a/code/__HELPERS/names.dm +++ b/code/__HELPERS/names.dm @@ -293,3 +293,36 @@ GLOBAL_DATUM(syndicate_code_response_regex, /regex) . += "." else . += ", " + +/** + * Generate a name devices + * + * Creates a randomly generated tag or name for devices or anything really + * it keeps track of a special list that makes sure no name is used more than + * once + * + * args: + * * len (int)(Optional) Default=5 The length of the name + * * prefix (string)(Optional) static text in front of the random name + * * postfix (string)(Optional) static text in back of the random name + * Returns (string) The generated name + */ +/proc/assign_random_name(len=5, prefix="", postfix="") + //DO NOT REMOVE NAMES HERE UNLESS YOU KNOW WHAT YOU'RE DOING + //All names already used + var/static/list/used_names = list() + + var/static/valid_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + var/list/new_name = list() + var/text + // machine id's should be fun random chars hinting at a larger world + do + new_name.Cut() + new_name += prefix + for(var/i = 1 to len) + new_name += valid_chars[rand(1,length(valid_chars))] + new_name += postfix + text = new_name.Join() + while(used_names[text]) + used_names[text] = TRUE + return text diff --git a/code/controllers/subsystem/modular_computers.dm b/code/controllers/subsystem/modular_computers.dm new file mode 100644 index 000000000000..781948c80186 --- /dev/null +++ b/code/controllers/subsystem/modular_computers.dm @@ -0,0 +1,124 @@ +///The maximum amount of logs that can be generated before they start overwriting eachother. +#define MAX_LOG_COUNT 300 + +SUBSYSTEM_DEF(modular_computers) + name = "Modular Computers" + flags = SS_KEEP_TIMING | SS_NO_FIRE + wait = 1 MINUTES + runlevels = RUNLEVEL_GAME + loading_points = 1 SECONDS // Yogs -- loading times + + ///List of all logs generated by ModPCs through the round. + ///Stops at MAX_LOG_COUNT and must be purged to keep logging. + var/list/modpc_logs = 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 + + ///List of all programs available to download from the NTNet store. + var/list/available_station_software = list() + ///List of all programs that can be downloaded from an emagged NTNet store. + var/list/available_antag_software = list() + ///List of all chat channels created by Chat Client. + var/list/chat_channels = list() + + ///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. + var/intrusion_detection_alarm = FALSE + var/next_picture_id = 0 + +/datum/controller/subsystem/modular_computers/Initialize() + build_software_lists() + initialized = TRUE + return SS_INIT_SUCCESS + +///Finds all downloadable programs and adds them to their respective downloadable list. +/datum/controller/subsystem/modular_computers/proc/build_software_lists() + for(var/datum/computer_file/program/prog as anything in subtypesof(/datum/computer_file/program)) + // Has no TGUI file so is not meant to be a downloadable thing. + if(!initial(prog.tgui_id) || !initial(prog.filename)) + continue + prog = new prog + + if(prog.available_on_ntnet) + available_station_software.Add(prog) + if(prog.available_on_syndinet) + available_antag_software.Add(prog) + +///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) + if(filename == programs.filename) + return programs + return null + +///Attempts to find a chatorom using the ID of the channel. +/datum/controller/subsystem/modular_computers/proc/get_chat_channel_by_id(id) + for(var/datum/ntnet_conversation/chan as anything in chat_channels) + if(chan.id == id) + return chan + return null + +/** + * Records a message into the station logging system for the network + * Arguments: + * * log_string - The message being logged + */ +/datum/controller/subsystem/modular_computers/proc/add_log(log_string) + var/list/log_text = list() + log_text += "\[[station_time_timestamp()]\]" + log_text += "*SYSTEM* - " + log_text += log_string + log_string = log_text.Join() + + modpc_logs.Add(log_string) + + // We have too many logs, remove the oldest entries until we get into the limit + if(modpc_logs.len > MAX_LOG_COUNT) + modpc_logs = modpc_logs.Copy(modpc_logs.len - MAX_LOG_COUNT, 0) + +/datum/controller/subsystem/modular_computers/proc/toggle_function(function) + if(!function) + return + function = text2num(function) + switch(function) + if(NTNET_SOFTWAREDOWNLOAD) + setting_softwaredownload = !setting_softwaredownload + SSmodular_computers.add_log("Configuration Updated. Wireless network firewall now [setting_softwaredownload ? "allows" : "disallows"] connection to software repositories.") + if(NTNET_COMMUNICATION) + setting_communication = !setting_communication + SSmodular_computers.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) + //NTNet is down. + if(!find_functional_ntnet_relay()) + return FALSE + + switch(specific_action) + if(NTNET_SOFTWAREDOWNLOAD) + return setting_softwaredownload + if(NTNET_COMMUNICATION) + return setting_communication + return TRUE + +/** + * Removes all station logs and leaves it with an alert that it's been wiped. + */ +/datum/controller/subsystem/modular_computers/proc/purge_logs() + modpc_logs = list() + add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-") + +/** + * Returns a name which a /datum/picture can be assigned to. + * Use this function to get asset names and to avoid cache duplicates/overwriting. + */ +/datum/controller/subsystem/modular_computers/proc/get_next_picture_name() + var/next_uid = next_picture_id + next_picture_id++ + return "ntos_picture_[next_uid].png" + +#undef MAX_LOG_COUNT diff --git a/code/controllers/subsystem/processing/networks.dm b/code/controllers/subsystem/processing/networks.dm deleted file mode 100644 index 0e62307937a7..000000000000 --- a/code/controllers/subsystem/processing/networks.dm +++ /dev/null @@ -1,51 +0,0 @@ -PROCESSING_SUBSYSTEM_DEF(networks) - name = "Networks" - priority = FIRE_PRIORITY_NETWORKS - wait = 1 - stat_tag = "NET" - flags = SS_KEEP_TIMING - init_order = INIT_ORDER_NETWORKS - var/datum/ntnet/station/station_network - var/assignment_hardware_id = HID_RESTRICTED_END - var/list/networks_by_id = list() //id = network - var/list/interfaces_by_id = list() //hardware id = component interface - var/resolve_collisions = TRUE - -/datum/controller/subsystem/processing/networks/Initialize() - station_network = new - station_network.register_map_supremecy() - return SS_INIT_SUCCESS - -/datum/controller/subsystem/processing/networks/proc/register_network(datum/ntnet/network) - if(!networks_by_id[network.network_id]) - networks_by_id[network.network_id] = network - return TRUE - return FALSE - -/datum/controller/subsystem/processing/networks/proc/unregister_network(datum/ntnet/network) - networks_by_id -= network.network_id - return TRUE - -/datum/controller/subsystem/processing/networks/proc/register_interface(datum/component/ntnet_interface/D) - if(!interfaces_by_id[D.hardware_id]) - interfaces_by_id[D.hardware_id] = D - return TRUE - return FALSE - -/datum/controller/subsystem/processing/networks/proc/unregister_interface(datum/component/ntnet_interface/D) - interfaces_by_id -= D.hardware_id - return TRUE - -/datum/controller/subsystem/processing/networks/proc/get_next_HID() - var/string = "[num2text(assignment_hardware_id++, 12)]" - return make_address(string) - -/datum/controller/subsystem/processing/networks/proc/make_address(string) - if(!string) - return resolve_collisions? make_address("[num2text(rand(HID_RESTRICTED_END, 999999999), 12)]"):null - var/hex = md5(string) - if(!hex) - return //errored - . = "[copytext_char(hex, 1, 9)]" //16 ^ 8 possibilities I think. - if(interfaces_by_id[.]) - return resolve_collisions? make_address("[num2text(rand(HID_RESTRICTED_END, 999999999), 12)]"):null diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index e461aa2ee36d..c197eab7433b 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -316,6 +316,7 @@ var/datum/component/component_type = original_type if(QDELING(src)) + CRASH("Attempted to add a new component of type \[[component_type]\] to a qdeleting parent of type \[[type]\]!") var/datum/component/new_component diff --git a/code/datums/components/ntnet_interface.dm b/code/datums/components/ntnet_interface.dm deleted file mode 100644 index 3a8fb559bf48..000000000000 --- a/code/datums/components/ntnet_interface.dm +++ /dev/null @@ -1,66 +0,0 @@ -//Thing meant for allowing datums and objects to access a NTnet network datum. -/datum/proc/ntnet_receive(datum/netdata/data) - return - -/datum/proc/ntnet_receive_broadcast(datum/netdata/data) - return - -/datum/proc/ntnet_send(datum/netdata/data, netid) - var/datum/component/ntnet_interface/NIC = GetComponent(/datum/component/ntnet_interface) - if(!NIC) - return FALSE - return NIC.__network_send(data, netid) - -/datum/component/ntnet_interface - var/hardware_id //text. this is the true ID. do not change this. stuff like ID forgery can be done manually. - var/network_name = "" //text - var/list/networks_connected_by_id = list() //id = datum/ntnet - var/differentiate_broadcast = TRUE //If false, broadcasts go to ntnet_receive. NOT RECOMMENDED. - -/datum/component/ntnet_interface/Initialize(force_name = "NTNet Device", autoconnect_station_network = TRUE) //Don't force ID unless you know what you're doing! - hardware_id = "[SSnetworks.get_next_HID()]" - network_name = force_name - if(!SSnetworks.register_interface(src)) - . = COMPONENT_INCOMPATIBLE - CRASH("Unable to register NTNet interface. Interface deleted.") - if(autoconnect_station_network) - register_connection(SSnetworks.station_network) - -/datum/component/ntnet_interface/Destroy() - unregister_all_connections() - SSnetworks.unregister_interface(src) - return ..() - -/datum/component/ntnet_interface/proc/__network_receive(datum/netdata/data) //Do not directly proccall! - SEND_SIGNAL(parent, COMSIG_COMPONENT_NTNET_RECEIVE, data) - if(differentiate_broadcast && data.broadcast) - parent.ntnet_receive_broadcast(data) - else - parent.ntnet_receive(data) - -/datum/component/ntnet_interface/proc/__network_send(datum/netdata/data, netid) //Do not directly proccall! - - if(netid) - if(networks_connected_by_id[netid]) - var/datum/ntnet/net = networks_connected_by_id[netid] - return net.process_data_transmit(src, data) - return FALSE - for(var/i in networks_connected_by_id) - var/datum/ntnet/net = networks_connected_by_id[i] - net.process_data_transmit(src, data) - return TRUE - -/datum/component/ntnet_interface/proc/register_connection(datum/ntnet/net) - if(net.interface_connect(src)) - networks_connected_by_id[net.network_id] = net - return TRUE - -/datum/component/ntnet_interface/proc/unregister_all_connections() - for(var/i in networks_connected_by_id) - unregister_connection(networks_connected_by_id[i]) - return TRUE - -/datum/component/ntnet_interface/proc/unregister_connection(datum/ntnet/net) - net.interface_disconnect(src) - networks_connected_by_id -= net.network_id - return TRUE diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/airlock_control.dm index 01b006944a8b..dd8ebae5617c 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/airlock_control.dm @@ -2,6 +2,7 @@ // This code allows for airlocks to be controlled externally by setting an id_tag and comm frequency (disables ID access) /obj/machinery/door/airlock + opens_with_door_remote = TRUE /// The current state of the airlock, used to construct the airlock overlays var/airlock_state var/id_tag diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 9c1fef0d6b5e..bfa16667187c 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -62,6 +62,7 @@ secondsElectrified = MACHINE_NOT_ELECTRIFIED //How many seconds remain until the door is no longer electrified. -1/MACHINE_ELECTRIFIED_PERMANENT = permanently electrified until someone fixes it. assemblytype = /obj/structure/door_assembly normalspeed = TRUE + opens_with_door_remote = TRUE explosion_block = 1 hud_possible = list(DIAG_AIRLOCK_HUD) smoothing_groups = SMOOTH_GROUP_AIRLOCK @@ -181,7 +182,6 @@ diag_hud_set_electrified() rebuild_parts() - AddComponent(/datum/component/ntnet_interface) return INITIALIZE_HINT_LATELOAD @@ -337,56 +337,6 @@ if ("cyclelinkeddir") cyclelinkairlock() -/obj/machinery/door/airlock/check_access_ntnet(datum/netdata/data) - return !requiresID() || ..() - -/obj/machinery/door/airlock/ntnet_receive(datum/netdata/data) - // Check if the airlock is powered and can accept control packets. - if(!hasPower() || !canAIControl()) - return - - // Check packet access level. - if(!check_access_ntnet(data)) - return - - // Handle received packet. - var/command = lowertext(data.data["data"]) - var/command_value = lowertext(data.data["data_secondary"]) - switch(command) - if("open") - if(command_value == "on" && !density) - return - - if(command_value == "off" && density) - return - - if(density) - INVOKE_ASYNC(src, PROC_REF(open)) - else - INVOKE_ASYNC(src, PROC_REF(close)) - - if("bolt") - if(command_value == "on" && locked) - return - - if(command_value == "off" && !locked) - return - - if(locked) - unbolt() - else - bolt() - - if("emergency") - if(command_value == "on" && emergency) - return - - if(command_value == "off" && !emergency) - return - - emergency = !emergency - update_appearance(UPDATE_ICON) - /obj/machinery/door/airlock/lock() bolt() diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index c97efafd233a..f798383ae605 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -17,6 +17,8 @@ interaction_flags_atom = INTERACT_ATOM_UI_INTERACT blocks_emissive = EMISSIVE_BLOCK_UNIQUE + /// Door remote allow control + var/opens_with_door_remote = FALSE /// TRUE means density will be set as soon as the door begins to close var/air_tight = FALSE /// How long is this door electrified for diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index e1732e9e0ad3..67b9b531dbef 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -16,6 +16,7 @@ opacity = FALSE can_atmos_pass = ATMOS_PASS_PROC interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_REQUIRES_SILICON | INTERACT_MACHINE_OPEN + opens_with_door_remote = TRUE var/obj/item/electronics/airlock/electronics = null var/reinf = 0 var/shards = 2 @@ -25,7 +26,6 @@ /obj/machinery/door/window/Initialize(mapload, set_dir, unres_sides) . = ..() - AddComponent(/datum/component/ntnet_interface) if(set_dir) setDir(set_dir) if(LAZYLEN(req_access)) @@ -362,36 +362,6 @@ if("deny") flick("[base_state]deny", src) -/obj/machinery/door/window/check_access_ntnet(datum/netdata/data) - return !requiresID() || ..() - -/obj/machinery/door/window/ntnet_receive(datum/netdata/data) - // Check if the airlock is powered. - if(!hasPower()) - return - - // Check packet access level. - if(!check_access_ntnet(data)) - return - - // Handle received packet. - var/command = lowertext(data.data["data"]) - var/command_value = lowertext(data.data["data_secondary"]) - switch(command) - if("open") - if(command_value == "on" && !density) - return - - if(command_value == "off" && density) - return - - if(density) - INVOKE_ASYNC(src, PROC_REF(open)) - else - INVOKE_ASYNC(src, PROC_REF(close)) - if("touch") - INVOKE_ASYNC(src, PROC_REF(open_and_close)) - /obj/machinery/door/window/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) switch(the_rcd.construction_mode) if(RCD_DECONSTRUCT) diff --git a/code/game/machinery/telecomms/ntnet_relay.dm b/code/game/machinery/telecomms/ntnet_relay.dm new file mode 100644 index 000000000000..304a23952e37 --- /dev/null +++ b/code/game/machinery/telecomms/ntnet_relay.dm @@ -0,0 +1,129 @@ +///Checks whether NTNet is available by ensuring at least one relay exists and is operational. +/proc/find_functional_ntnet_relay() + // Check all relays. If we have at least one working relay, ntos is up. + for(var/obj/machinery/ntnet_relay/relays as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)) + if(!relays.is_operational()) + continue + return TRUE + return FALSE + +// Relays don't handle any actual communication. Global NTNet datum does that, relays only tell the datum if it should or shouldn't work. +/obj/machinery/ntnet_relay + name = "NTNet Quantum Relay" + desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile." + use_power = ACTIVE_POWER_USE + active_power_usage = 10000 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round + idle_power_usage = 100 + icon = 'icons/obj/machines/telecomms.dmi' + icon_state = "bus" + density = TRUE + circuit = /obj/item/circuitboard/machine/ntnet_relay + + ///On / off status for the relay machine, toggleable by the user. + var/relay_enabled = TRUE + ///(D)DoS-attack-related failure causing it not to be operational any longer. + var/dos_failure = FALSE + var/list/dos_sources = list() // Backwards reference for qdel() stuff + 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 + var/dos_dissipate = 0.5 // Amount of DoS "packets" dissipated over time. + +/obj/machinery/ntnet_relay/Initialize(mapload) + . = ..() + uid = gl_uid++ + var/list/current_machines = SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay) + SSmodular_computers.add_log("New quantum relay activated. Current amount of linked relays: [current_machines.len]") + +/obj/machinery/ntnet_relay/Destroy() + . = ..() + var/list/machines_left = SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay) + SSmodular_computers.add_log("Quantum relay connection severed. Current amount of linked relays: [machines_left.len]") + for(var/datum/computer_file/program/ntnet_dos/D in dos_sources) + D.target = null + D.error = "Connection to quantum relay severed" + +// TODO: Implement more logic here. For now it's only a placeholder. +/obj/machinery/ntnet_relay/is_operational() + if(stat & (BROKEN | NOPOWER | EMPED)) + return FALSE + if(dos_failure) + return FALSE + if(!relay_enabled) + return FALSE + return TRUE + +///Proc called to change the value of the `relay_enabled` variable and append behavior related to its change. +/obj/machinery/ntnet_relay/proc/set_relay_enabled(new_value) + if(new_value == relay_enabled) + return + . = relay_enabled + relay_enabled = new_value + +///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) + return + . = dos_failure + dos_failure = new_value + +/obj/machinery/ntnet_relay/update_icon_state() + icon_state = "bus[is_operational() ? null : "_off"]" + return ..() + +/obj/machinery/ntnet_relay/process(seconds_per_tick) + if(is_operational()) + use_power = ACTIVE_POWER_USE + else + use_power = IDLE_POWER_USE + + update_appearance() + + if(dos_overload > 0) + dos_overload = max(0, dos_overload - dos_dissipate * seconds_per_tick) + + // If DoS traffic exceeded capacity, crash. + if((dos_overload > dos_capacity) && !dos_failure) + set_dos_failure(TRUE) + update_appearance() + SSmodular_computers.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) + set_dos_failure(FALSE) + update_appearance() + SSmodular_computers.add_log("Quantum relay switched from overload recovery mode to normal operation mode.") + return TRUE + +/obj/machinery/ntnet_relay/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "NtnetRelay") + ui.open() + +/obj/machinery/ntnet_relay/ui_data(mob/user) + var/list/data = list() + data["enabled"] = relay_enabled + data["dos_capacity"] = dos_capacity + data["dos_overload"] = dos_overload + data["dos_crashed"] = dos_failure + return data + +/obj/machinery/ntnet_relay/ui_act(action, params) + . = ..() + if(.) + return + switch(action) + if("restart") + dos_overload = 0 + set_dos_failure(FALSE) + update_appearance() + SSmodular_computers.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.") + return TRUE + if("toggle") + set_relay_enabled(!relay_enabled) + SSmodular_computers.add_log("Quantum relay manually [relay_enabled ? "enabled" : "disabled"].") + update_appearance() + return TRUE diff --git a/code/game/objects/items/control_wand.dm b/code/game/objects/items/control_wand.dm index 0cd562b04a8f..0f332c1bd2a6 100644 --- a/code/game/objects/items/control_wand.dm +++ b/code/game/objects/items/control_wand.dm @@ -19,7 +19,6 @@ . = ..() for(var/i in region_access) access_list += get_region_accesses(i) - AddComponent(/datum/component/ntnet_interface) /obj/item/door_remote/attack_self(mob/user) switch(mode) @@ -32,29 +31,54 @@ to_chat(user, "Now in mode: [mode].") // Airlock remote works by sending NTNet packets to whatever it's pointed at. -/obj/item/door_remote/afterattack(atom/A, mob/user) +/obj/item/door_remote/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() - var/datum/component/ntnet_interface/target_interface = A.GetComponent(/datum/component/ntnet_interface) - - if(!target_interface) + var/obj/machinery/door/door + if(istype(target, /obj/machinery/door)) + door = target + if(!door.opens_with_door_remote) + return + else + for (var/obj/machinery/door/door_on_turf in get_turf(target)) + if(door_on_turf.opens_with_door_remote) + door = door_on_turf + break + if(isnull(door)) + return + if(!door.check_access_list(access_list) || !door.requiresID()) + target.balloon_alert(user, "can't access!") return - // Generate a control packet. - var/datum/netdata/data = new - data.recipient_ids = list(target_interface.hardware_id) + var/obj/machinery/door/airlock/airlock = door + + if(!door.hasPower() || (istype(airlock) && !airlock.canAIControl())) + target.balloon_alert(user, mode == WAND_OPEN ? "it won't budge!" : "nothing happens!") + return switch(mode) if(WAND_OPEN) - data.data["data"] = "open" + if(door.density) + door.open() + else + door.close() if(WAND_BOLT) - data.data["data"] = "bolt" + if(!istype(airlock)) + target.balloon_alert(user, "only airlocks!") + return + + if(airlock.locked) + airlock.unbolt() + log_combat(user, airlock, "unbolted", src) + else + airlock.bolt() + log_combat(user, airlock, "bolted", src) if(WAND_EMERGENCY) - data.data["data"] = "emergency" + if(!istype(airlock)) + target.balloon_alert(user, "only airlocks!") + return - data.data["data_secondary"] = "toggle" - data.passkey = access_list - - ntnet_send(data) + airlock.emergency = !airlock.emergency + airlock.update_appearance(UPDATE_ICON) /obj/item/door_remote/omni diff --git a/code/modules/NTNet/netdata.dm b/code/modules/NTNet/netdata.dm deleted file mode 100644 index 2a3a85f70643..000000000000 --- a/code/modules/NTNet/netdata.dm +++ /dev/null @@ -1,44 +0,0 @@ -/datum/netdata //this requires some thought later on but for now it's fine. - var/network_id - - var/autopasskey = TRUE - - var/list/recipient_ids = list() - var/sender_id - var/broadcast = FALSE //Whether this is a broadcast packet. - - var/list/data = list() - - var/list/passkey - -/datum/netdata/proc/standard_format_data(primary, secondary, passkey) - data["data"] = primary - data["data_secondary"] = secondary - data["encrypted_passkey"] = passkey - -/datum/netdata/proc/json_to_data(json) - data = json_decode(json) - -/datum/netdata/proc/json_append_to_data(json) - data |= json_decode(json) - -/datum/netdata/proc/data_to_json() - return json_encode(data) - -/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 - .["data_list"] = data - -/datum/netdata/proc/generate_netlog() - return "[json_encode(json_list_generation_netlog())]" diff --git a/code/modules/NTNet/network.dm b/code/modules/NTNet/network.dm deleted file mode 100644 index e7d64f796ab9..000000000000 --- a/code/modules/NTNet/network.dm +++ /dev/null @@ -1,256 +0,0 @@ -/datum/ntnet - var/network_id = "Network" - var/list/connected_interfaces_by_id = list() //id = datum/component/ntnet_interface - var/list/services_by_path = list() //type = datum/ntnet_service - var/list/services_by_id = list() //id = datum/ntnet_service - - var/list/autoinit_service_paths = list() //typepaths - - - var/list/relays = list() - var/list/logs = list() - var/list/available_station_software = list() - var/list/available_antag_software = list() - var/list/chat_channels = list() - var/list/fileservers = list() - // Amount of logs the system tries to keep in memory. Keep below 999 to prevent byond from acting weirdly. - // High values make displaying logs much laggier. - 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 = 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(_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/Destroy() - for(var/i in connected_interfaces_by_id) - var/datum/component/ntnet_interface/I = i - I.unregister_connection(src) - for(var/i in services_by_id) - var/datum/ntnet_service/S = i - S.disconnect(src, TRUE) - return ..() - -/datum/ntnet/proc/interface_connect(datum/component/ntnet_interface/I) - if(connected_interfaces_by_id[I.hardware_id]) - return FALSE - 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/find_service_id(id) - return services_by_id[id] - -/datum/ntnet/proc/find_service_path(path) - return services_by_path[path] - -/datum/ntnet/proc/register_service(datum/ntnet_service/S) - if(!istype(S)) - return FALSE - if(services_by_path[S.type] || services_by_id[S.id]) - return FALSE - services_by_path[S.type] = S - services_by_id[S.id] = S - return TRUE - -/datum/ntnet/proc/unregister_service(datum/ntnet_service/S) - if(!istype(S)) - return FALSE - services_by_path -= S.type - services_by_id -= S.id - return TRUE - -/datum/ntnet/proc/create_service(type) - var/datum/ntnet_service/S = new type - if(!istype(S)) - return FALSE - . = S.connect(src) - if(!.) - qdel(S) - -/datum/ntnet/proc/destroy_service(type) - var/datum/ntnet_service/S = find_service_path(type) - if(!istype(S)) - return FALSE - . = S.disconnect(src) - if(.) - qdel(src) - -/datum/ntnet/proc/process_data_transmit(datum/component/ntnet_interface/sender, datum/netdata/data) - if(!check_relay_operation()) - return FALSE - data.network_id = src - log_data_transfer(data) - var/list/datum/component/ntnet_interface/receiving = list() - if((length(data.recipient_ids == 1) && data.recipient_ids[1] == NETWORK_BROADCAST_ID) || data.recipient_ids == NETWORK_BROADCAST_ID) - data.broadcast = TRUE - for(var/i in connected_interfaces_by_id) - receiving |= connected_interfaces_by_id[i] - else - for(var/i in data.recipient_ids) - var/datum/component/ntnet_interface/receiver = find_interface_id(i) - receiving |= receiver - - for(var/i in receiving) - var/datum/component/ntnet_interface/receiver = i - if(receiver) - receiver.__network_receive(data) - - for(var/i in services_by_id) - var/datum/ntnet_service/serv = services_by_id[i] - serv.ntnet_intercept(data, src, sender) - - 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 += "[station_time_timestamp()] - [data.generate_netlog()]" - if(logs.len > setting_maxlogcount) - logs = logs.Copy(logs.len - setting_maxlogcount, 0) - 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) - var/log_text = "[station_time_timestamp()] - " - if(source) - log_text += "[source.get_network_tag()] - " - else - log_text += "*SYSTEM* - " - 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) - - -// Checks whether NTNet operates. If parameter is passed checks whether specific function is enabled. -/datum/ntnet/proc/check_function(specific_action = 0) - if(!relays || !relays.len) // No relays found. NTNet is down - return FALSE - - // Check all relays. If we have at least one working relay, network is up. - if(!check_relay_operation()) - return FALSE - - if(setting_disabled) - return FALSE - - switch(specific_action) - if(NTNET_SOFTWAREDOWNLOAD) - return setting_softwaredownload - if(NTNET_PEERTOPEER) - return setting_peertopeer - if(NTNET_COMMUNICATION) - return setting_communication - if(NTNET_SYSTEMCONTROL) - return setting_systemcontrol - return TRUE - -// Builds lists that contain downloadable software. -/datum/ntnet/proc/build_software_lists() - available_station_software = list() - available_antag_software = list() - for(var/F in typesof(/datum/computer_file/program)) - var/datum/computer_file/program/prog = new F - // Invalid type (shouldn't be possible but just in case), invalid filetype (not executable program) or invalid filename (unset program) - if(!prog || prog.filename == "UnknownProgram" || prog.filetype != "PRG") - continue - // Check whether the program should be available for station/antag download, if yes, add it to lists. - if(prog.available_on_ntnet) - available_station_software.Add(prog) - if(prog.available_on_syndinet) - available_antag_software.Add(prog) - -// Attempts to find a downloadable file according to filename var -/datum/ntnet/proc/find_ntnet_file_by_name(filename) - for(var/N in available_station_software) - var/datum/computer_file/program/P = N - if(filename == P.filename) - return P - for(var/N in available_antag_software) - var/datum/computer_file/program/P = N - if(filename == P.filename) - return P - -/datum/ntnet/proc/get_chat_channel_by_id(id) - for(var/datum/ntnet_conversation/chan in chat_channels) - if(chan.id == id) - return chan - -// Resets the IDS alarm -/datum/ntnet/proc/resetIDS() - intrusion_detection_alarm = FALSE - -/datum/ntnet/proc/toggleIDS() - resetIDS() - intrusion_detection_enabled = !intrusion_detection_enabled - -// Removes all logs -/datum/ntnet/proc/purge_logs() - logs = list() - add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-") - -// Updates maximal amount of stored logs. Use this instead of setting the number, it performs required checks. -/datum/ntnet/proc/update_max_log_count(lognumber) - if(!lognumber) - return FALSE - // Trim the value if necessary - lognumber = max(MIN_NTNET_LOGS, min(lognumber, MAX_NTNET_LOGS)) - setting_maxlogcount = lognumber - add_log("Configuration Updated. Now keeping [setting_maxlogcount] logs in system memory.") - -/datum/ntnet/proc/toggle_function(function) - if(!function) - return - function = text2num(function) - switch(function) - if(NTNET_SOFTWAREDOWNLOAD) - setting_softwaredownload = !setting_softwaredownload - add_log("Configuration Updated. Wireless network firewall now [setting_softwaredownload ? "allows" : "disallows"] connection to software repositories.") - if(NTNET_PEERTOPEER) - setting_peertopeer = !setting_peertopeer - add_log("Configuration Updated. Wireless network firewall now [setting_peertopeer ? "allows" : "disallows"] peer to peer network traffic.") - if(NTNET_COMMUNICATION) - setting_communication = !setting_communication - add_log("Configuration Updated. Wireless network firewall now [setting_communication ? "allows" : "disallows"] instant messaging and similar communication services.") - 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 diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm deleted file mode 100644 index 777ea33d6d4c..000000000000 --- a/code/modules/NTNet/relays.dm +++ /dev/null @@ -1,124 +0,0 @@ -// Relays don't handle any actual communication. Global NTNet datum does that, relays only tell the datum if it should or shouldn't work. -/obj/machinery/ntnet_relay - name = "NTNet Quantum Relay" - desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile." - use_power = ACTIVE_POWER_USE - active_power_usage = 10000 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round - idle_power_usage = 100 - icon = 'icons/obj/machines/telecomms.dmi' - icon_state = "bus" - density = TRUE - circuit = /obj/item/circuitboard/machine/ntnet_relay - var/datum/ntnet/NTNet = null // This is mostly for backwards reference and to allow varedit modifications from ingame. - var/enabled = 1 // Set to 0 if the relay was turned off - var/dos_failure = 0 // Set to 1 if the relay failed due to (D)DoS attack - var/list/dos_sources = list() // Backwards reference for qdel() stuff - 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 - var/dos_dissipate = 0.5 // Amount of DoS "packets" dissipated over time. - - -// TODO: Implement more logic here. For now it's only a placeholder. -/obj/machinery/ntnet_relay/is_operational() - if(stat & (BROKEN | NOPOWER | EMPED)) - return FALSE - if(dos_failure) - return FALSE - if(!enabled) - return FALSE - return TRUE - -/obj/machinery/ntnet_relay/update_overlays() - . = ..() - if(is_operational()) - var/mutable_appearance/on_overlay = mutable_appearance(icon, "[initial(icon_state)]_on") - . += on_overlay - -/obj/machinery/ntnet_relay/update_icon_state() - . = ..() - if(panel_open) - icon_state = "[initial(icon_state)]_o" - else - icon_state = initial(icon_state) - icon_state = "bus" - -/obj/machinery/ntnet_relay/process(delta_time) - if(is_operational()) - use_power = ACTIVE_POWER_USE - else - use_power = IDLE_POWER_USE - - update_appearance(UPDATE_ICON) - - if(dos_overload > 0) - dos_overload = max(0, dos_overload - dos_dissipate * delta_time) - - // If DoS traffic exceeded capacity, crash. - if((dos_overload > dos_capacity) && !dos_failure) - dos_failure = 1 - update_appearance(UPDATE_ICON) - 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_appearance(UPDATE_ICON) - SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.") - ..() - -/obj/machinery/ntnet_relay/ui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "NtnetRelay") - ui.open() - - -/obj/machinery/ntnet_relay/ui_data(mob/user) - var/list/data = list() - data["enabled"] = enabled - data["dos_capacity"] = dos_capacity - data["dos_overload"] = dos_overload - data["dos_crashed"] = dos_failure - return data - - -/obj/machinery/ntnet_relay/ui_act(action, params) - if(..()) - return - switch(action) - if("restart") - dos_overload = 0 - dos_failure = 0 - update_appearance(UPDATE_ICON) - SSnetworks.station_network.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.") - return TRUE - if("toggle") - enabled = !enabled - SSnetworks.station_network.add_log("Quantum relay manually [enabled ? "enabled" : "disabled"].") - update_appearance(UPDATE_ICON) - return TRUE - -/obj/machinery/ntnet_relay/Initialize(mapload) - uid = gl_uid++ - component_parts = list() - - 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(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) - D.target = null - D.error = "Connection to quantum relay severed" - - return ..() diff --git a/code/modules/NTNet/services/_service.dm b/code/modules/NTNet/services/_service.dm deleted file mode 100644 index 75059d9992bd..000000000000 --- a/code/modules/NTNet/services/_service.dm +++ /dev/null @@ -1,38 +0,0 @@ -/datum/ntnet_service - var/name = "Unidentified Network Service" - var/id - var/list/networks_by_id = list() //Yes we support multinetwork services! - -/datum/ntnet_service/New() - var/datum/component/ntnet_interface/N = AddComponent(/datum/component/ntnet_interface, id, name, FALSE) - id = N.hardware_id - -/datum/ntnet_service/Destroy() - for(var/i in networks_by_id) - var/datum/ntnet/N = i - disconnect(N, TRUE) - networks_by_id = null - return ..() - -/datum/ntnet_service/proc/connect(datum/ntnet/net) - if(!istype(net)) - return FALSE - var/datum/component/ntnet_interface/interface = GetComponent(/datum/component/ntnet_interface) - if(!interface.register_connection(net)) - return FALSE - if(!net.register_service(src)) - interface.unregister_connection(net) - return FALSE - networks_by_id[net.network_id] = net - return TRUE - -/datum/ntnet_service/proc/disconnect(datum/ntnet/net, force = FALSE) - if(!istype(net) || (!net.unregister_service(src) && !force)) - return FALSE - var/datum/component/ntnet_interface/interface = GetComponent(/datum/component/ntnet_interface) - interface.unregister_connection(net) - networks_by_id -= net.network_id - return TRUE - -/datum/ntnet_service/proc/ntnet_intercept(datum/netdata/data, datum/ntnet/net, datum/component/ntnet_interface/sender) - return diff --git a/code/modules/jobs/access.dm b/code/modules/jobs/access.dm index 6ccdd40d28d9..235b2ecfb3f8 100644 --- a/code/modules/jobs/access.dm +++ b/code/modules/jobs/access.dm @@ -96,10 +96,6 @@ return FALSE return TRUE -/// Checks ntnet access -/obj/proc/check_access_ntnet(datum/netdata/data) - return check_access_list(data.passkey) - /// Get access for centcom job /proc/get_centcom_access(job) switch(job) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index bf302cc61f03..1db25a19e78f 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -65,7 +65,6 @@ mulebot_count += 1 set_id(suffix || id || "#[mulebot_count]") suffix = null - AddComponent(/datum/component/ntnet_interface) /mob/living/simple_animal/bot/mulebot/Destroy() unload(0) diff --git a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm index 27eb3a6ae970..53723c611318 100644 --- a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm +++ b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm @@ -15,13 +15,13 @@ qdel(src) return ntnrc_uid = id - if(SSnetworks.station_network) - SSnetworks.station_network.chat_channels.Add(src) + if(SSmodular_computers) + SSmodular_computers.chat_channels += src ..() /datum/ntnet_conversation/Destroy() - if(SSnetworks.station_network) - SSnetworks.station_network.chat_channels.Remove(src) + if(SSmodular_computers) + SSmodular_computers.chat_channels.Remove(src) return ..() /datum/ntnet_conversation/proc/add_message(message, username) diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 5518d88ae81b..00e1be0320ff 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -511,7 +511,7 @@ if(!get_ntnet_status()) return FALSE var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET] - return SSnetworks.station_network.add_log(text, network_card) + return SSmodular_computers.add_log(text, network_card) /obj/item/modular_computer/proc/shutdown_computer(loud = TRUE) kill_program(forced = TRUE) diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index 0e07c82176e4..620220a694f7 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -16,12 +16,12 @@ /// Short description of this program's function. var/extended_desc = "N/A" /// Category in the NTDownloader. - var/category = PROGRAM_CATEGORY_MISC + var/category /// Program-specific screen icon state var/program_icon_state = null /// 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, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION) + /// 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 diff --git a/code/modules/modular_computers/file_system/programs/ai_network/_ai_network_program.dm b/code/modules/modular_computers/file_system/programs/ai_network/_ai_network_program.dm index 9d37fd686f9c..3da2fb2f16e8 100644 --- a/code/modules/modular_computers/file_system/programs/ai_network/_ai_network_program.dm +++ b/code/modules/modular_computers/file_system/programs/ai_network/_ai_network_program.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/ai filename = "DEBUG" filedesc = "DEBUG" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING program_icon_state = "power_monitor" extended_desc = "This program connects to a local AI network to allow for administrative access" ui_header = "power_norm.gif" diff --git a/code/modules/modular_computers/file_system/programs/antagonist/bomberman.dm b/code/modules/modular_computers/file_system/programs/antagonist/bomberman.dm index 5cb6c2cd16cf..61289df19d5a 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/bomberman.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/bomberman.dm @@ -3,7 +3,7 @@ GLOBAL_LIST_EMPTY(PDABombCodes) /datum/computer_file/program/bomberman filename = "bomberman" filedesc = "BomberMan" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "hostile" extended_desc = "A new-age version of the classic 'Detomatix' program run on legacy PDAs. Can be used to attempt detonation of any PDA on the messaging list." size = 5 diff --git a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm index b5129207bd4f..8e8b81beac4f 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/contract_uplink.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/contract_uplink filename = "contractor uplink" filedesc = "Syndicate Contractor Uplink" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "assign" extended_desc = "A standard, Syndicate issued system for handling important contracts while on the field." size = 10 diff --git a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm index 30369d5483f3..39e3a18a2c42 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/dos.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/dos.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/ntnet_dos filename = "ntn_dos" filedesc = "DoS Traffic Generator" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "hostile" extended_desc = "This advanced script can perform denial of service attacks against NTNet quantum relays. The system administrator will probably notice this. Multiple devices can run this program together against the same relay for increased effect" size = 20 @@ -46,7 +46,7 @@ computer.play_interact_sound() switch(action) if("PRG_target_relay") - for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays) + for(var/obj/machinery/ntnet_relay/R as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)) if(R.uid == text2num(params["targid"])) target = R break @@ -62,14 +62,14 @@ if(target) executed = TRUE target.dos_sources.Add(src) - if(SSnetworks.station_network.intrusion_detection_enabled) + if(SSmodular_computers.intrusion_detection_enabled) var/obj/item/computer_hardware/network_card/network_card = computer.all_components[MC_NET] - 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 = TRUE + SSmodular_computers.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]") + SSmodular_computers.intrusion_detection_alarm = TRUE return TRUE /datum/computer_file/program/ntnet_dos/ui_data(mob/user) - if(!SSnetworks.station_network) + if(!SSmodular_computers) return var/list/data = get_header_data() @@ -84,7 +84,7 @@ else data["target"] = FALSE data["relays"] = list() - for(var/obj/machinery/ntnet_relay/R in SSnetworks.station_network.relays) + for(var/obj/machinery/ntnet_relay/R as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)) data["relays"] += list(list("id" = R.uid)) data["focus"] = target ? target.uid : null diff --git a/code/modules/modular_computers/file_system/programs/antagonist/frame.dm b/code/modules/modular_computers/file_system/programs/antagonist/frame.dm index 5b75c2954b91..148588d661dc 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/frame.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/frame.dm @@ -3,7 +3,7 @@ GLOBAL_LIST_EMPTY(PDAFrameCodes) /datum/computer_file/program/frame filename = "frame" filedesc = "F.R.A.M.E." - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "hostile" extended_desc = "A new-age version of the classic 'F.R.A.M.E.' program run on legacy PDAs. Can be used to silently open an uplink on any PDA on the messaging list." size = 5 diff --git a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm index abff81bd1308..12a5a0db6648 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/revelation filename = "revelation" filedesc = "Revelation" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "hostile" extended_desc = "This virus can destroy hard drive of system it is executed on. It may be obfuscated to look like another non-malicious program. Once armed, it will destroy the system upon next execution." size = 13 diff --git a/code/modules/modular_computers/file_system/programs/arcade.dm b/code/modules/modular_computers/file_system/programs/arcade.dm index a576aef69d58..2bccf8887145 100644 --- a/code/modules/modular_computers/file_system/programs/arcade.dm +++ b/code/modules/modular_computers/file_system/programs/arcade.dm @@ -8,6 +8,7 @@ size = 6 tgui_id = "NtosArcade" program_icon = "gamepad" + category = PROGRAM_CATEGORY_GAMES var/game_active = TRUE //Checks to see if a game is in progress. var/pause_state = FALSE //This disables buttons in order to prevent multiple actions before the opponent's actions. diff --git a/code/modules/modular_computers/file_system/programs/blackjack.dm b/code/modules/modular_computers/file_system/programs/blackjack.dm index 647fcc10a3ed..6844856ae6cb 100644 --- a/code/modules/modular_computers/file_system/programs/blackjack.dm +++ b/code/modules/modular_computers/file_system/programs/blackjack.dm @@ -16,6 +16,7 @@ program_icon_state = "arcade" extended_desc = "Nanotrasen does not permit anyone under the age of 21 to partake in gambling. Requires an NTNet connection." requires_ntnet = TRUE + category = PROGRAM_CATEGORY_GAMES network_destination = "arcade network" size = 4 tgui_id = "NtosBlackjack" diff --git a/code/modules/modular_computers/file_system/programs/command/budgetviewer.dm b/code/modules/modular_computers/file_system/programs/command/budgetviewer.dm index 0fee605764ac..e9e6706cf69f 100644 --- a/code/modules/modular_computers/file_system/programs/command/budgetviewer.dm +++ b/code/modules/modular_computers/file_system/programs/command/budgetviewer.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/budget_monitor filename = "budgetmonitor" filedesc = "Budget Monitor" - category = PROGRAM_CATEGORY_CMD + category = PROGRAM_CATEGORY_SUPPLY program_icon_state = "id" extended_desc = "This program will allow you to view the financial status of your department(s)." transfer_access = ACCESS_HEADS diff --git a/code/modules/modular_computers/file_system/programs/command/card.dm b/code/modules/modular_computers/file_system/programs/command/card.dm index 980f004feb5a..d791fe59a495 100644 --- a/code/modules/modular_computers/file_system/programs/command/card.dm +++ b/code/modules/modular_computers/file_system/programs/command/card.dm @@ -9,7 +9,7 @@ /datum/computer_file/program/card_mod filename = "cardmod" filedesc = "ID Card Modification" - category = PROGRAM_CATEGORY_CMD + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "id" extended_desc = "Program for programming employee ID cards to access parts of the station." transfer_access = ACCESS_HEADS diff --git a/code/modules/modular_computers/file_system/programs/command/crewmanifest.dm b/code/modules/modular_computers/file_system/programs/command/crewmanifest.dm index 7b273f80e7c6..a455bde59dd3 100644 --- a/code/modules/modular_computers/file_system/programs/command/crewmanifest.dm +++ b/code/modules/modular_computers/file_system/programs/command/crewmanifest.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/crew_manifest filename = "crewmani" filedesc = "Crew Manifest" - category = PROGRAM_CATEGORY_CMD + category = PROGRAM_CATEGORY_SECURITY program_icon_state = "id" extended_desc = "Program for viewing and printing the current crew manifest." requires_ntnet = FALSE diff --git a/code/modules/modular_computers/file_system/programs/command/jobmanagement.dm b/code/modules/modular_computers/file_system/programs/command/jobmanagement.dm index b2b6b31426c2..44d1bda46bc5 100644 --- a/code/modules/modular_computers/file_system/programs/command/jobmanagement.dm +++ b/code/modules/modular_computers/file_system/programs/command/jobmanagement.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/job_management filename = "job_manage" filedesc = "Job Manager" - category = PROGRAM_CATEGORY_CMD + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "id" extended_desc = "Program for viewing and changing job slot availability." transfer_access = ACCESS_HEADS diff --git a/code/modules/modular_computers/file_system/programs/command/synth_requester.dm b/code/modules/modular_computers/file_system/programs/command/synth_requester.dm index a71e0bc474ce..8fd5ac50b755 100644 --- a/code/modules/modular_computers/file_system/programs/command/synth_requester.dm +++ b/code/modules/modular_computers/file_system/programs/command/synth_requester.dm @@ -9,7 +9,7 @@ GLOBAL_LIST_INIT(granted_synthetic_access, list()) /datum/computer_file/program/synth_requester filename = "synth_req" filedesc = "Synthetic Manager" - category = PROGRAM_CATEGORY_CMD + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "id" extended_desc = "Program for requesting synthetic assistance and granting departmental access." transfer_access = ACCESS_HEADS diff --git a/code/modules/modular_computers/file_system/programs/engineering/alarm.dm b/code/modules/modular_computers/file_system/programs/engineering/alarm.dm index 9357494f9e83..69dafa6d4b72 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/alarm.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/alarm.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/alarm_monitor filename = "alarmmonitor" filedesc = "Alarm Monitor" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING ui_header = "alarm_green.gif" program_icon_state = "alert-green" extended_desc = "This program provides visual interface for station's alarm system." diff --git a/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm b/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm index 983cc27f71b3..ec6fe8bbe941 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/atmosscan filename = "atmosscan" filedesc = "Atmospheric Scanner" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING program_icon_state = "air" extended_desc = "A small built-in sensor reads out the atmospheric conditions around the device." network_destination = "atmos scan" diff --git a/code/modules/modular_computers/file_system/programs/engineering/energyharvestercontrol.dm b/code/modules/modular_computers/file_system/programs/engineering/energyharvestercontrol.dm index 6019ba7990e4..f4c15484e8a9 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/energyharvestercontrol.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/energyharvestercontrol.dm @@ -2,7 +2,7 @@ /datum/computer_file/program/energy_harvester_control filename = "energy_harvester_control" filedesc = "Energy Harvester Control" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING ui_header = "energy_harvester_null.gif" program_icon_state = "energy_harvester_null" extended_desc = "This program connects remotely to the onboard energy harvester, allowing a chief engineer to control the input rates and check for cashflow." diff --git a/code/modules/modular_computers/file_system/programs/engineering/ntmonitor.dm b/code/modules/modular_computers/file_system/programs/engineering/ntmonitor.dm index 63f2ced0cfd0..b1f386031dc3 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/ntmonitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/ntmonitor.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/ntnetmonitor filename = "ntmonitor" filedesc = "NTNet Diagnostics and Monitoring" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING program_icon_state = "comm_monitor" extended_desc = "This program monitors stationwide NTNet network, provides access to logging systems, and allows for configuration changes." size = 12 @@ -18,60 +18,41 @@ computer.play_interact_sound() switch(action) if("resetIDS") - if(SSnetworks.station_network) - SSnetworks.station_network.resetIDS() + SSmodular_computers.intrusion_detection_alarm = FALSE return TRUE if("toggleIDS") - if(SSnetworks.station_network) - SSnetworks.station_network.toggleIDS() - return TRUE - if("toggleWireless") - if(!SSnetworks.station_network) - return - - // NTNet is disabled. Enabling can be done without user prompt - if(SSnetworks.station_network.setting_disabled) - SSnetworks.station_network.setting_disabled = FALSE - return TRUE - - SSnetworks.station_network.setting_disabled = TRUE + SSmodular_computers.intrusion_detection_enabled = !SSmodular_computers.intrusion_detection_enabled return TRUE if("purgelogs") - if(SSnetworks.station_network) - SSnetworks.station_network.purge_logs() - return TRUE - if("updatemaxlogs") - var/logcount = params["new_number"] - if(SSnetworks.station_network) - SSnetworks.station_network.update_max_log_count(logcount) + SSmodular_computers.purge_logs() return TRUE if("toggle_function") - if(!SSnetworks.station_network) - return - SSnetworks.station_network.toggle_function(text2num(params["id"])) + SSmodular_computers.toggle_function(text2num(params["id"])) return TRUE /datum/computer_file/program/ntnetmonitor/ui_data(mob/user) - if(!SSnetworks.station_network) + if(!SSmodular_computers) return var/list/data = get_header_data() - 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["ntnetstatus"] = SSmodular_computers.check_function() + data["idsstatus"] = SSmodular_computers.intrusion_detection_enabled + data["idsalarm"] = SSmodular_computers.intrusion_detection_alarm - 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["ntnetrelays"] = list() + for(var/obj/machinery/ntnet_relay/relays as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)) + var/list/relay_data = list() + relay_data["is_operational"] = relays.is_operational() + relay_data["name"] = relays.name + relay_data["ref"] = REF(relays) + + data["ntnetrelays"] += list(relay_data) + + data["config_softwaredownload"] = SSmodular_computers.setting_softwaredownload + data["config_communication"] = SSmodular_computers.setting_communication data["ntnetlogs"] = list() - data["minlogs"] = MIN_NTNET_LOGS - data["maxlogs"] = MAX_NTNET_LOGS - - for(var/i in SSnetworks.station_network.logs) + for(var/i in SSmodular_computers.modpc_logs) data["ntnetlogs"] += list(list("entry" = i)) - data["ntnetmaxlogs"] = SSnetworks.station_network.setting_maxlogcount return data diff --git a/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm b/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm index 2b4ff9577833..9cec4ec6067b 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/powermonitor.dm @@ -3,7 +3,7 @@ /datum/computer_file/program/power_monitor filename = "powermonitor" filedesc = "Power Monitor" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING program_icon_state = "power_monitor" extended_desc = "This program connects to sensors around the station to provide information about electrical systems." ui_header = "power_norm.gif" diff --git a/code/modules/modular_computers/file_system/programs/engineering/reactor_monitor.dm b/code/modules/modular_computers/file_system/programs/engineering/reactor_monitor.dm index aa243b84812e..e0cc8bc198d9 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/reactor_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/reactor_monitor.dm @@ -2,7 +2,7 @@ /datum/computer_file/program/nuclear_monitor filename = "agcnrmonitor" filedesc = "Nuclear Reactor Monitoring" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING ui_header = "smmon_0.gif" program_icon_state = "smmon_0" extended_desc = "This program connects to specially calibrated sensors to provide information on the status of nuclear reactors." diff --git a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm index 7157b82ee0c1..ace9b19eff09 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/supermatter_monitor filename = "smmonitor" filedesc = "Supermatter Monitoring" - category = PROGRAM_CATEGORY_ENGI + category = PROGRAM_CATEGORY_ENGINEERING ui_header = "smmon_0.gif" program_icon_state = "smmon_0" extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines." diff --git a/code/modules/modular_computers/file_system/programs/medical/chem_scan.dm b/code/modules/modular_computers/file_system/programs/medical/chem_scan.dm index 9230f629f095..2af13758bd5c 100644 --- a/code/modules/modular_computers/file_system/programs/medical/chem_scan.dm +++ b/code/modules/modular_computers/file_system/programs/medical/chem_scan.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/chemscan filename = "chemscan" filedesc = "Chemical Scanner" - category = PROGRAM_CATEGORY_MED + category = PROGRAM_CATEGORY_DEVICE program_icon_state = "air" extended_desc = "A small built-in sensor reads out the chemicals in an item." network_destination = "chem scan" diff --git a/code/modules/modular_computers/file_system/programs/medical/crew_monitor.dm b/code/modules/modular_computers/file_system/programs/medical/crew_monitor.dm index 6723782e10d6..ce5cb87f9221 100644 --- a/code/modules/modular_computers/file_system/programs/medical/crew_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/medical/crew_monitor.dm @@ -2,7 +2,7 @@ filename = "crewmon" filedesc = "Crew Suit Sensor Monitor" extended_desc = "This program allows for viewing of crew members vitals via their suit sensors." - category = PROGRAM_CATEGORY_MED + category = PROGRAM_CATEGORY_EQUIPMENT ui_header = "health_green.gif" program_icon_state = "crew" requires_ntnet = FALSE diff --git a/code/modules/modular_computers/file_system/programs/minesweeper.dm b/code/modules/modular_computers/file_system/programs/minesweeper.dm index 240e593fc382..802a93ca97ba 100644 --- a/code/modules/modular_computers/file_system/programs/minesweeper.dm +++ b/code/modules/modular_computers/file_system/programs/minesweeper.dm @@ -14,6 +14,7 @@ program_icon_state = "arcade" extended_desc = "A port of the classic game 'Minesweeper', redesigned to run on tablets." requires_ntnet = FALSE + category = PROGRAM_CATEGORY_GAMES network_destination = "arcade network" size = 6 tgui_id = "NtosMinesweeper" diff --git a/code/modules/modular_computers/file_system/programs/ntdownloader.dm b/code/modules/modular_computers/file_system/programs/ntdownloader.dm index a78819409b57..28d3d47048cc 100644 --- a/code/modules/modular_computers/file_system/programs/ntdownloader.dm +++ b/code/modules/modular_computers/file_system/programs/ntdownloader.dm @@ -21,25 +21,18 @@ var/downloaderror = "" var/obj/item/modular_computer/my_computer = null var/emagged = FALSE - var/list/main_repo - var/list/antag_repo - var/list/show_categories = list( - PROGRAM_CATEGORY_CMD, - PROGRAM_CATEGORY_SEC, - PROGRAM_CATEGORY_ENGI, - PROGRAM_CATEGORY_SCI, - PROGRAM_CATEGORY_MED, - PROGRAM_CATEGORY_SUPL, - PROGRAM_CATEGORY_MISC, + ///The list of categories to display in the UI, in order of which they appear. + var/static/list/show_categories = list( + PROGRAM_CATEGORY_DEVICE, + PROGRAM_CATEGORY_EQUIPMENT, + PROGRAM_CATEGORY_GAMES, + PROGRAM_CATEGORY_SECURITY, + PROGRAM_CATEGORY_ENGINEERING, + PROGRAM_CATEGORY_SUPPLY, + PROGRAM_CATEGORY_SCIENCE, ) - -/datum/computer_file/program/ntnetdownload/run_program() - . = ..() - main_repo = SSnetworks.station_network.available_station_software - antag_repo = SSnetworks.station_network.available_antag_software - /datum/computer_file/program/ntnetdownload/run_emag() if(emagged) return FALSE @@ -49,7 +42,7 @@ if(downloaded_file) return FALSE - var/datum/computer_file/program/PRG = SSnetworks.station_network.find_ntnet_file_by_name(filename) + var/datum/computer_file/program/PRG = SSmodular_computers.find_ntnet_file_by_name(filename) if(!PRG || !istype(PRG)) return FALSE @@ -65,10 +58,10 @@ ui_header = "downloader_running.gif" - if(PRG in main_repo) + if(PRG in SSmodular_computers.available_station_software) generate_network_log("Began downloading file [PRG.filename].[PRG.filetype] from NTNet Software Repository.") hacked_download = FALSE - else if(PRG in antag_repo) + else if(PRG in SSmodular_computers.available_antag_software) generate_network_log("Began downloading file **ENCRYPTED**.[PRG.filetype] from unspecified server.") hacked_download = TRUE else @@ -123,7 +116,7 @@ if(ntnet_status != 3) // Ethernet unaffected by distance var/dist = 100 // Loop through every ntnet relay, find the closest one and use that - for(var/obj/machinery/ntnet_relay/n in SSnetworks.station_network.relays) + for(var/obj/machinery/ntnet_relay/n as anything in SSmachines.get_machines_by_type(/obj/machinery/ntnet_relay)) var/cur_dist = get_dist_euclidian(n, computer) if(n.is_operational() && cur_dist <= dist) dist = cur_dist @@ -151,15 +144,14 @@ return FALSE /datum/computer_file/program/ntnetdownload/ui_data(mob/user) + var/list/data = get_header_data() my_computer = computer if(!istype(my_computer)) - return + return data var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD] var/list/access = card_slot?.GetAccess() - var/list/data = get_header_data() - data["downloading"] = !!downloaded_file data["error"] = downloaderror || FALSE @@ -176,34 +168,31 @@ data["disk_used"] = hard_drive.used_capacity data["emagged"] = emagged - var/list/repo = antag_repo | main_repo - var/list/program_categories = list() + var/list/repo = SSmodular_computers.available_antag_software | SSmodular_computers.available_station_software - for(var/I in repo) - var/datum/computer_file/program/P = I - if(!(P.category in program_categories)) - program_categories.Add(P.category) + data["programs"] = list() + for(var/datum/computer_file/program/programs as anything in repo) data["programs"] += list(list( - "icon" = P.program_icon, - "filename" = P.filename, - "filedesc" = P.filedesc, - "fileinfo" = P.extended_desc, - "category" = P.category, - "installed" = !!hard_drive.find_file_by_name(P.filename), - "compatible" = check_compatibility(P), - "size" = P.size, - "access" = emagged ? TRUE : P.can_run(user,transfer = 1, access = access), - "verifiedsource" = P.available_on_ntnet, + "icon" = programs.program_icon, + "filename" = programs.filename, + "filedesc" = programs.filedesc, + "fileinfo" = programs.extended_desc, + "category" = programs.category, + "installed" = !!hard_drive.find_file_by_name(programs.filename), + "compatible" = check_compatibility(programs), + "size" = programs.size, + "access" = programs.can_run(user, transfer = TRUE, access = access), + "verifiedsource" = programs.available_on_ntnet, )) - data["categories"] = show_categories & program_categories + data["categories"] = show_categories return data /datum/computer_file/program/ntnetdownload/proc/check_compatibility(datum/computer_file/program/P) var/hardflag = computer.hardware_flag - if(P && P.is_supported_by_hardware(hardflag,0)) + if(P && P.is_supported_by_hardware(hardflag, 0)) return TRUE return FALSE @@ -230,8 +219,3 @@ ui_header = "downloader_finished.gif" tgui_id = "NtosNetDownloader" emagged = TRUE - -/datum/computer_file/program/ntnetdownload/syndicate/run_program() - . = ..() - main_repo = SSnetworks.station_network.available_antag_software - antag_repo = null 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 cee95e296d6a..703bd45168af 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/chatclient filename = "ntnrc_client" filedesc = "Chat Client" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_DEVICE program_icon_state = "command" extended_desc = "This program allows communication over NTNRC network" size = 8 @@ -27,7 +27,7 @@ if(..()) return - var/datum/ntnet_conversation/channel = SSnetworks.station_network.get_chat_channel_by_id(active_channel) + var/datum/ntnet_conversation/channel = SSmodular_computers.get_chat_channel_by_id(active_channel) var/authed = FALSE computer.play_interact_sound() if(channel && ((channel.operator == src) || netadmin_mode)) @@ -69,7 +69,7 @@ return TRUE active_channel = new_target - channel = SSnetworks.station_network.get_chat_channel_by_id(new_target) + channel = SSmodular_computers.get_chat_channel_by_id(new_target) if(!(src in channel.clients) && !channel.password) channel.add_client(src) return TRUE @@ -107,7 +107,7 @@ return TRUE var/mob/living/user = usr if(can_run(user, TRUE, ACCESS_NETWORK)) - for(var/C in SSnetworks.station_network.chat_channels) + for(var/C in SSmodular_computers.chat_channels) var/datum/ntnet_conversation/chan = C chan.remove_client(src) netadmin_mode = TRUE @@ -127,7 +127,7 @@ log_say(log_message) return //yogs end - for(var/C in SSnetworks.station_network.chat_channels) + for(var/C in SSmodular_computers.chat_channels) var/datum/ntnet_conversation/chan = C if(src in chan.clients) chan.add_status_message("[username] is now known as [newname].") @@ -206,7 +206,7 @@ /datum/computer_file/program/chatclient/process_tick() . = ..() - var/datum/ntnet_conversation/channel = SSnetworks.station_network.get_chat_channel_by_id(active_channel) + var/datum/ntnet_conversation/channel = SSmodular_computers.get_chat_channel_by_id(active_channel) if(program_state != PROGRAM_STATE_KILLED) ui_header = "ntnrc_idle.gif" if(channel) @@ -221,7 +221,7 @@ ui_header = "ntnrc_idle.gif" /datum/computer_file/program/chatclient/kill_program(forced = FALSE) - for(var/C in SSnetworks.station_network.chat_channels) + for(var/C in SSmodular_computers.chat_channels) var/datum/ntnet_conversation/channel = C channel.remove_client(src) ..() @@ -232,7 +232,7 @@ return data /datum/computer_file/program/chatclient/ui_data(mob/user) - if(!SSnetworks.station_network || !SSnetworks.station_network.chat_channels) + if(!SSmodular_computers || !SSmodular_computers.chat_channels) return list() var/list/data = list() @@ -240,7 +240,7 @@ data = get_header_data() var/list/all_channels = list() - for(var/C in SSnetworks.station_network.chat_channels) + for(var/C in SSmodular_computers.chat_channels) var/datum/ntnet_conversation/conv = C if(conv && conv.title) all_channels.Add(list(list( @@ -252,7 +252,7 @@ data["active_channel"] = active_channel data["username"] = username data["adminmode"] = netadmin_mode - var/datum/ntnet_conversation/channel = SSnetworks.station_network.get_chat_channel_by_id(active_channel) + var/datum/ntnet_conversation/channel = SSmodular_computers.get_chat_channel_by_id(active_channel) if(channel) data["title"] = channel.title var/authed = FALSE diff --git a/code/modules/modular_computers/file_system/programs/ntpda_msg.dm b/code/modules/modular_computers/file_system/programs/ntpda_msg.dm index 87c591afde9b..5dd70dea1827 100644 --- a/code/modules/modular_computers/file_system/programs/ntpda_msg.dm +++ b/code/modules/modular_computers/file_system/programs/ntpda_msg.dm @@ -7,7 +7,7 @@ GLOBAL_LIST_EMPTY(NTPDAMessages) /datum/computer_file/program/pdamessager filename = "pda_client" filedesc = "PDA Messaging" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_DEVICE program_icon_state = "command" extended_desc = "This program allows for direct messaging with other modular computers" size = 3 diff --git a/code/modules/modular_computers/file_system/programs/paperworkprinter.dm b/code/modules/modular_computers/file_system/programs/paperworkprinter.dm index 6d560c92f3c2..938b34507e2c 100644 --- a/code/modules/modular_computers/file_system/programs/paperworkprinter.dm +++ b/code/modules/modular_computers/file_system/programs/paperworkprinter.dm @@ -2,7 +2,7 @@ /datum/computer_file/program/paperwork_printer filename = "ppwrkprnt" filedesc = "Paperwork Printing" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "id" extended_desc = "Program for dispensing paperwork." requires_ntnet = FALSE diff --git a/code/modules/modular_computers/file_system/programs/portrait_printer.dm b/code/modules/modular_computers/file_system/programs/portrait_printer.dm index 95bd71cb097b..04bfcec2ba9f 100644 --- a/code/modules/modular_computers/file_system/programs/portrait_printer.dm +++ b/code/modules/modular_computers/file_system/programs/portrait_printer.dm @@ -15,6 +15,7 @@ extended_desc = "This program connects to a Spinward Sector community art site for viewing and printing art." transfer_access = ACCESS_LIBRARY usage_flags = PROGRAM_CONSOLE | PROGRAM_TELESCREEN + category = PROGRAM_CATEGORY_EQUIPMENT requires_ntnet = TRUE size = 9 tgui_id = "NtosPortraitPrinter" diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm index 4392f850bc92..49e91e6ff6c7 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -219,7 +219,7 @@ requires_ntnet = FALSE //Tracking should not require NTNET, as sensors are not on the network at all, and the program is downloaded locally. transfer_access = ACCESS_MEDICAL available_on_ntnet = TRUE - category = PROGRAM_CATEGORY_MED + category = PROGRAM_CATEGORY_EQUIPMENT program_icon = "street-view" /datum/computer_file/program/radar/lifeline/find_atom() @@ -275,7 +275,7 @@ /datum/computer_file/program/radar/fission360 filename = "Fission360" filedesc = "Fission360" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_EQUIPMENT program_icon_state = "radarsyndicate" extended_desc = "This program allows for tracking of nuclear authorization disks and warheads." requires_ntnet = FALSE @@ -321,7 +321,7 @@ /datum/computer_file/program/radar/implant filename = "implanttracker" filedesc = "Implant Tracker" - category = PROGRAM_CATEGORY_SEC + category = PROGRAM_CATEGORY_SECURITY extended_desc = "This program allows for tracking those implanted with tracking implants." requires_ntnet = FALSE //Same as Lifeline. transfer_access = ACCESS_BRIG diff --git a/code/modules/modular_computers/file_system/programs/robotact.dm b/code/modules/modular_computers/file_system/programs/robotact.dm index 46e277f876f1..170bd412494b 100644 --- a/code/modules/modular_computers/file_system/programs/robotact.dm +++ b/code/modules/modular_computers/file_system/programs/robotact.dm @@ -4,6 +4,7 @@ extended_desc = "A built-in app for cyborg self-management and diagnostics." ui_header = "robotact.gif" //DEBUG -- new icon before PR program_icon_state = "command" + category = PROGRAM_CATEGORY_SCIENCE requires_ntnet = FALSE transfer_access = null available_on_ntnet = FALSE diff --git a/code/modules/modular_computers/file_system/programs/science/airestorer.dm b/code/modules/modular_computers/file_system/programs/science/airestorer.dm index 4251db214748..93e07b556016 100644 --- a/code/modules/modular_computers/file_system/programs/science/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/science/airestorer.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/aidiag filename = "aidiag" filedesc = "AI Integrity Restorer" - category = PROGRAM_CATEGORY_SCI + category = PROGRAM_CATEGORY_SCIENCE program_icon_state = "generic" extended_desc = "This program is capable of reconstructing damaged AI systems. Requires direct AI connection via intellicard slot." size = 12 diff --git a/code/modules/modular_computers/file_system/programs/science/borg_monitor.dm b/code/modules/modular_computers/file_system/programs/science/borg_monitor.dm index 908507bfa44d..5eaa6d7103f0 100644 --- a/code/modules/modular_computers/file_system/programs/science/borg_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/science/borg_monitor.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/borg_monitor filename = "cyborgmonitor" filedesc = "Cyborg Remote Monitoring" - category = PROGRAM_CATEGORY_SCI + category = PROGRAM_CATEGORY_SCIENCE ui_header = "borg_mon.gif" program_icon_state = "generic" extended_desc = "This program allows for remote monitoring of station cyborgs." @@ -166,7 +166,7 @@ /datum/computer_file/program/borg_monitor/syndicate filename = "scyborgmonitor" filedesc = "Mission-Specific Cyborg Remote Monitoring" - category = PROGRAM_CATEGORY_SCI + category = PROGRAM_CATEGORY_SCIENCE ui_header = "borg_mon.gif" program_icon_state = "generic" extended_desc = "This program allows for remote monitoring of mission-assigned cyborgs." diff --git a/code/modules/modular_computers/file_system/programs/science/robocontrol.dm b/code/modules/modular_computers/file_system/programs/science/robocontrol.dm index 4939ffdb1213..b0b2e6da751c 100644 --- a/code/modules/modular_computers/file_system/programs/science/robocontrol.dm +++ b/code/modules/modular_computers/file_system/programs/science/robocontrol.dm @@ -2,7 +2,7 @@ /datum/computer_file/program/robocontrol filename = "robocontrol" filedesc = "Bot Remote Controller" - category = PROGRAM_CATEGORY_SCI + category = PROGRAM_CATEGORY_SCIENCE program_icon_state = "robot" extended_desc = "A remote controller used for giving basic commands to non-sentient robots." requires_ntnet = TRUE diff --git a/code/modules/modular_computers/file_system/programs/security/secureye.dm b/code/modules/modular_computers/file_system/programs/security/secureye.dm index 48849842650d..ffe879516795 100644 --- a/code/modules/modular_computers/file_system/programs/security/secureye.dm +++ b/code/modules/modular_computers/file_system/programs/security/secureye.dm @@ -4,7 +4,7 @@ /datum/computer_file/program/secureye filename = "secureye" filedesc = "SecurEye" - category = PROGRAM_CATEGORY_SEC + category = PROGRAM_CATEGORY_SECURITY ui_header = "borg_mon.gif" program_icon_state = "generic" extended_desc = "This program allows access to standard security camera networks." @@ -186,7 +186,7 @@ /datum/computer_file/program/secureye/mining filename = "overwatch" filedesc = "OverWatch" - category = PROGRAM_CATEGORY_SUPL + category = PROGRAM_CATEGORY_SUPPLY extended_desc = "This program allows access to the mining base camera network." transfer_access = ACCESS_MINING size = 5 diff --git a/code/modules/modular_computers/file_system/programs/supply/bounty_board.dm b/code/modules/modular_computers/file_system/programs/supply/bounty_board.dm index 68f6f51add67..94e1c14b372e 100644 --- a/code/modules/modular_computers/file_system/programs/supply/bounty_board.dm +++ b/code/modules/modular_computers/file_system/programs/supply/bounty_board.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/bounty_board filename = "bountyboard" filedesc = "Bounty Board Request Network" - category = PROGRAM_CATEGORY_SUPL + category = PROGRAM_CATEGORY_SUPPLY program_icon_state = "bountyboard" extended_desc = "A multi-platform network for placing requests across the station, with payment across the network being possible." requires_ntnet = TRUE diff --git a/code/modules/modular_computers/file_system/programs/supply/budgetordering.dm b/code/modules/modular_computers/file_system/programs/supply/budgetordering.dm index 205e006f48bd..75f5201f26a1 100644 --- a/code/modules/modular_computers/file_system/programs/supply/budgetordering.dm +++ b/code/modules/modular_computers/file_system/programs/supply/budgetordering.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/budgetorders filename = "orderapp" filedesc = "NT IRN" - category = PROGRAM_CATEGORY_SUPL + category = PROGRAM_CATEGORY_SUPPLY program_icon_state = "bountyboard" extended_desc = "Nanotrasen Internal Requisition Network interface for supply purchasing using a department budget account." requires_ntnet = TRUE diff --git a/code/modules/modular_computers/file_system/programs/supply/cargobounty.dm b/code/modules/modular_computers/file_system/programs/supply/cargobounty.dm index 826a43728368..cd4c867db513 100644 --- a/code/modules/modular_computers/file_system/programs/supply/cargobounty.dm +++ b/code/modules/modular_computers/file_system/programs/supply/cargobounty.dm @@ -1,7 +1,7 @@ /datum/computer_file/program/cargobounty filename = "bounty" filedesc = "Nanotrasen Bounty Hunter" - category = PROGRAM_CATEGORY_SUPL + category = PROGRAM_CATEGORY_SUPPLY program_icon_state = "bountyboard" extended_desc = "A basic interface for supply personnel to check and claim bounties." requires_ntnet = TRUE diff --git a/code/modules/modular_computers/file_system/programs/themeify.dm b/code/modules/modular_computers/file_system/programs/themeify.dm index 8878a65dd81b..b4dc044a2bae 100644 --- a/code/modules/modular_computers/file_system/programs/themeify.dm +++ b/code/modules/modular_computers/file_system/programs/themeify.dm @@ -8,6 +8,7 @@ size = 2 available_on_ntnet = TRUE requires_ntnet = FALSE + category = PROGRAM_CATEGORY_DEVICE tgui_id = "NtosThemeConfigure" program_icon="paint-roller" diff --git a/code/modules/modular_computers/hardware/network_card.dm b/code/modules/modular_computers/hardware/network_card.dm index a702df3ea7eb..5c4e1fa50de4 100644 --- a/code/modules/modular_computers/hardware/network_card.dm +++ b/code/modules/modular_computers/hardware/network_card.dm @@ -33,16 +33,16 @@ // 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection /obj/item/computer_hardware/network_card/proc/get_signal(specific_action = 0) if(!holder) // Hardware is not installed in anything. No signal. How did this even get called? - return 0 + return NTNET_NO_SIGNAL if(!check_functionality()) - return 0 + return NTNET_NO_SIGNAL if(ethernet) // Computer is connected via wired connection. - return 3 + return NTNET_ETHERNET_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(!SSmodular_computers || !SSmodular_computers.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal. + return NTNET_NO_SIGNAL if(holder) @@ -50,14 +50,14 @@ if((T && istype(T)) && (is_station_level(T.z) || is_mining_level(T.z))) // Computer is on station. Low/High signal depending on what type of network card you have if(long_range) - return 2 + return NTNET_GOOD_SIGNAL else - return 1 + return NTNET_LOW_SIGNAL if(long_range) // Computer is not on station, but it has upgraded network card. Low signal. - return 1 + return NTNET_LOW_SIGNAL - return 0 // Computer is not on station and does not have upgraded network card. No signal. + return NTNET_NO_SIGNAL // Computer is not on station and does not have upgraded network card. No signal. /obj/item/computer_hardware/network_card/advanced diff --git a/tgui/packages/tgui/interfaces/NtosNetMonitor.js b/tgui/packages/tgui/interfaces/NtosNetMonitor.js index f0aaad2231a8..8648d654e079 100644 --- a/tgui/packages/tgui/interfaces/NtosNetMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosNetMonitor.js @@ -8,14 +8,9 @@ export const NtosNetMonitor = (props, context) => { ntnetrelays, ntnetstatus, config_softwaredownload, - config_peertopeer, config_communication, - config_systemcontrol, idsalarm, idsstatus, - ntnetmaxlogs, - maxlogs, - minlogs, ntnetlogs = [], } = data; return ( @@ -34,13 +29,23 @@ export const NtosNetMonitor = (props, context) => { selected={ntnetstatus} onClick={() => act('toggleWireless')} /> )}> - {ntnetrelays ? ( - - - {ntnetrelays} - - - ) : "No Relays Connected"} + {ntnetrelays.map((relay) => ( +
+ act('toggle_relay', { + ref: relay.ref, + }) + } + /> + } + /> + ))}
@@ -53,15 +58,6 @@ export const NtosNetMonitor = (props, context) => { selected={config_softwaredownload} onClick={() => act('toggle_function', { id: "1" })} /> )} /> - act('toggle_function', { id: "2" })} /> - )} /> { selected={config_communication} onClick={() => act('toggle_function', { id: "3" })} /> )} /> - act('toggle_function', { id: "4" })} /> - )} />
@@ -111,19 +98,6 @@ export const NtosNetMonitor = (props, context) => { onClick={() => act('resetIDS')} /> )} /> - act('updatemaxlogs', { - new_number: value, - })} - /> - )} />