Ports some modular computer stuff from baystation

This commit is contained in:
Casey
2022-06-30 23:58:24 -04:00
committed by CHOMPStation2
parent a34b97046c
commit e1edec79c8
51 changed files with 460 additions and 111 deletions

View File

@@ -173,3 +173,17 @@ if (!(DATUM.datum_flags & DF_ISPROCESSING)) {\
#define LOGIN_TYPE_NORMAL 1 #define LOGIN_TYPE_NORMAL 1
#define LOGIN_TYPE_AI 2 #define LOGIN_TYPE_AI 2
#define LOGIN_TYPE_ROBOT 3 #define LOGIN_TYPE_ROBOT 3
// Computer Hardware
#define PART_CPU /obj/item/weapon/computer_hardware/processor_unit // CPU. Without it the computer won't run. Better CPUs can run more programs at once.
#define PART_NETWORK /obj/item/weapon/computer_hardware/network_card // Network Card component of this computer. Allows connection to NTNet
#define PART_HDD /obj/item/weapon/computer_hardware/hard_drive // Hard Drive component of this computer. Stores programs and files.
// Optional hardware (improves functionality, but is not critical for computer to work in most cases)
#define PART_BATTERY /obj/item/weapon/computer_hardware/battery_module // An internal power source for this computer. Can be recharged.
#define PART_CARD /obj/item/weapon/computer_hardware/card_slot // ID Card slot component of this computer. Mostly for HoP modification console that needs ID slot for modification.
#define PART_PRINTER /obj/item/weapon/computer_hardware/nano_printer // Nano Printer component of this computer, for your everyday paperwork needs.
//#define PART_DRIVE /obj/item/weapon/computer_hardware/hard_drive/portable // Portable data storage
//#define PART_AI /obj/item/weapon/computer_hardware/ai_slot // AI slot, an intellicard housing that allows modifications of AIs.
#define PART_TESLA /obj/item/weapon/computer_hardware/tesla_link // Tesla Link, Allows remote charging from nearest APC.
//#define PART_SCANNER /obj/item/weapon/computer_hardware/scanner // One of several optional scanner attachments.

View File

@@ -149,10 +149,25 @@
#define PROGRAM_STATE_BACKGROUND 1 #define PROGRAM_STATE_BACKGROUND 1
#define PROGRAM_STATE_ACTIVE 2 #define PROGRAM_STATE_ACTIVE 2
#define PROG_MISC "Miscellaneous"
#define PROG_ENG "Engineering"
#define PROG_OFFICE "Office Work"
#define PROG_COMMAND "Command"
#define PROG_SUPPLY "Supply and Shuttles"
#define PROG_ADMIN "NTNet Administration"
#define PROG_UTIL "Utility"
#define PROG_SEC "Security"
#define PROG_MONITOR "Monitoring"
// 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. // 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 500 #define MAX_NTNET_LOGS 500
#define MIN_NTNET_LOGS 10 #define MIN_NTNET_LOGS 10
//Built-in email accounts
#define EMAIL_DOCUMENTS "document.server@virgo.local"
#define EMAIL_SYSADMIN "admin@virgo.local"
#define EMAIL_BROADCAST "broadcast@virgo.local"
// Special return values from bullet_act(). Positive return values are already used to indicate the blocked level of the projectile. // Special return values from bullet_act(). Positive return values are already used to indicate the blocked level of the projectile.
#define PROJECTILE_CONTINUE -1 //if the projectile should continue flying after calling bullet_act() #define PROJECTILE_CONTINUE -1 //if the projectile should continue flying after calling bullet_act()

View File

@@ -217,6 +217,17 @@ This actually tests if they have the same entries and values.
return 0 return 0
return 1 return 1
/*
Checks if a list has the same entries and values as an element of big.
*/
/proc/in_as_list(var/list/little, var/list/big)
if(!islist(big))
return 0
for(var/element in big)
if(same_entries(little, element))
return 1
return 0
/* /*
* Returns list containing entries that are in either list but not both. * Returns list containing entries that are in either list but not both.
* If skipref = 1, repeated elements are treated as one. * If skipref = 1, repeated elements are treated as one.
@@ -870,4 +881,3 @@ var/global/list/json_cache = list()
else else
used_key_list[input_key] = 1 used_key_list[input_key] = 1
return input_key return input_key

View File

@@ -6,6 +6,16 @@
return number return number
return default return default
// Checks if the given input is a valid list index; returns true/false and doesn't change anything.
/proc/is_valid_index(input, list/given_list)
if(!isnum(input))
return FALSE
if(input != round(input))
return FALSE
if(input < 1 || input > length(given_list))
return FALSE
return TRUE
/proc/sanitize_text(text, default="") /proc/sanitize_text(text, default="")
if(istext(text)) if(istext(text))
return text return text
@@ -44,3 +54,60 @@
if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase if(65 to 70) . += ascii2text(ascii+32) //letters A to F - translates to lowercase
else return default else return default
return . return .
//Valid format codes: YY, YEAR, MM, DD, hh, mm, ss, :, -. " " (space). Invalid format will return default.
/proc/sanitize_time(time, default, format = "hh:mm")
if(!istext(time) || !(length(time) == length(format)))
return default
var/fragment = ""
. = list()
for(var/i = 1, i <= length(format), i++)
fragment += copytext(format,i,i+1)
if(fragment in list("YY", "YEAR", "MM", "DD", "hh", "mm", "ss"))
. += sanitize_one_time(copytext(time, i - length(fragment) + 1, i + 1), copytext(default, i - length(fragment) + 1, i + 1), fragment)
fragment = ""
else if(fragment in list(":", "-", " "))
. += fragment
fragment = ""
if(fragment)
return default //This means the format was improper.
return JOINTEXT(.)
//Internal proc, expects valid format and text input of equal length to format.
/proc/sanitize_one_time(input, default, format)
var/list/ainput = list()
for(var/i = 1, i <= length(input), i++)
ainput += text2ascii(input, i)
switch(format)
if("YY")
if(!(ainput[1] in 48 to 57) || !(ainput[2] in 48 to 57))//0 to 9
return (default || "00")
return input
if("YEAR")
for(var/i = 1, i <= 4, i++)
if(!(ainput[i] in 48 to 57))//0 to 9
return (default || "0000")
return input
if("MM")
var/early = (ainput[1] == 48) && (ainput[2] in 49 to 57) //01 to 09
var/late = (ainput[1] == 49) && (ainput[2] in 48 to 50) //10 to 12
if(!(early || late))
return (default || "01")
return input
if("DD")
var/early = (ainput[1] == 48) && (ainput[2] in 49 to 57) //01 to 09
var/mid = (ainput[1] in 49 to 50) && (ainput[2] in 48 to 57) //10 to 29
var/late = (ainput[1] == 51) && (ainput[2] in 48 to 49) //30 to 31
if(!(early || mid || late))
return (default || "01")
return input
if("hh")
var/early = (ainput[1] in 48 to 49) && (ainput[2] in 48 to 57) //00 to 19
var/late = (ainput[1] == 50) && (ainput[2] in 48 to 51) //20 to 23
if(!(early || late))
return (default || "00")
return input
if("mm", "ss")
if(!(ainput[1] in 48 to 53) || !(ainput[2] in 48 to 57)) //0 to 5, 0 to 9
return (default || "00")
return input

View File

@@ -410,6 +410,58 @@
t = replacetext(t, "\[editorbr\]", "") t = replacetext(t, "\[editorbr\]", "")
return t return t
//pencode translation to html for tags exclusive to digital files (currently email, nanoword, report editor fields,
//modular scanner data and txt file printing) and prints from them
/proc/digitalPencode2html(var/text)
text = replacetext(text, "\[pre\]", "<pre>")
text = replacetext(text, "\[/pre\]", "</pre>")
text = replacetext(text, "\[fontred\]", "<font color=\"red\">") //</font> to pass html tag integrity unit test
text = replacetext(text, "\[fontblue\]", "<font color=\"blue\">")//</font> to pass html tag integrity unit test
text = replacetext(text, "\[fontgreen\]", "<font color=\"green\">")
text = replacetext(text, "\[/font\]", "</font>")
text = replacetext(text, "\[redacted\]", "<span class=\"redacted\">R E D A C T E D</span>")
return pencode2html(text)
//Will kill most formatting; not recommended.
/proc/html2pencode(t)
t = replacetext(t, "<pre>", "\[pre\]")
t = replacetext(t, "</pre>", "\[/pre\]")
t = replacetext(t, "<font color=\"red\">", "\[fontred\]")//</font> to pass html tag integrity unit test
t = replacetext(t, "<font color=\"blue\">", "\[fontblue\]")//</font> to pass html tag integrity unit test
t = replacetext(t, "<font color=\"green\">", "\[fontgreen\]")
t = replacetext(t, "</font>", "\[/font\]")
t = replacetext(t, "<BR>", "\[br\]")
t = replacetext(t, "<br>", "\[br\]")
t = replacetext(t, "<B>", "\[b\]")
t = replacetext(t, "</B>", "\[/b\]")
t = replacetext(t, "<I>", "\[i\]")
t = replacetext(t, "</I>", "\[/i\]")
t = replacetext(t, "<U>", "\[u\]")
t = replacetext(t, "</U>", "\[/u\]")
t = replacetext(t, "<center>", "\[center\]")
t = replacetext(t, "</center>", "\[/center\]")
t = replacetext(t, "<H1>", "\[h1\]")
t = replacetext(t, "</H1>", "\[/h1\]")
t = replacetext(t, "<H2>", "\[h2\]")
t = replacetext(t, "</H2>", "\[/h2\]")
t = replacetext(t, "<H3>", "\[h3\]")
t = replacetext(t, "</H3>", "\[/h3\]")
t = replacetext(t, "<li>", "\[*\]")
t = replacetext(t, "<HR>", "\[hr\]")
t = replacetext(t, "<ul>", "\[list\]")
t = replacetext(t, "</ul>", "\[/list\]")
t = replacetext(t, "<table>", "\[grid\]")
t = replacetext(t, "</table>", "\[/grid\]")
t = replacetext(t, "<tr>", "\[row\]")
t = replacetext(t, "<td>", "\[cell\]")
t = replacetext(t, "<img src = ntlogo.png>", "\[logo\]")
t = replacetext(t, "<img src = redntlogo.png>", "\[redlogo\]")
t = replacetext(t, "<img src = sglogo.png>", "\[sglogo\]")
t = replacetext(t, "<span class=\"paper_field\"></span>", "\[field\]")
t = replacetext(t, "<span class=\"redacted\">R E D A C T E D</span>", "\[redacted\]")
t = strip_html_properly(t)
return t
// Random password generator // Random password generator
/proc/GenerateKey() /proc/GenerateKey()
//Feel free to move to Helpers. //Feel free to move to Helpers.

View File

@@ -43,3 +43,5 @@
#define WORLD_ICON_SIZE 32 //Needed for the R-UST port #define WORLD_ICON_SIZE 32 //Needed for the R-UST port
#define PIXEL_MULTIPLIER WORLD_ICON_SIZE/32 //Needed for the R-UST port #define PIXEL_MULTIPLIER WORLD_ICON_SIZE/32 //Needed for the R-UST port
#define JOINTEXT(X) jointext(X, null)

View File

@@ -10,21 +10,30 @@ var/global/datum/ntnet/ntnet_global = new()
var/list/available_news = list() var/list/available_news = list()
var/list/chat_channels = list() var/list/chat_channels = list()
var/list/fileservers = list() var/list/fileservers = list()
var/list/email_accounts = list() // I guess we won't have more than 999 email accounts active at once in single round, so this will do until Servers are implemented someday. /// Holds all the email accounts that exists. Hopefully won't exceed 999
var/list/email_accounts = list()
var/list/banned_nids = list() var/list/banned_nids = list()
// Amount of logs the system tries to keep in memory. Keep below 999 to prevent byond from acting weirdly. /// A list of nid - os datum pairs. An OS in this list is not necessarily connected to NTNet or visible on it.
// High values make displaying logs much laggier. var/list/registered_nids = list()
/// Amount of log entries 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 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 /// Programs requiring NTNET_SOFTWAREDOWNLOAD won't work if this is set to FALSE and public-facing device they are connecting with is wireless.
var/setting_softwaredownload = 1 var/setting_softwaredownload = TRUE
var/setting_peertopeer = 1 /// Programs requiring NTNET_PEERTOPEER won't work if this is set to FALSE and public-facing device they are connecting with is wireless.
var/setting_communication = 1 var/setting_peertopeer = TRUE
var/setting_systemcontrol = 1 /// Programs requiring NTNET_COMMUNICATION won't work if this is set to FALSE and public-facing device they are connecting with is wireless.
var/setting_disabled = 0 // Setting to 1 will disable all wireless, independently on relays status. var/setting_communication = TRUE
/// Programs requiring NTNET_SYSTEMCONTROL won't work if this is set to FALSE and public-facing device they are connecting with is wireless.
var/setting_systemcontrol = TRUE
var/intrusion_detection_enabled = 1 // Whether the IDS warning system is enabled /// Setting to TRUE will disable all wireless connections, independently off relays status.
var/intrusion_detection_alarm = 0 // Set when there is an IDS warning due to malicious (antag) software. var/setting_disabled = FALSE
/// Whether the IDS warning system is enabled
var/intrusion_detection_enabled = TRUE
/// Set when there is an IDS warning due to malicious (antag) software.
var/intrusion_detection_alarm = FALSE
// If new NTNet datum is spawned, it replaces the old one. // If new NTNet datum is spawned, it replaces the old one.
@@ -62,7 +71,13 @@ var/global/datum/ntnet/ntnet_global = new()
else else
break break
/datum/ntnet/proc/check_banned(var/NID) /datum/ntnet/proc/get_os_by_nid(NID)
return registered_nids["[NID]"]
/datum/ntnet/proc/unregister(NID)
registered_nids -= "[NID]"
/datum/ntnet/proc/check_banned(NID)
if(!relays || !relays.len) if(!relays || !relays.len)
return FALSE return FALSE
@@ -138,10 +153,12 @@ var/global/datum/ntnet/ntnet_global = new()
// Resets the IDS alarm // Resets the IDS alarm
/datum/ntnet/proc/resetIDS() /datum/ntnet/proc/resetIDS()
intrusion_detection_alarm = 0 intrusion_detection_alarm = 0
add_log("-!- INTRUSION DETECTION ALARM RESET BY SYSTEM OPERATOR -!-")
/datum/ntnet/proc/toggleIDS() /datum/ntnet/proc/toggleIDS()
resetIDS() resetIDS()
intrusion_detection_enabled = !intrusion_detection_enabled intrusion_detection_enabled = !intrusion_detection_enabled
add_log("Configuration Updated. Intrusion Detection [intrusion_detection_enabled ? "enabled" : "disabled"].")
// Removes all logs // Removes all logs
/datum/ntnet/proc/purge_logs() /datum/ntnet/proc/purge_logs()
@@ -185,4 +202,3 @@ var/global/datum/ntnet/ntnet_global = new()
for(var/datum/ntnet_conversation/chan in chat_channels) for(var/datum/ntnet_conversation/chan in chat_channels)
if(chan.id == id) if(chan.id == id)
return chan return chan

View File

@@ -1,12 +1,22 @@
/datum/computer_file/data/email_account/ /datum/computer_file/data/email_account/
var/list/inbox = list() var/list/inbox = list()
var/list/outbox = list()
var/list/spam = list() var/list/spam = list()
var/list/deleted = list() var/list/deleted = list()
var/login = "" var/login = ""
var/password = "" var/password = ""
var/can_login = TRUE // Whether you can log in with this account. Set to false for system accounts /// Whether you can log in with this account. Set to FALSE for system accounts.
var/suspended = FALSE // Whether the account is banned by the SA. var/can_login = TRUE
/// Whether the account is banned by the SA.
var/suspended = FALSE
var/connected_clients = list()
var/fullname = "N/A"
var/assignment = "N/A"
var/notification_mute = FALSE
var/notification_sound = "*beep*"
/datum/computer_file/data/email_account/calculate_size() /datum/computer_file/data/email_account/calculate_size()
size = 1 size = 1
@@ -64,7 +74,28 @@
can_login = FALSE can_login = FALSE
/datum/computer_file/data/email_account/service/broadcaster/ /datum/computer_file/data/email_account/service/broadcaster/
login = "broadcast@internal-services.nt" login = EMAIL_BROADCAST
/datum/computer_file/data/email_account/service/broadcaster/receive_mail(var/datum/computer_file/data/email_message/received_message, var/relayed)
if(suspended || !istype(received_message) || relayed)
return FALSE
// Possibly exploitable for user spamming so keep admins informed.
if(!received_message.spam)
log_and_message_admins("Broadcast email address used by [usr]. Message title: [received_message.title].")
spawn(0)
for(var/datum/computer_file/data/email_account/email_account in ntnet_global.email_accounts)
var/datum/computer_file/data/email_message/new_message = received_message.clone()
send_mail(email_account.login, new_message, 1)
sleep(2)
return TRUE
/datum/computer_file/data/email_account/service/document
login = EMAIL_DOCUMENTS
/datum/computer_file/data/email_account/service/sysadmin
login = EMAIL_SYSADMIN
/datum/computer_file/data/email_account/service/broadcaster/receive_mail(var/datum/computer_file/data/email_message/received_message, var/relayed) /datum/computer_file/data/email_account/service/broadcaster/receive_mail(var/datum/computer_file/data/email_message/received_message, var/relayed)
if(!istype(received_message) || relayed) if(!istype(received_message) || relayed)

View File

@@ -54,3 +54,11 @@
var/obj/item/weapon/computer_hardware/hard_drive/portable/portable_drive // Portable data storage var/obj/item/weapon/computer_hardware/hard_drive/portable/portable_drive // Portable data storage
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot // AI slot, an intellicard housing that allows modifications of AIs. var/obj/item/weapon/computer_hardware/ai_slot/ai_slot // AI slot, an intellicard housing that allows modifications of AIs.
var/obj/item/weapon/computer_hardware/tesla_link/tesla_link // Tesla Link, Allows remote charging from nearest APC. var/obj/item/weapon/computer_hardware/tesla_link/tesla_link // Tesla Link, Allows remote charging from nearest APC.
var/modifiable = TRUE // can't be modified or damaged if false
var/stores_pen = FALSE
var/obj/item/weapon/pen/stored_pen
var/interact_sounds
var/interact_sound_volume = 40

View File

@@ -1,18 +1,35 @@
var/global/file_uid = 0 var/global/file_uid = 0
/datum/computer_file/ /datum/computer_file/
var/filename = "NewFile" // Placeholder. No spacebars /// Placeholder. Whitespace and most special characters are not allowed.
var/filetype = "XXX" // File full names are [filename].[filetype] so like NewFile.XXX in this case var/filename = "NewFile"
var/size = 1 // File size in GQ. Integers only! /// File full names are [filename].[filetype] so like NewFile.XXX in this case
var/obj/item/weapon/computer_hardware/hard_drive/holder // Holder that contains this file. var/filetype = "XXX"
var/unsendable = 0 // Whether the file may be sent to someone via NTNet transfer or other means. /// File size in GQ. Integers only!
var/undeletable = 0 // Whether the file may be deleted. Setting to 1 prevents deletion/renaming/etc. var/size = 1
var/uid // UID of this file /// Holder that contains this file.
var/obj/item/weapon/computer_hardware/hard_drive/holder
//// Whether the file may be sent to someone via NTNet transfer, email or other means.
var/unsendable = FALSE
/// Whether the file may be deleted. Setting to TRUE prevents deletion/renaming/etc.
var/undeletable = FALSE
/// Whether the file is hidden from view in the OS
var/hidden = FALSE
/// Protects files that should never be edited by the user due to special properties.
var/read_only = FALSE
/// UID of this file
var/uid
/// Any metadata the file uses.
var/list/metadata
/// Paper type to use for printing
var/papertype = /obj/item/weapon/paper
/datum/computer_file/New() /datum/computer_file/New(list/md = null)
..() ..()
uid = file_uid uid = file_uid
file_uid++ file_uid++
if(islist(md))
metadata = md.Copy()
/datum/computer_file/Destroy() /datum/computer_file/Destroy()
if(!holder) if(!holder)
@@ -30,7 +47,10 @@ var/global/file_uid = 0
var/datum/computer_file/temp = new type var/datum/computer_file/temp = new type
temp.unsendable = unsendable temp.unsendable = unsendable
temp.undeletable = undeletable temp.undeletable = undeletable
temp.hidden = hidden
temp.size = size temp.size = size
if(metadata)
temp.metadata = metadata.Copy()
if(rename) if(rename)
temp.filename = filename + "(Copy)" temp.filename = filename + "(Copy)"
else else

View File

@@ -1,10 +1,11 @@
// /data/ files store data in string format. // /data/ files store data in string format.
// They don't contain other logic for now. // They don't contain other logic for now.
/datum/computer_file/data /datum/computer_file/data
var/stored_data = "" // Stored data in string format.
filetype = "DAT" filetype = "DAT"
var/stored_data = "" // Stored data in string format.
var/block_size = 250 var/block_size = 250
var/do_not_edit = 0 // Whether the user will be reminded that the file probably shouldn't be edited. var/do_not_edit = FALSE // Whether the user will be reminded that the file probably shouldn't be edited.
/datum/computer_file/data/clone() /datum/computer_file/data/clone()
var/datum/computer_file/data/temp = ..() var/datum/computer_file/data/temp = ..()
@@ -15,5 +16,43 @@
/datum/computer_file/data/proc/calculate_size() /datum/computer_file/data/proc/calculate_size()
size = max(1, round(length(stored_data) / block_size)) size = max(1, round(length(stored_data) / block_size))
/datum/computer_file/data/proc/generate_file_data(mob/user)
return digitalPencode2html(stored_data)
/datum/computer_file/data/logfile /datum/computer_file/data/logfile
filetype = "LOG" filetype = "LOG"
/datum/computer_file/data/text
filetype = "TXT"
/// Mapping tool - creates a named modular computer file in a computer's storage on late initialize.
/// Use this to do things like automatic records and blackboxes. Alternative for paper records.
/// Values can be in the editor for each map or as a subtype.
/// This is an obj because raw atoms can't be placed in DM or third-party mapping tools.
///obj/effect/computer_file_creator
// name = "computer file creator"
// desc = "This is a mapping tool used for installing text files onto a modular device when it's mapped on top of them. If you see it, it's bugged."
// icon = 'icons/effects/landmarks.dmi'
// icon_state = "x3"
// anchored = TRUE
// unacidable = TRUE
// simulated = FALSE
// invisibility = 101
// /// The name that the file will have once it's created.
// var/file_name = "helloworld"
// /// The contents of this file. Uses paper formatting.
// var/file_info = "Hello World!"
///obj/effect/computer_file_creator/Initialize()
// . = ..()
// return INITIALIZE_HINT_LATELOAD
///obj/effect/computer_file_creator/LateInitialize()
// var/turf/T = get_turf(src)
// for (var/obj/O in T)
// if (!istype(O, /obj/machinery/computer/modular) && !istype(O, /obj/item/modular_computer))
// continue
// var/datum/extension/interactive/ntos/os = get_extension(O, /datum/extension/interactive/ntos)
// if (os)
// os.create_data_file(file_name, file_info, /datum/computer_file/data/text)
// qdel(src)

View File

@@ -1,30 +1,39 @@
// /program/ files are executable programs that do things. // /program/ files are executable programs that do things.
/datum/computer_file/program /datum/computer_file/program
filetype = "PRG"
filename = "UnknownProgram" // File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET! filename = "UnknownProgram" // File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
filetype = "PRG"
var/required_access = null // List of required accesses to run/download the program. var/required_access = null // List of required accesses to run/download the program.
var/requires_access_to_run = 1 // Whether the program checks for required_access when run. var/requires_access_to_run = 1 // Whether the program checks for required_access when run.
var/requires_access_to_download = 1 // Whether the program checks for required_access when downloading. var/requires_access_to_download = 1 // Whether the program checks for required_access when downloading.
// TGUIModule // TGUIModule
var/datum/tgui_module/TM = null // If the program uses TGUIModule, put it here and it will be automagically opened. Otherwise implement tgui_interact. var/datum/tgui_module/TM = null // If the program uses TGUIModule, put it here and it will be automagically opened. Otherwise implement tgui_interact.
var/tguimodule_path = null // Path to tguimodule, make sure to set this if implementing new program. var/tguimodule_path = null // Path to tguimodule, make sure to set this if implementing new program.
// Etc Program stuff
var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running. var/program_state = PROGRAM_STATE_KILLED// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
var/obj/item/modular_computer/computer // Device that runs this program. var/obj/item/modular_computer/computer // Device that runs this program.
var/filedesc = "Unknown Program" // User-friendly name of this program. var/filedesc = "Unknown Program" // User-friendly name of this program.
var/extended_desc = "N/A" // Short description of this program's function. var/extended_desc = "N/A" // Short description of this program's function.
/// Category that this program belongs to.
var/category = PROG_MISC
var/usage_flags = PROGRAM_ALL // Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
var/program_icon_state = null // Program-specific screen icon state var/program_icon_state = null // Program-specific screen icon state
var/program_key_state = "standby_key" // Program-specific keyboard icon state var/program_key_state = "standby_key" // Program-specific keyboard icon state
var/program_menu_icon = "newwin" // Icon to use for program's link in main menu var/program_menu_icon = "newwin" // Icon to use for program's link in main menu
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images!
var/requires_ntnet = 0 // Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes. var/requires_ntnet = 0 // Set to 1 for program to require nonstop NTNet connection to run. If NTNet connection is lost program crashes.
var/requires_ntnet_feature = 0 // Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION) var/requires_ntnet_feature = 0 // Optional, if above is set to 1 checks for specific function of NTNet (currently NTNET_SOFTWAREDOWNLOAD, NTNET_PEERTOPEER, NTNET_SYSTEMCONTROL and NTNET_COMMUNICATION)
var/ntnet_status = 1 // 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/usage_flags = PROGRAM_ALL // Bitflags (PROGRAM_CONSOLE, PROGRAM_LAPTOP, PROGRAM_TABLET combination) or PROGRAM_ALL
var/network_destination = null // Optional string that describes what NTNet server/system this program connects to. Used in default logging. var/network_destination = null // Optional string that describes what NTNet server/system this program connects to. Used in default logging.
var/ntnet_status = 1 // 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/available_on_ntnet = 1 // Whether the program can be downloaded from NTNet. Set to 0 to disable. var/available_on_ntnet = 1 // Whether the program can be downloaded from NTNet. Set to 0 to disable.
var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable. var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
// Misc
var/computer_emagged = 0 // Set to 1 if computer that's running us was emagged. Computer updates this every Process() tick var/computer_emagged = 0 // Set to 1 if computer that's running us was emagged. Computer updates this every Process() tick
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images!
var/ntnet_speed = 0 // GQ/s - current network connectivity transfer rate var/ntnet_speed = 0 // GQ/s - current network connectivity transfer rate
/// Name of the tgui interface /// Name of the tgui interface
var/tgui_id var/tgui_id

View File

@@ -7,8 +7,8 @@
program_menu_icon = "zoomin" program_menu_icon = "zoomin"
extended_desc = "This very advanced piece of software uses adaptive programming and large database of cipherkeys to bypass most encryptions used on camera networks. Be warned that system administrator may notice this." extended_desc = "This very advanced piece of software uses adaptive programming and large database of cipherkeys to bypass most encryptions used on camera networks. Be warned that system administrator may notice this."
size = 73 // Very large, a price for bypassing ID checks completely. size = 73 // Very large, a price for bypassing ID checks completely.
available_on_ntnet = 0 available_on_ntnet = FALSE
available_on_syndinet = 1 available_on_syndinet = TRUE
/datum/computer_file/program/camera_monitor/hacked/process_tick() /datum/computer_file/program/camera_monitor/hacked/process_tick()
..() ..()

View File

@@ -7,5 +7,6 @@
program_menu_icon = "key" program_menu_icon = "key"
extended_desc = "Program for programming crew ID cards." extended_desc = "Program for programming crew ID cards."
required_access = access_change_ids required_access = access_change_ids
requires_ntnet = 0 requires_ntnet = FALSE
size = 8 size = 8
category = PROG_COMMAND

View File

@@ -12,10 +12,11 @@
tguimodule_path = /datum/tgui_module/communications/ntos tguimodule_path = /datum/tgui_module/communications/ntos
extended_desc = "Used to command and control. Can relay long-range communications. This program can not be run on tablet computers." extended_desc = "Used to command and control. Can relay long-range communications. This program can not be run on tablet computers."
required_access = access_heads required_access = access_heads
requires_ntnet = 1 requires_ntnet = TRUE
size = 12 size = 12
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
network_destination = "long-range communication array" network_destination = "long-range communication array"
category = PROG_COMMAND
var/datum/comm_message_listener/message_core = new var/datum/comm_message_listener/message_core = new
/datum/computer_file/program/comm/clone() /datum/computer_file/program/comm/clone()

View File

@@ -8,9 +8,10 @@
program_menu_icon = "alert" program_menu_icon = "alert"
extended_desc = "This program provides visual interface for the engineering alarm system." extended_desc = "This program provides visual interface for the engineering alarm system."
required_access = access_engine required_access = access_engine
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "alarm monitoring network" network_destination = "alarm monitoring network"
size = 5 size = 5
category = PROG_MONITOR
var/has_alert = 0 var/has_alert = 0
/datum/computer_file/program/alarm_monitor/process_tick() /datum/computer_file/program/alarm_monitor/process_tick()

View File

@@ -7,8 +7,9 @@
program_menu_icon = "shuffle" program_menu_icon = "shuffle"
extended_desc = "This program allows remote control of air alarms. This program can not be run on tablet computers." extended_desc = "This program allows remote control of air alarms. This program can not be run on tablet computers."
required_access = access_atmospherics required_access = access_atmospherics
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "atmospheric control system" network_destination = "atmospheric control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
category = PROG_ENG
size = 17 size = 17

View File

@@ -8,9 +8,10 @@
extended_desc = "This program connects to sensors to provide information about electrical systems" extended_desc = "This program connects to sensors to provide information about electrical systems"
ui_header = "power_norm.gif" ui_header = "power_norm.gif"
required_access = access_engine required_access = access_engine
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "power monitoring system" network_destination = "power monitoring system"
size = 9 size = 9
category = PROG_ENG
var/has_alert = 0 var/has_alert = 0
/datum/computer_file/program/power_monitor/process_tick() /datum/computer_file/program/power_monitor/process_tick()

View File

@@ -7,8 +7,9 @@
program_menu_icon = "power" program_menu_icon = "power"
extended_desc = "This program allows remote control of power distribution systems. This program can not be run on tablet computers." extended_desc = "This program allows remote control of power distribution systems. This program can not be run on tablet computers."
required_access = access_engine required_access = access_engine
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "RCON remote control system" network_destination = "RCON remote control system"
requires_ntnet_feature = NTNET_SYSTEMCONTROL requires_ntnet_feature = NTNET_SYSTEMCONTROL
usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE usage_flags = PROGRAM_LAPTOP | PROGRAM_CONSOLE
size = 19 size = 19
category = PROG_ENG

View File

@@ -7,7 +7,8 @@
program_menu_icon = "wrench" program_menu_icon = "wrench"
extended_desc = "This program allows for remote monitoring and control of emergency shutoff valves." extended_desc = "This program allows for remote monitoring and control of emergency shutoff valves."
required_access = access_engine required_access = access_engine
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "shutoff valve control computer" network_destination = "shutoff valve control computer"
size = 5 size = 5
category = PROG_ENG
var/has_alert = 0 var/has_alert = 0

View File

@@ -8,9 +8,10 @@
extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines." extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines."
ui_header = "smmon_0.gif" ui_header = "smmon_0.gif"
required_access = access_engine required_access = access_engine
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "supermatter monitoring system" network_destination = "supermatter monitoring system"
size = 5 size = 5
category = PROG_ENG
var/last_status = 0 var/last_status = 0
/datum/computer_file/program/supermatter_monitor/process_tick() /datum/computer_file/program/supermatter_monitor/process_tick()

View File

@@ -40,6 +40,7 @@
size = 12 size = 12
available_on_ntnet = 1 available_on_ntnet = 1
requires_ntnet = 1 requires_ntnet = 1
category = PROG_MONITOR
// ERT Variant of the program // ERT Variant of the program
/datum/computer_file/program/camera_monitor/ert /datum/computer_file/program/camera_monitor/ert

View File

@@ -12,6 +12,8 @@
unsendable = 1 unsendable = 1
undeletable = 1 undeletable = 1
size = 4 size = 4
available_on_ntnet = 0 available_on_ntnet = FALSE
requires_ntnet = 0 requires_ntnet = FALSE
tguimodule_path = /datum/tgui_module/computer_configurator tguimodule_path = /datum/tgui_module/computer_configurator
usage_flags = PROGRAM_ALL
category = PROG_UTIL

View File

@@ -6,10 +6,12 @@
program_key_state = "generic_key" program_key_state = "generic_key"
program_menu_icon = "mail-closed" program_menu_icon = "mail-closed"
size = 7 size = 7
requires_ntnet = 1 requires_ntnet = TRUE
available_on_ntnet = 1 available_on_ntnet = TRUE
var/stored_login = "" var/stored_login = ""
var/stored_password = "" var/stored_password = ""
usage_flags = PROGRAM_ALL
category = PROG_OFFICE
tguimodule_path = /datum/tgui_module/email_client tguimodule_path = /datum/tgui_module/email_client

View File

@@ -13,6 +13,8 @@
var/open_file var/open_file
var/error var/error
usage_flags = PROGRAM_ALL
category = PROG_UTIL
/datum/computer_file/program/filemanager/tgui_act(action, list/params, datum/tgui/ui) /datum/computer_file/program/filemanager/tgui_act(action, list/params, datum/tgui/ui)
if(..()) if(..())

View File

@@ -26,6 +26,8 @@
///Determines which boss image to use on the UI. ///Determines which boss image to use on the UI.
var/boss_id = 1 var/boss_id = 1
usage_flags = PROGRAM_ALL
// This is the primary game loop, which handles the logic of being defeated or winning. // This is the primary game loop, which handles the logic of being defeated or winning.
/datum/computer_file/program/game/proc/game_check(mob/user) /datum/computer_file/program/game/proc/game_check(mob/user)
sleep(5) sleep(5)

View File

@@ -8,7 +8,7 @@
size = 4 size = 4
requires_ntnet = TRUE requires_ntnet = TRUE
available_on_ntnet = TRUE available_on_ntnet = TRUE
usage_flags = PROGRAM_ALL
tgui_id = "NtosNewsBrowser" tgui_id = "NtosNewsBrowser"
var/datum/computer_file/data/news_article/loaded_article var/datum/computer_file/data/news_article/loaded_article
@@ -118,4 +118,3 @@
if("PRG_toggle_archived") if("PRG_toggle_archived")
. = TRUE . = TRUE
show_archived = !show_archived show_archived = !show_archived

View File

@@ -16,12 +16,19 @@
var/datum/computer_file/program/downloaded_file = null var/datum/computer_file/program/downloaded_file = null
var/hacked_download = 0 var/hacked_download = 0
var/download_completion = 0 //GQ of downloaded data. ///GQ of downloaded data.
var/download_completion = 0
var/download_netspeed = 0 var/download_netspeed = 0
var/downloaderror = "" var/downloaderror = ""
var/obj/item/modular_computer/my_computer = null
var/list/downloads_queue[0] var/list/downloads_queue[0]
var/file_info
var/server
usage_flags = PROGRAM_ALL
category = PROG_UTIL
var/obj/item/modular_computer/my_computer = null
/datum/computer_file/program/ntnetdownload/kill_program() /datum/computer_file/program/ntnetdownload/kill_program()
..() ..()
abort_file_download() abort_file_download()

View File

@@ -12,12 +12,16 @@
ui_header = "ntnrc_idle.gif" ui_header = "ntnrc_idle.gif"
available_on_ntnet = 1 available_on_ntnet = 1
tgui_id = "NtosNetChat" tgui_id = "NtosNetChat"
var/last_message // Used to generate the toolbar icon /// Used to generate the toolbar icon
var/last_message
var/username var/username
var/active_channel var/active_channel
var/list/channel_history = list() var/list/channel_history = list()
var/operator_mode = FALSE // Channel operator mode /// Channel operator mode
var/netadmin_mode = FALSE // Administrator mode (invisible to other users + bypasses passwords) var/operator_mode = FALSE
/// Administrator mode (invisible to other users + bypasses passwords)
var/netadmin_mode = FALSE
usage_flags = PROGRAM_ALL
/datum/computer_file/program/chatclient/New() /datum/computer_file/program/chatclient/New()
username = "DefaultUser[rand(100, 999)]" username = "DefaultUser[rand(100, 999)]"

View File

@@ -8,11 +8,12 @@ var/global/nttransfer_uid = 0
program_key_state = "generic_key" program_key_state = "generic_key"
program_menu_icon = "transferthick-e-w" program_menu_icon = "transferthick-e-w"
size = 7 size = 7
requires_ntnet = 1 requires_ntnet = TRUE
requires_ntnet_feature = NTNET_PEERTOPEER requires_ntnet_feature = NTNET_PEERTOPEER
network_destination = "other device via P2P tunnel" network_destination = "other device via P2P tunnel"
available_on_ntnet = 1 available_on_ntnet = TRUE
tgui_id = "NtosNetTransfer" tgui_id = "NtosNetTransfer"
category = PROG_UTIL
var/error = "" // Error screen var/error = "" // Error screen
var/server_password = "" // Optional password to download the file. var/server_password = "" // Optional password to download the file.
@@ -23,7 +24,7 @@ var/global/nttransfer_uid = 0
var/download_completion = 0 // Download progress in GQ var/download_completion = 0 // Download progress in GQ
var/actual_netspeed = 0 // Displayed in the UI, this is the actual transfer speed. var/actual_netspeed = 0 // Displayed in the UI, this is the actual transfer speed.
var/unique_token // UID of this program var/unique_token // UID of this program
var/upload_menu = 0 // Whether we show the program list and upload menu var/upload_menu = FALSE // Whether we show the program list and upload menu
/datum/computer_file/program/nttransfer/New() /datum/computer_file/program/nttransfer/New()
unique_token = nttransfer_uid unique_token = nttransfer_uid

View File

@@ -9,12 +9,15 @@
available_on_ntnet = TRUE available_on_ntnet = TRUE
tgui_id = "NtosWordProcessor" tgui_id = "NtosWordProcessor"
var/browsing var/browsing = FALSE
var/open_file var/open_file
var/loaded_data var/loaded_data
var/error var/error
var/is_edited var/is_edited
usage_flags = PROGRAM_ALL
category = PROG_OFFICE
/datum/computer_file/program/wordprocessor/proc/get_file(var/filename) /datum/computer_file/program/wordprocessor/proc/get_file(var/filename)
var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive var/obj/item/weapon/computer_hardware/hard_drive/HDD = computer.hard_drive
if(!HDD) if(!HDD)

View File

@@ -7,6 +7,7 @@
program_menu_icon = "heart" program_menu_icon = "heart"
extended_desc = "This program connects to life signs monitoring system to provide basic information on crew health." extended_desc = "This program connects to life signs monitoring system to provide basic information on crew health."
required_access = access_medical required_access = access_medical
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "crew lifesigns monitoring system" network_destination = "crew lifesigns monitoring system"
size = 11 size = 11
category = PROG_MONITOR

View File

@@ -6,10 +6,11 @@
program_key_state = "generic_key" program_key_state = "generic_key"
program_menu_icon = "mail-open" program_menu_icon = "mail-open"
size = 12 size = 12
requires_ntnet = 1 requires_ntnet = TRUE
available_on_ntnet = 1 available_on_ntnet = TRUE
tgui_id = "NtosEmailAdministration" tgui_id = "NtosEmailAdministration"
required_access = access_network required_access = access_network
category = PROG_ADMIN
var/datum/computer_file/data/email_account/current_account = null var/datum/computer_file/data/email_account/current_account = null
var/datum/computer_file/data/email_message/current_message = null var/datum/computer_file/data/email_message/current_message = null

View File

@@ -10,6 +10,7 @@
required_access = access_network required_access = access_network
available_on_ntnet = TRUE available_on_ntnet = TRUE
tgui_id = "NtosNetMonitor" tgui_id = "NtosNetMonitor"
category = PROG_ADMIN
/datum/computer_file/program/ntnetmonitor/tgui_data(mob/user) /datum/computer_file/program/ntnetmonitor/tgui_data(mob/user)
if(!ntnet_global) if(!ntnet_global)

View File

@@ -17,11 +17,12 @@ var/warrant_uid = 0
program_icon_state = "warrant" program_icon_state = "warrant"
program_key_state = "security_key" program_key_state = "security_key"
program_menu_icon = "star" program_menu_icon = "star"
requires_ntnet = 1 requires_ntnet = TRUE
available_on_ntnet = 1 available_on_ntnet = TRUE
required_access = access_security required_access = access_security
usage_flags = PROGRAM_ALL usage_flags = PROGRAM_ALL
tgui_id = "NtosDigitalWarrant" tgui_id = "NtosDigitalWarrant"
category = PROG_SEC
var/datum/data/record/warrant/activewarrant var/datum/data/record/warrant/activewarrant

View File

@@ -7,6 +7,6 @@
program_menu_icon = "pin-s" program_menu_icon = "pin-s"
extended_desc = "Displays a ship's location in the sector." extended_desc = "Displays a ship's location in the sector."
required_access = null required_access = null
requires_ntnet = 1 requires_ntnet = TRUE
network_destination = "ship position sensors" network_destination = "ship position sensors"
size = 4 size = 4

View File

@@ -3,33 +3,46 @@
desc = "Unknown Hardware." desc = "Unknown Hardware."
icon = 'icons/obj/modular_components.dmi' icon = 'icons/obj/modular_components.dmi'
var/obj/item/modular_computer/holder2 = null var/obj/item/modular_computer/holder2 = null
var/power_usage = 0 // If the hardware uses extra power, change this.
var/enabled = 1 // If the hardware is turned off set this to 0.
var/critical = 1 // Prevent disabling for important component, like the HDD.
var/hardware_size = 1 // Limits which devices can contain this component. 1: Tablets/Laptops/Consoles, 2: Laptops/Consoles, 3: Consoles only
var/damage = 0 // Current damage level
var/max_damage = 100 // Maximal damage level.
var/damage_malfunction = 20 // "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
var/damage_failure = 50 // "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
var/malfunction_probability = 10// Chance of malfunction when the component is damaged
/obj/item/weapon/computer_hardware/attackby(var/obj/item/W as obj, var/mob/living/user as mob) /// If the hardware uses extra power, change this.
var/power_usage = 0
/// If the hardware is turned off set this to FALSE.
var/enabled = TRUE
/// Prevent disabling for important component, like the HDD.
var/critical = 1
/// Limits which devices can contain this component. 1: All, 2: Laptops/Consoles, 3: Consoles only
var/hardware_size = 1
/// Current damage level
var/damage = 0
/// Maximal damage level.
var/max_damage = 100
/// "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
var/damage_malfunction = 20
/// "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
var/damage_failure = 50
/// Chance of malfunction when the component is damaged
var/malfunction_probability = 10
var/usage_flags = PROGRAM_ALL
/// Whether attackby will be passed on it even with a closed panel
var/external_slot
/obj/item/weapon/computer_hardware/attackby(obj/item/W as obj, mob/living/user as mob)
// Multitool. Runs diagnostics // Multitool. Runs diagnostics
if(istype(W, /obj/item/device/multitool)) if(istype(W, /obj/item/device/multitool))
to_chat(user, "***** DIAGNOSTICS REPORT *****") to_chat(user, "***** DIAGNOSTICS REPORT *****")
diagnostics(user) diagnostics(user)
to_chat(user, "******************************") to_chat(user, "******************************")
return 1 return TRUE
// Nanopaste. Repair all damage if present for a single unit. // Nanopaste. Repair all damage if present for a single unit.
var/obj/item/stack/S = W var/obj/item/stack/S = W
if(istype(S, /obj/item/stack/nanopaste)) if(istype(S, /obj/item/stack/nanopaste))
if(!damage) if(!damage)
to_chat(user, "\The [src] doesn't seem to require repairs.") to_chat(user, "\The [src] doesn't seem to require repairs.")
return 1 return TRUE
if(S.use(1)) if(S.use(1))
to_chat(user, "You apply a bit of \the [W] to \the [src]. It immediately repairs all damage.") to_chat(user, "You apply a bit of \the [W] to \the [src]. It immediately repairs all damage.")
damage = 0 damage = 0
return 1 return TRUE
// Cable coil. Works as repair method, but will probably require multiple applications and more cable. // Cable coil. Works as repair method, but will probably require multiple applications and more cable.
if(istype(S, /obj/item/stack/cable_coil)) if(istype(S, /obj/item/stack/cable_coil))
if(!damage) if(!damage)
@@ -38,11 +51,11 @@
if(S.use(1)) if(S.use(1))
to_chat(user, "You patch up \the [src] with a bit of \the [W].") to_chat(user, "You patch up \the [src] with a bit of \the [W].")
take_damage(-10) take_damage(-10)
return 1 return TRUE
return ..() return ..()
// Called on multitool click, prints diagnostic information to the user. /// Returns a list of lines containing diagnostic information for display.
/obj/item/weapon/computer_hardware/proc/diagnostics(var/mob/user) /obj/item/weapon/computer_hardware/proc/diagnostics(var/mob/user)
to_chat(user, "Hardware Integrity Test... (Corruption: [damage]/[max_damage]) [damage > damage_failure ? "FAIL" : damage > damage_malfunction ? "WARN" : "PASS"]") to_chat(user, "Hardware Integrity Test... (Corruption: [damage]/[max_damage]) [damage > damage_failure ? "FAIL" : damage > damage_malfunction ? "WARN" : "PASS"]")
@@ -57,20 +70,20 @@
holder2 = null holder2 = null
return ..() return ..()
// Handles damage checks /// Handles damage checks
/obj/item/weapon/computer_hardware/proc/check_functionality() /obj/item/weapon/computer_hardware/proc/check_functionality()
// Turned off // Turned off
if(!enabled) if(!enabled)
return 0 return FALSE
// Too damaged to work at all. // Too damaged to work at all.
if(damage > damage_failure) if(damage > damage_failure)
return 0 return FALSE
// Still working. Well, sometimes... // Still working. Well, sometimes...
if(damage > damage_malfunction) if(damage > damage_malfunction)
if(prob(malfunction_probability)) if(prob(malfunction_probability))
return 0 return FALSE
// Good to go. // Good to go.
return 1 return TRUE
/obj/item/weapon/computer_hardware/examine(var/mob/user) /obj/item/weapon/computer_hardware/examine(var/mob/user)
. = ..() . = ..()
@@ -81,8 +94,7 @@
else if(damage) else if(damage)
. += "It seems to be slightly damaged." . += "It seems to be slightly damaged."
// Damages the component. Contains necessary checks. Negative damage "heals" the component. /// Damages the component. Contains necessary checks. Negative damage "heals" the component.
/obj/item/weapon/computer_hardware/take_damage(var/amount) /obj/item/weapon/computer_hardware/take_damage(var/amount)
damage += round(amount) // We want nice rounded numbers here. damage += round(amount) // We want nice rounded numbers here.
damage = between(0, damage, max_damage) // Clamp the value. damage = between(0, damage, max_damage) // Clamp the value.

View File

@@ -5,9 +5,13 @@
icon_state = "hdd_normal" icon_state = "hdd_normal"
hardware_size = 1 hardware_size = 1
origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1) origin_tech = list(TECH_DATA = 1, TECH_ENGINEERING = 1)
var/max_capacity = 128 var/max_capacity = 128
var/used_capacity = 0 var/used_capacity = 0
var/list/stored_files = list() // List of stored files on this drive. DO NOT MODIFY DIRECTLY! /// List of stored files on this drive. DO NOT MODIFY DIRECTLY!
var/list/stored_files = list()
/// Whether drive is protected against changes
var/read_only = FALSE
/obj/item/weapon/computer_hardware/hard_drive/advanced /obj/item/weapon/computer_hardware/hard_drive/advanced
name = "advanced hard drive" name = "advanced hard drive"
@@ -60,6 +64,7 @@
// 999 is a byond limit that is in place. It's unlikely someone will reach that many files anyway, since you would sooner run out of space. // 999 is a byond limit that is in place. It's unlikely someone will reach that many files anyway, since you would sooner run out of space.
to_chat(user, "NT-NFS File Table Status: [stored_files.len]/999") to_chat(user, "NT-NFS File Table Status: [stored_files.len]/999")
to_chat(user, "Storage capacity: [used_capacity]/[max_capacity]GQ") to_chat(user, "Storage capacity: [used_capacity]/[max_capacity]GQ")
to_chat(user, "Read-only mode: [(read_only ? "ON" : "OFF")]")
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks. // Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/weapon/computer_hardware/hard_drive/proc/store_file(var/datum/computer_file/F) /obj/item/weapon/computer_hardware/hard_drive/proc/store_file(var/datum/computer_file/F)

View File

@@ -8,12 +8,20 @@ var/global/ntnet_card_uid = 1
critical = 0 critical = 0
icon_state = "netcard_basic" icon_state = "netcard_basic"
hardware_size = 1 hardware_size = 1
var/identification_id = null // Identification ID. Technically MAC address of this device. Can't be changed by user.
var/identification_string = "" // Identification string, technically nickname seen in the network. Can be set by user.
var/long_range = 0
var/ethernet = 0 // Hard-wired, therefore always on, ignores NTNet wireless checks.
malfunction_probability = 1 malfunction_probability = 1
/// Identification ID. Technically MAC address of this device. Can't be changed by user.
var/identification_id = null
/// Identification string, technically nickname seen in the network. Can be set by user.
var/identification_string = ""
/// Long-range cards have stronger connections, letting them reach relays from connected Z-levels.
var/long_range = 0
/// Hard-wired, therefore always on, ignores NTNet wireless checks.
var/ethernet = 0
/// If set, uses the value to funnel connections through another network card.
var/proxy_id
/obj/item/weapon/computer_hardware/network_card/diagnostics(var/mob/user) /obj/item/weapon/computer_hardware/network_card/diagnostics(var/mob/user)
..() ..()
to_chat(user, "NIX Unique ID: [identification_id]") to_chat(user, "NIX Unique ID: [identification_id]")

View File

@@ -1,10 +1,7 @@
import { useBackend } from '../backend';
import { NtosWindow } from '../layouts'; import { NtosWindow } from '../layouts';
import { CommunicationsConsoleContent } from './CommunicationsConsole'; import { CommunicationsConsoleContent } from './CommunicationsConsole';
export const NtosCommunicationsConsole = (props, context) => { export const NtosCommunicationsConsole = () => {
const { act, data } = useBackend(context);
return ( return (
<NtosWindow width={400} height={600} resizable> <NtosWindow width={400} height={600} resizable>
<NtosWindow.Content scrollable> <NtosWindow.Content scrollable>

View File

@@ -0,0 +1,12 @@
import { NtosWindow } from '../layouts';
import { CrewManifestContent } from './CrewManifest';
export const NtosCrewManifest = () => {
return (
<NtosWindow width={800} height={600} resizable>
<NtosWindow.Content>
<CrewManifestContent />
</NtosWindow.Content>
</NtosWindow>
);
};

View File

@@ -1,10 +1,7 @@
import { useBackend } from '../backend';
import { NtosWindow } from '../layouts'; import { NtosWindow } from '../layouts';
import { IdentificationComputerContent } from './IdentificationComputer'; import { IdentificationComputerContent } from './IdentificationComputer';
export const NtosIdentificationComputer = (props, context) => { export const NtosIdentificationComputer = () => {
const { act, data } = useBackend(context);
return ( return (
<NtosWindow width={600} height={700} resizable> <NtosWindow width={600} height={700} resizable>
<NtosWindow.Content scrollable> <NtosWindow.Content scrollable>

View File

@@ -1,7 +1,7 @@
import { NtosWindow } from '../layouts'; import { NtosWindow } from '../layouts';
import { ShutoffMonitorContent } from './ShutoffMonitor'; import { ShutoffMonitorContent } from './ShutoffMonitor';
export const NtosShutoffMonitor = (props, context) => { export const NtosShutoffMonitor = () => {
return ( return (
<NtosWindow width={627} height={700} resizable> <NtosWindow width={627} height={700} resizable>
<NtosWindow.Content> <NtosWindow.Content>