#define MENU_MAIN 0 //Byond. Enums. Lacks them. Etc #define MENU_INDEX 1 #define MENU_IN_RECORD 2 #define MENU_FIELD_INPUT 3 #define MENU_SEARCH_INPUT 4 #define MENU_VIRUS_INDEX 5 #define MENU_VIRUS_RECORD 6 #define FIELDNUM_NAME 1 #define FIELDNUM_SEX 2 #define FIELDNUM_AGE 3 #define FIELDNUM_PRINT 4 #define FIELDNUM_DNA 5 #define FIELDNUM_PSTAT 6 #define FIELDNUM_MSTAT 7 #define FIELDNUM_BLOODTYPE 8 #define FIELDNUM_MINDIS 9 #define FIELDNUM_MINDET 10 #define FIELDNUM_MAJDIS 11 #define FIELDNUM_MAJDET 12 #define FIELDNUM_DISEASE 13 #define FIELDNUM_DISDET 14 #define FIELDNUM_DELETE "d" #define FIELDNUM_NEWREC 99 /datum/computer/file/terminal_program/medical_records name = "MedTrak" size = 12 req_access = list(access_medical) var/tmp/menu = MENU_MAIN var/tmp/field_input = 0 var/tmp/authenticated = null //Are we currently logged in? var/datum/computer/file/user_data/account = null var/list/record_list = list() //List of records, for jumping direclty to a specific ID var/datum/data/record/active_general = null //General record var/datum/data/record/active_medical = null //Medical record var/log_string = null //Log usage of record system, can be dumped to a text file. var/setup_acc_filepath = "/logs/sysusr"//Where do we look for login data? var/setup_logdump_name = "medlog" //What name do we give our logdump textfile? initialize() /* var/title_art = {"
  __  __        _     _____          _
 |  \\/  |___ __| |___|_   _|_ _ __ _| |__
 | |\\/| / -_) _` |___| | | | '_/ _` | / /
 |_|  |_\\___\\__,_|     |_| |_| \\__,_|_\\_\\
"} */ src.authenticated = null src.record_list = data_core.general.Copy() //Initial setting of record list. src.master.temp = null src.menu = MENU_MAIN src.field_input = 0 //src.print_text(" [title_art]") if(!src.find_access_file()) //Find the account information, as it's essentially a ~digital ID card~ src.print_text("Error: Cannot locate user file. Quitting...") src.master.unload_program(src) //Oh no, couldn't find the file. return if(!src.check_access(src.account.access)) src.print_text("User [src.account.registered] does not have needed access credentials.
Quitting...") src.master.unload_program(src) return src.authenticated = src.account.registered src.log_string += "
LOGIN: [src.authenticated]" src.print_text(mainmenu_text()) return input_text(text) if(..()) return var/list/command_list = parse_string(text) var/command = command_list[1] command_list -= command_list[1] switch(menu) if (MENU_MAIN) switch (command) if ("0") //Exit program src.print_text("Quitting...") src.master.unload_program(src) return if ("1") //View records src.record_list = data_core.general src.menu = MENU_INDEX src.print_index() if ("2") //Search records src.print_text("Please enter target name, ID, DNA, or fingerprint.") src.menu = MENU_SEARCH_INPUT return if ("3") //Viral records. src.master.temp = null src.print_text(virusmenu_text()) src.menu = MENU_VIRUS_INDEX return if (MENU_INDEX) var/index_number = round( max( text2num(command), 0) ) if (index_number == 0) src.menu = MENU_MAIN src.master.temp = null src.print_text(mainmenu_text()) return if (!istype(record_list) || index_number > record_list.len) src.print_text("Invalid record.") return var/datum/data/record/check = src.record_list[index_number] if(!check || !istype(check)) src.print_text("Error: Record Data Invalid.") return src.active_general = check src.active_medical = null if (data_core.general.Find(check)) for (var/datum/data/record/E in data_core.medical) if ((E.fields["name"] == src.active_general.fields["name"] || E.fields["id"] == src.active_general.fields["id"])) src.active_medical = E break src.log_string += "
Log loaded: [src.active_general.fields["id"]]" if (src.print_active_record()) src.menu = MENU_IN_RECORD return if (MENU_IN_RECORD) switch(lowertext(command)) if ("r") src.print_active_record() return if ("d") src.print_text("Are you sure? (Y/N)") src.field_input = FIELDNUM_DELETE src.menu = MENU_FIELD_INPUT return if ("p") var/obj/item/peripheral/printcard = find_peripheral("LAR_PRINTER") if(!printcard) src.print_text("Error: No printer detected.") return //Okay, let's put together something to print. var/info = "
Medical Record

" if (istype(src.active_general, /datum/data/record) && data_core.general.Find(src.active_general)) info += {" Name: [src.active_general.fields["name"]] ID: [src.active_general.fields["id"]]

Sex: [src.active_general.fields["sex"]]

Age: [src.active_general.fields["age"]]

Rank: [src.active_general.fields["rank"]]

Fingerprint: [src.active_general.fields["fingerprint"]]

DNA: [src.active_general.fields["dna"]]

Physical Status: [src.active_general.fields["p_stat"]]

Mental Status: [src.active_general.fields["m_stat"]]"} else info += "General Record Lost!
" if ((istype(src.active_medical, /datum/data/record) && data_core.medical.Find(src.active_medical))) info += {"

Medical Data



Current Health: [src.active_medical.fields["h_imp"]]
Blood Type: [src.active_medical.fields["bioHolder.bloodType"]]

Minor Disabilities: [src.active_medical.fields["mi_dis"]]

Details: [src.active_medical.fields["mi_dis_d"]]


Major Disabilities: [src.active_medical.fields["ma_dis"]]

Details: [src.active_medical.fields["ma_dis_d"]]


Current Diseases: [src.active_medical.fields["cdi"]] (per disease info placed in log/comment section)
Details: [src.active_medical.fields["cdi_d"]]



Traits: [src.active_medical.fields["traits"]]


Important Notes:

 [src.active_medical.fields["notes"]]
"} else info += "
Medical Record Lost!

" var/datum/signal/signal = get_free_signal() signal.data["data"] = info signal.data["title"] = "Medical Record" src.peripheral_command("print",signal, "\ref[printcard]") src.print_text("Printing...") return var/field_number = round( max( text2num(command), 0) ) if (field_number == 0) src.menu = MENU_INDEX src.print_index() return src.field_input = field_number switch(field_number) if (FIELDNUM_SEX) src.print_text("Please select: (1) Female (2) Male (3) Other (0) Back") src.menu = MENU_FIELD_INPUT return if (FIELDNUM_BLOODTYPE) src.print_text("Please select: (1) A+ (2) A- (3) B+ (4) B-
(5) AB+ (6) AB- (7) O+ (8) O- (0) Back") src.menu = MENU_FIELD_INPUT return else src.print_text("Please enter new value.") src.menu = MENU_FIELD_INPUT return if (MENU_FIELD_INPUT) if (!src.active_general) src.print_text("Error: Record invalid.") src.menu = MENU_INDEX return var/inputText = strip_html(text) switch (field_input) if (FIELDNUM_NAME) if (ckey(inputText)) src.active_general.fields["name"] = copytext(inputText, 1, 26) else return if (FIELDNUM_SEX) switch (round( max( text2num(command), 0) )) if (1) src.active_general.fields["sex"] = "Female" if (2) src.active_general.fields["sex"] = "Male" if (3) src.active_general.fields["sex"] = "Other" if (0) src.menu = MENU_IN_RECORD return else return if (FIELDNUM_AGE) var/newAge = round( min( text2num(command), 99) ) if (newAge < 1) src.print_text("Invalid age value. Please re-enter.") return src.active_general.fields["age"] = newAge return if (FIELDNUM_PSTAT) if (ckey(inputText)) src.active_general.fields["p_stat"] = copytext(inputText, 1, 33) else return if (FIELDNUM_MSTAT) if (ckey(inputText)) src.active_general.fields["m_stat"] = copytext(inputText, 1, 33) else return if (FIELDNUM_PRINT) if (ckey(inputText)) src.active_general.fields["fingerprint"] = copytext(inputText, 1, 33) else return if (FIELDNUM_DNA) if (ckey(inputText)) src.active_general.fields["dna"] = copytext(inputText, 1, 40) else return if (FIELDNUM_BLOODTYPE) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return switch (round( max( text2num(command), 0) )) if (1) src.active_medical.fields["bioHolder.bloodType"] = "A+" if (2) src.active_medical.fields["bioHolder.bloodType"] = "A-" if (3) src.active_medical.fields["bioHolder.bloodType"] = "B+" if (4) src.active_medical.fields["bioHolder.bloodType"] = "B-" if (5) src.active_medical.fields["bioHolder.bloodType"] = "AB+" if (6) src.active_medical.fields["bioHolder.bloodType"] = "AB-" if (7) src.active_medical.fields["bioHolder.bloodType"] = "O+" if (8) src.active_medical.fields["bioHolder.bloodType"] = "O-" if (9) src.active_medical.fields["bioHolder.bloodType"] = "Zesty Ranch" if (0) src.menu = MENU_IN_RECORD return else return if (FIELDNUM_MINDIS) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["mi_dis"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_MINDET) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["mi_dis_d"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_MAJDIS) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["ma_dis"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_MAJDET) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["ma_dis_d"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_DISEASE) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["cdi"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_DISDET) if (!src.active_medical) src.print_text("No medical record loaded!") src.menu = MENU_IN_RECORD return if (ckey(inputText)) src.active_medical.fields["cdi_d"] = copytext(inputText, 1, MAX_MESSAGE_LEN) else return if (FIELDNUM_DELETE) switch (ckey(inputText)) if ("y") if (src.active_medical) src.log_string += "
M-Record [src.active_medical.fields["id"]] deleted." data_core.medical -= src.active_medical qdel(src.active_medical) src.print_active_record() src.menu = MENU_IN_RECORD else if (src.active_general) data_core.general -= src.active_general src.log_string += "
Record [src.active_general.fields["id"]] deleted." qdel(src.active_general) src.menu = MENU_INDEX src.print_index() if ("n") src.menu = MENU_IN_RECORD src.print_text("Record preserved.") return if (FIELDNUM_NEWREC) if (src.active_medical) return var/datum/data/record/R = new /datum/data/record( ) R.fields["name"] = src.active_general.fields["name"] R.fields["id"] = src.active_general.fields["id"] R.name = "Medical Record #[R.fields["id"]]" R.fields["bioHolder.bloodType"] = "Unknown" R.fields["mi_dis"] = "None" R.fields["mi_dis_d"] = "No minor disabilities have been declared." R.fields["ma_dis"] = "None" R.fields["ma_dis_d"] = "No major disabilities have been diagnosed." R.fields["alg"] = "None" R.fields["alg_d"] = "No allergies have been detected in this patient." R.fields["cdi"] = "None" R.fields["cdi_d"] = "No diseases have been diagnosed at the moment." R.fields["notes"] = "No notes." R.fields["h_imp"] = "No health implant detected." R.fields["traits"] = "No known traits." data_core.medical += R src.active_medical = R src.log_string += "
New medical record created." src.print_active_record() return src.print_text("Field updated.") src.menu = MENU_IN_RECORD return if (MENU_SEARCH_INPUT) var/searchText = ckey(strip_html(text)) if (!searchText) return var/datum/data/record/result = null for(var/datum/data/record/R in data_core.general) if((ckey(R.fields["name"]) == searchText) || (ckey(R.fields["dna"]) == searchText) || (ckey(R.fields["id"]) == searchText) || (ckey(R.fields["fingerprint"]) == searchText)) result = R break if(!result) src.print_text("No results found.") src.menu = MENU_MAIN return src.active_general = result src.active_medical = null //Time to find the accompanying medical record, if it even exists. for (var/datum/data/record/E in data_core.medical) if ((E.fields["name"] == src.active_general.fields["name"] || E.fields["id"] == src.active_general.fields["id"])) src.active_medical = E break src.menu = MENU_IN_RECORD src.print_active_record() return if (MENU_VIRUS_INDEX) var/entrydat = null switch (copytext(text, 1,2)) if ("0") src.menu = MENU_MAIN src.master.temp = null src.print_text(virusmenu_text()) return if ("1") entrydat = {"Name: GBS
Number of stages: 5
Spread: Airborne Transmission
Possible Cure: Spaceacillin
Affected Species: Human

Notes: If left untreated death will occur.

Severity: Major"} if ("2") entrydat = {"Name: Common Cold
Number of stages: 3
Spread: Airborne Transmission
Possible Cure: Rest
Affected Species: Human

Notes: If left untreated the subject will contract the flu.

Severity: Minor"} if ("3") entrydat = {"Name: The Flu
Number of stages: 3
Spread: Airborne Transmission
Possible Cure: Rest
Affected Species: Human

Notes: If left untreated the subject will feel quite unwell.

Severity: Medium"} if ("4") entrydat = {"Name: Jungle Fever
Number of stages: 1
Spread: Airborne Transmission
Possible Cure: None
Affected Species: Monkey

Notes: Monkies with this disease will bite humans, causing humans to spontaneously to mutate into a monkey.

Severity: Medium"} if ("5") entrydat = {"Name: Clowning Around
Number of stages: 4
Spread: Contact Transmission
Possible Cure: Spaceacillin
Affected Species: Human

Notes: Subjects are affected by rampant honking and a fondness for shenanigans. They may also spontaneously phase through closed airlocks.

Severity: Laughable"} if ("6") entrydat = {"Name: Space Rhinovirus
Number of stages: 4
Spread: Airborne Transmission
Possible Cure: Spaceacillin
Affected Species: Human

Notes: This disease transplants the genetic code of the intial vector into new hosts.

Severity: Medium"} if ("7") entrydat = {"Name: Robot Transformation
Number of stages: 5
Spread: Infected food
Possible Cure: Electric shock.
Affected Species: Human

Notes: This disease, actually acute nanomachine infection, converts the victim into a cyborg.

Severity: Major"} if ("8") entrydat = {"Name: Teleportitis
Number of stages: 1
Spread: Unknown
Possible Cure: Unknown
Affected Species: Human

Notes: Means of transmission are currently unknown, may be related to contents of teleporter emissions. Causes violent shifts in physical position of subject. Keep patients away from active engines.

Severity: Unknown"} if ("9") entrydat = {"Name: Berserker
Number of stages: 2
Spread: Contact Transmission
Possible Cure: Spaceacillin
Affected Species: Human

Notes: This disease causes fits of extreme rage and violence in the victim. Due to its ability to spread, it is considered extremely dangerous. Do not attempt to reason with infected persons.

Severity: Major"} else return src.master.temp = null src.print_text("[entrydat]
Enter 0 to return.") src.menu = MENU_VIRUS_RECORD if (MENU_VIRUS_RECORD) if (copytext(text, 1,2) == "0") src.master.temp = null src.menu = MENU_MAIN src.print_text(mainmenu_text()) return return proc mainmenu_text() var/dat = {"
M E D T R A K

Welcome to Medtrak 5.1
Commands:
(1) View medical records.
(2) Search for a record.
(3) View viral database.
(0) Quit."} return dat virusmenu_text() var/dat = {"Known Diseases:
(01) GBS
(02) Common Cold
(03) Flu
(04) Jungle Fever
(05) Clowning Around
(06) Space Rhinovirus
(07) Robot Transformation
(08) Teleportitis
(09) Berserker
Enter virus number or 0 to return."} return dat print_active_record() if (!src.active_general) src.print_text("Error: General record data corrupt.") return 0 src.master.temp = null var/view_string = {" \[01]Name: [src.active_general.fields["name"]] ID: [src.active_general.fields["id"]]
\[02]Sex: [src.active_general.fields["sex"]]
\[03]Age: [src.active_general.fields["age"]]
\[__]Rank: [src.active_general.fields["rank"]]
\[04]Fingerprint: [src.active_general.fields["fingerprint"]]
\[05]DNA: [src.active_general.fields["dna"]]
\[06]Physical Status: [src.active_general.fields["p_stat"]]
\[07]Mental Status: [src.active_general.fields["m_stat"]]"} if ((istype(src.active_medical, /datum/data/record) && data_core.medical.Find(src.active_medical))) view_string += {"
Medical Data:

\[__]Current Health: [src.active_medical.fields["h_imp"]]
\[08]Blood Type: [src.active_medical.fields["bioHolder.bloodType"]]
\[09]Minor Disabilities: [src.active_medical.fields["mi_dis"]]
\[10]Details: [src.active_medical.fields["mi_dis_d"]]
\[11]
Major Disabilities: [src.active_medical.fields["ma_dis"]]
\[12]Details: [src.active_medical.fields["ma_dis_d"]]
\[13]
Current Diseases: [src.active_medical.fields["cdi"]] (per disease info placed in log/comment section)
\[14]Details: [src.active_medical.fields["cdi_d"]]
\[15]Traits: [src.active_medical.fields["traits"]]
Important Notes:
 [src.active_medical.fields["notes"]]"} else view_string += "

Medical Record Lost!" view_string += "
\[99] Create New Medical Record.
" view_string += "
Enter field number to edit a field
(R) Redraw (D) Delete (P) Print (0) Return to index." src.print_text("Record Data:
[view_string]") return 1 print_index() src.master.temp = null var/dat = "" if(!src.record_list || !src.record_list.len) src.print_text("Error: No records found in database.") else dat = "Please select a record:" var/leadingZeroCount = length("[src.record_list.len]") for(var/x = 1, x <= src.record_list.len, x++) var/datum/data/record/R = src.record_list[x] if(!R || !istype(R)) dat += "
\[[add_zero("[x]",leadingZeroCount)]]ERR: REDACTED" continue dat += "
\[[add_zero("[x]",leadingZeroCount)]][R.fields["id"]]: [R.fields["name"]]" dat += "

Enter record number, or 0 to return." src.print_text(dat) return 1 find_access_file() //Look for the whimsical account_data file var/datum/computer/folder/accdir = src.holder.root if(src.master.host_program) //Check where the OS is, preferably. accdir = src.master.host_program.holder.root var/datum/computer/file/user_data/target = parse_file_directory(setup_acc_filepath, accdir) if(target && istype(target)) src.account = target return 1 return 0 #undef MENU_MAIN #undef MENU_INDEX #undef MENU_IN_RECORD #undef MENU_FIELD_INPUT #undef MENU_SEARCH_INPUT #undef MENU_VIRUS_INDEX #undef MENU_VIRUS_RECORD #undef FIELDNUM_NAME #undef FIELDNUM_SEX #undef FIELDNUM_AGE #undef FIELDNUM_PRINT #undef FIELDNUM_DNA #undef FIELDNUM_PSTAT #undef FIELDNUM_MSTAT #undef FIELDNUM_BLOODTYPE #undef FIELDNUM_MINDIS #undef FIELDNUM_MINDET #undef FIELDNUM_MAJDIS #undef FIELDNUM_MAJDET #undef FIELDNUM_DISEASE #undef FIELDNUM_DISDET #undef FIELDNUM_DELETE #undef FIELDNUM_NEWREC