From 838fc31d11598a397c03fb605542a484023d8e9e Mon Sep 17 00:00:00 2001 From: DOOM Date: Wed, 8 May 2024 22:28:12 -0700 Subject: [PATCH 001/104] new ui for medcomputer --- code/game/machinery/computer/computer.dm | 3 + code/game/machinery/computer/medical.dm | 699 ++++++------------ .../objects/items/circuitboards/computer.dm | 4 +- code/modules/cm_marines/marines_consoles.dm | 206 +++--- maps/map_files/BigRed/BigRed.dmm | 6 +- .../BigRed/sprinkles/40.viro_open.dmm | 2 +- .../map_files/BigRed/standalone/medbay-v3.dmm | 2 +- maps/map_files/CORSAT/Corsat.dmm | 20 +- maps/map_files/DesertDam/Desert_Dam.dmm | 22 +- .../FOP_v2_Cellblocks/Prison_Station_FOP.dmm | 14 +- .../FOP_v3_Sciannex/Fiorina_SciAnnex.dmm | 6 +- .../sprinkles/10.scavshipholder.dmm | 2 +- maps/map_files/Kutjevo/Kutjevo.dmm | 4 +- maps/map_files/LV624/LV624.dmm | 2 +- maps/map_files/New_Varadero/New_Varadero.dmm | 4 +- maps/map_files/USS_Almayer/USS_Almayer.dmm | 26 +- .../Whiskey_Outpost_v2/Whiskey_Outpost_v2.dmm | 6 +- maps/shuttles/ert_shuttle_big.dmm | 4 +- maps/templates/Chinook.dmm | 12 +- tgui/packages/tgui/interfaces/MedMod.jsx | 295 ++++++++ 20 files changed, 685 insertions(+), 654 deletions(-) create mode 100644 tgui/packages/tgui/interfaces/MedMod.jsx diff --git a/code/game/machinery/computer/computer.dm b/code/game/machinery/computer/computer.dm index f6efe6edb5e2..759ec98454b6 100644 --- a/code/game/machinery/computer/computer.dm +++ b/code/game/machinery/computer/computer.dm @@ -133,6 +133,9 @@ if(!.) //not broken or unpowered if(ishuman(usr)) playsound(src, "keyboard", 15, 1) + // maybe it shouldn't open the UI if you hit the computer with an object? + if(usr.get_active_hand()) + return TRUE /obj/structure/machinery/computer/fixer var/all_configs diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 40b23667636f..d59861e9c0c7 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -1,509 +1,228 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 - -/obj/structure/machinery/computer/med_data//TODO:SANITY +// eventually someone will have to make these into global defines and change all the occurrences. + +#define AUTOPSY_NOTES "a_stat" // autopsy notes +#define NOTES "notes" // general medical notes +#define MENTAL "m_stat" // psychiatric illnesses +#define DISEASE "cdi" +#define DISABILITY "mi_dis" +#define HEALTH "p_stat" // current health status +#define DEATH "d_stat" // cause of death +#define BLOOD_TYPE "b_type" +#define AUTOPSY_SUBMISSION "aut_sub" // whether or not an autopsy report has been submitted already for a given record +#define PRINT_COOLDOWN_TIME 2 MINUTES + +/obj/structure/machinery/computer/double_id/med_data//TODO:RIP OUT LEGACY CODE. name = "Medical Records" desc = "This can be used to check medical records." icon_state = "medcomp" density = TRUE req_one_access = list(ACCESS_MARINE_MEDBAY, ACCESS_WY_MEDICAL) circuit = /obj/item/circuitboard/computer/med_data - var/obj/item/card/id/scan = null - var/last_user_name = "" - var/last_user_rank = "" - var/authenticated = null - var/rank = null - var/screen = null - var/datum/data/record/active1 = null - var/datum/data/record/active2 = null - var/a_id = null - var/temp = null - var/printing = null - -/obj/structure/machinery/computer/med_data/verb/eject_id() - set category = "Object" - set name = "Eject ID Card" - set src in oview(1) - - if(!usr || usr.is_mob_incapacitated()) return - - if(scan) - to_chat(usr, "You remove \the [scan] from \the [src].") - scan.forceMove(get_turf(src)) - if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) - usr.put_in_hands(scan) - scan = null - else - to_chat(usr, "There is nothing to remove from the console.") - return - -/obj/structure/machinery/computer/med_data/attackby(obj/item/O as obj, user as mob) - if(istype(O, /obj/item/card/id) && !scan) - if(usr.drop_held_item()) - O.forceMove(src) - scan = O - last_user_name = scan.registered_name - last_user_rank = scan.rank - to_chat(user, "You insert [O].") + // general record for a given target user + var/datum/data/record/target_record_general = null + // medical record for a given target user + var/datum/data/record/target_record_medical = null + // print cooldown + COOLDOWN_DECLARE(print_cooldown) + +/obj/structure/machinery/computer/double_id/med_data/attackby(obj/card, mob/user) + // we only check the target, never the user. + if(user_id_card) + var/obj/item/card/id/id_card = card + if(!retrieve_target_records(id_card)) + return ..() -/obj/structure/machinery/computer/med_data/attack_remote(user as mob) - return src.attack_hand(user) +/obj/structure/machinery/computer/double_id/med_data/proc/retrieve_target_records(obj/item/card/id/target_id) + if(!target_id) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to read target ID.\"") + return FALSE -/obj/structure/machinery/computer/med_data/attack_hand(mob/user as mob) - if(..()) - return - var/dat - if (src.temp) - dat = text("[src.temp]

Clear Screen") - else - dat = text("Confirm Identity: []
", src, (src.scan ? text("[]", src.scan.name) : "----------")) - if (src.authenticated) - switch(src.screen) - if(1.0) - dat += {" -Search Records -
List Records -
-
Medbot Tracking -
-
Record Maintenance -
{Log Out}
-"} - if(2.0) - dat += "Record List:
" - if(!isnull(GLOB.data_core.general)) - for(var/datum/data/record/R in sortRecord(GLOB.data_core.general)) - dat += text("[]: []
", src, R, R.fields["id"], R.fields["name"]) - //Foreach goto(132) - dat += text("
Back", src) - if(3.0) - dat += text("Records Maintenance
\nBackup To Disk
\nUpload From disk
\nDelete All Records
\n
\nBack", src, src, src, src) - if(4.0) - if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) - dat += "
Medical Record

" - dat += "
Name: [active1.fields["name"]] \ - ID: [active1.fields["id"]]
\n \ - Sex: [active1.fields["sex"]]
\n \ - Age: [active1.fields["age"]]
\n \ - Physical Status: [active1.fields["p_stat"]]
\n \ - Mental Status: [active1.fields["m_stat"]]
\ - Photo:
" - else - dat += "General Record Lost!
" - if ((istype(src.active2, /datum/data/record) && GLOB.data_core.medical.Find(src.active2))) - dat += "
\n
Medical Data

\nBlood Type: [active2.fields["b_type"]]
\n
\nMinor Disabilities: [active2.fields["mi_dis"]]
\nDetails: [active2.fields["mi_dis_d"]]
\n
\nMajor Disabilities: [active2.fields["ma_dis"]]
\nDetails: [active2.fields["ma_dis_d"]]
\n
\nAllergies: [active2.fields["alg"]]
\nDetails: [active2.fields["alg_d"]]
\n
\nCurrent Diseases: [active2.fields["cdi"]] (per disease info placed in log/comment section)
\nDetails: [active2.fields["cdi_d"]]
\n
\nImportant Notes:
\n\t[decode(src.active2.fields["notes"])]
\n
\n
Comments/Log

" - var/counter = 1 - while(src.active2.fields[text("com_[]", counter)]) - dat += text("[]
Delete Entry

", src.active2.fields[text("com_[]", counter)], src, counter) - counter++ - dat += text("Add Entry

", src) - dat += text("Delete Record (Medical Only)

", src) - else - dat += "Medical Record Lost!
" - dat += text("New Record

") - dat += text("\nPrint Record
\n", src) - dat += text("\nPrint Latest Bodyscan

\nBack
", src, src) - if(5) - dat += "
Medical Robot Monitor
" - dat += "Back" - dat += "
Medical Robots:" - var/bdat = null - for(var/obj/structure/machinery/bot/medbot/M in GLOB.machines) - - if(M.z != src.z) continue //only find medibots on the same z-level as the computer - var/turf/bl = get_turf(M) - if(bl) //if it can't find a turf for the medibot, then it probably shouldn't be showing up - bdat += "[M.name] - \[[bl.x],[bl.y]\] - [M.on ? "Online" : "Offline"]
" - if((!isnull(M.reagent_glass)) && M.use_beaker) - bdat += "Reservoir: \[[M.reagent_glass.reagents.total_volume]/[M.reagent_glass.reagents.maximum_volume]\]
" - else - bdat += "Using Internal Synthesizer.
" - if(!bdat) - dat += "
None detected
" - else - dat += "
[bdat]" + for(var/datum/data/record/medical_record as anything in GLOB.data_core.medical) + if(medical_record.fields["name"] == target_id.registered_name) + target_record_medical = medical_record + break + for(var/datum/data/record/general_record as anything in GLOB.data_core.general) + if(general_record.fields["name"] == target_id.registered_name) + target_record_general = general_record + break - else - dat += text("{Log In}", src) - show_browser(user, dat, "Medical Records", "med_rec") - onclose(user, "med_rec") - return - -/obj/structure/machinery/computer/med_data/Topic(href, href_list) - if(..()) - return + if(!target_record_medical || !target_record_general): + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to retrieve target records.\"") + return FALSE - if (!( GLOB.data_core.general.Find(src.active1) )) - src.active1 = null + return TRUE - if (!( GLOB.data_core.medical.Find(src.active2) )) - src.active2 = null - - if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (isRemoteControlling(usr))) - usr.set_interaction(src) - - if (href_list["temp"]) - src.temp = null - - if (href_list["scan"]) - if (src.scan) - - if(ishuman(usr)) - scan.forceMove(usr.loc) +/obj/structure/machinery/computer/double_id/med_data/laptop + name = "Medical Laptop" + desc = "Cheap Weyland-Yutani Laptop." + icon_state = "medlaptop" + density = FALSE - if(!usr.get_active_hand()) - usr.put_in_hands(scan) +// TGUI med +// ----------------------------------------------------------------------------------------------------- // +/obj/structure/machinery/computer/double_id/med_data/tgui_interact(mob/user, datum/tgui/ui) - scan = null + ui = SStgui.try_update_ui(user, src, ui) + if (!ui) + ui = new(user, src, "MedMod", name) + ui.open() - else - src.scan.forceMove(src.loc) - src.scan = null +/obj/structure/machinery/computer/double_id/med_data/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + var/mob/user = ui.user + playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) + switch(action) + if("selectHealthStatus") + target_record_general.fields[HEALTH] = params["health"] + return TRUE + if("selectCauseOfDeath") + target_record_medical.fields[DEATH] = params["death"] + return TRUE + if("authenticate") + var/obj/item/id_card = user.get_active_hand() + if (istype(id_card, /obj/item/card/id)) + if(user.drop_held_item()) + id_card.forceMove(src) + user_id_card = id_card + if(authenticate(user, user_id_card)) + return TRUE else - var/obj/item/I = usr.get_active_hand() - if (istype(I, /obj/item/card/id)) - if(usr.drop_held_item()) - I.forceMove(src) - src.scan = I - - else if (href_list["logout"]) - src.authenticated = null - src.screen = null - src.active1 = null - src.active2 = null - - else if (href_list["login"]) - - if (isRemoteControlling(usr)) - src.active1 = null - src.active2 = null - src.authenticated = usr.name - src.rank = "AI" - src.screen = 1 - - else if (istype(src.scan, /obj/item/card/id)) - src.active1 = null - src.active2 = null - - if (src.check_access(src.scan)) - src.authenticated = src.scan.registered_name - src.rank = src.scan.assignment - src.screen = 1 - - if (src.authenticated) - - if(href_list["screen"]) - src.screen = text2num(href_list["screen"]) - if(src.screen < 1) - src.screen = 1 - - src.active1 = null - src.active2 = null - - if (href_list["del_all"]) - src.temp = text("Are you sure you wish to delete all records?
\n\tYes
\n\tNo
", src, src) - - if (href_list["del_all2"]) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - GLOB.data_core.medical -= R - qdel(R) - //Foreach goto(494) - src.temp = "All records deleted." - - if (href_list["field"]) - var/a1 = src.active1 - var/a2 = src.active2 - switch(href_list["field"]) - if("sex") - if (istype(src.active1, /datum/data/record)) - if (src.active1.fields["sex"] == "Male") - src.active1.fields["sex"] = "Female" - else - src.active1.fields["sex"] = "Male" - if("age") - if (istype(src.active1, /datum/data/record)) - var/t1 = input("Please input age:", "Med. records", src.active1.fields["age"], null) as num - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active1 != a1)) - return - src.active1.fields["age"] = t1 - if("mi_dis") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["mi_dis"] = t1 - if("mi_dis_d") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["mi_dis_d"] = t1 - if("ma_dis") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["ma_dis"] = t1 - if("ma_dis_d") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["ma_dis_d"] = t1 - if("alg") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["alg"] = t1 - if("alg_d") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["alg_d"] = t1 - if("cdi") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["cdi"] = t1 - if("cdi_d") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["cdi_d"] = t1 - if("notes") - if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(html_encode(trim(input("Please summarize notes:", "Med. records", html_decode(src.active2.fields["notes"]), null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - src.active2.fields["notes"] = t1 - if("p_stat") - if (istype(src.active1, /datum/data/record)) - src.temp = text("Physical Condition:
\n\t*Deceased*
\n\t*SSD*
\n\tActive
\n\tPhysically Unfit
\n\tDisabled
", src, src, src, src, src) - if("m_stat") - if (istype(src.active1, /datum/data/record)) - src.temp = text("Mental Condition:
\n\t*Insane*
\n\t*Unstable*
\n\t*Watch*
\n\tStable
", src, src, src, src) - if("b_type") - if (istype(src.active2, /datum/data/record)) - src.temp = text("Blood Type:
\n\tA- A+
\n\tB- B+
\n\tAB- AB+
\n\tO- O+
", src, src, src, src, src, src, src, src) - - - if (href_list["p_stat"]) - if (src.active1) - switch(href_list["p_stat"]) - if("deceased") - src.active1.fields["p_stat"] = "*Deceased*" - if("ssd") - src.active1.fields["p_stat"] = "*SSD*" - if("active") - src.active1.fields["p_stat"] = "Active" - if("unfit") - src.active1.fields["p_stat"] = "Physically Unfit" - if("disabled") - src.active1.fields["p_stat"] = "Disabled" - - if (href_list["m_stat"]) - if (src.active1) - switch(href_list["m_stat"]) - if("insane") - src.active1.fields["m_stat"] = "*Insane*" - if("unstable") - src.active1.fields["m_stat"] = "*Unstable*" - if("watch") - src.active1.fields["m_stat"] = "*Watch*" - if("stable") - src.active1.fields["m_stat"] = "Stable" - - - if (href_list["b_type"]) - if (src.active2) - switch(href_list["b_type"]) - if("an") - src.active2.fields["b_type"] = "A-" - if("bn") - src.active2.fields["b_type"] = "B-" - if("abn") - src.active2.fields["b_type"] = "AB-" - if("on") - src.active2.fields["b_type"] = "O-" - if("ap") - src.active2.fields["b_type"] = "A+" - if("bp") - src.active2.fields["b_type"] = "B+" - if("abp") - src.active2.fields["b_type"] = "AB+" - if("op") - src.active2.fields["b_type"] = "O+" - - - if (href_list["del_r"]) - if (active2) - src.temp = text("Are you sure you wish to delete the record (Medical Portion Only)?
\n\tYes
\n\tNo
", src, src) - - if (href_list["del_r2"]) - QDEL_NULL(active2) - - if (href_list["d_rec"]) - var/datum/data/record/R = locate(href_list["d_rec"]) - var/datum/data/record/M = locate(href_list["d_rec"]) - if (!( GLOB.data_core.general.Find(R) )) - src.temp = "Record Not Found!" + if(!user_id_card) return - for(var/datum/data/record/E in GLOB.data_core.medical) - if ((E.fields["ref"] == R.fields["ref"] || E.fields["id"] == R.fields["id"])) - M = E - src.active1 = R - src.active2 = M - src.screen = 4 - - if (href_list["new"]) - if ((istype(src.active1, /datum/data/record) && !( istype(src.active2, /datum/data/record) ))) - var/datum/data/record/R = new /datum/data/record( ) - R.fields["name"] = src.active1.fields["name"] - R.fields["id"] = src.active1.fields["id"] - R.name = text("Medical Record #[]", R.fields["id"]) - R.fields["b_type"] = "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." - GLOB.data_core.medical += R - src.active2 = R - src.screen = 4 - - if (href_list["add_c"]) - if (!( istype(src.active2, /datum/data/record) )) - return - var/a2 = src.active2 - var/t1 = copytext(trim(strip_html(input("Add Comment:", "Med. records", null, null) as message)),1,MAX_MESSAGE_LEN) - if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || src.active2 != a2)) - return - var/counter = 1 - while(src.active2.fields[text("com_[]", counter)]) - counter++ - src.active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]
[t1]") - - if (href_list["del_c"]) - if ((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])])) - src.active2.fields[text("com_[]", href_list["del_c"])] = "Deleted" - - if (href_list["search"]) - var/t1 = stripped_input(usr, "Search String: (Name, DNA, or ID)", "Med. records") - if ((!( t1 ) || usr.stat || !( src.authenticated ) || usr.is_mob_restrained() || ((!in_range(src, usr)) && (!isRemoteControlling(usr))))) - return - src.active1 = null - src.active2 = null - t1 = lowertext(t1) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if ((lowertext(R.fields["name"]) == t1 || t1 == lowertext(R.fields["id"]))) - src.active2 = R - if (!active2) - temp = "Could not locate record [t1]." + if(ishuman(user)) + user_id_card.forceMove(user.loc) + if(!user.get_active_hand()) + user.put_in_hands(user_id_card) else - for(var/datum/data/record/E in GLOB.data_core.general) - if ((E.fields["name"] == src.active2.fields["name"] || E.fields["id"] == src.active2.fields["id"])) - src.active1 = E - src.screen = 4 - - if (href_list["print_p"]) - if (!( src.printing )) - src.printing = 1 - var/datum/data/record/record1 = null - var/datum/data/record/record2 = null - if ((istype(src.active1, /datum/data/record) && GLOB.data_core.general.Find(src.active1))) - record1 = active1 - if ((istype(src.active2, /datum/data/record) && GLOB.data_core.medical.Find(src.active2))) - record2 = active2 - playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) - sleep(40) - var/obj/item/paper/P = new /obj/item/paper( src.loc ) - P.info = "
Medical Record

" - if (record1) - P.info += text("Name: []
\nID: []
\nSex: []
\nAge: []
\nPhysical Status: []
\nMental Status: []
", record1.fields["name"], record1.fields["id"], record1.fields["sex"], record1.fields["age"], record1.fields["p_stat"], record1.fields["m_stat"]) - P.name = text("Medical Record ([])", record1.fields["name"]) - else - P.info += "General Record Lost!
" - P.name = "Medical Record" - if (record2) - P.info += "
\n
Medical Data

\nBlood Type: [record2.fields["b_type"]]
\n
\nMinor Disabilities: [record2.fields["mi_dis"]]
\nDetails: [record2.fields["mi_dis_d"]]
\n
\nMajor Disabilities: [record2.fields["ma_dis"]]
\nDetails: [record2.fields["ma_dis_d"]]
\n
\nAllergies: [record2.fields["alg"]]
\nDetails: [record2.fields["alg_d"]]
\n
\nCurrent Diseases: [record2.fields["cdi"]] (per disease info placed in log/comment section)
\nDetails: [record2.fields["cdi_d"]]
\n
\nImportant Notes:
\n\t[decode(record2.fields["notes"])]
\n
\n
Comments/Log

" - var/counter = 1 - while(record2.fields[text("com_[]", counter)]) - P.info += text("[]
", record2.fields[text("com_[]", counter)]) - counter++ - else - P.info += "Medical Record Lost!
" - P.info += "" - P.info += text("

This report was printed by [] [].
The [MAIN_SHIP_NAME],[]/[], []

\n",last_user_rank,last_user_name,time2text(world.timeofday, "MM/DD"),GLOB.game_year,worldtime2text()) - src.printing = null - - if(href_list["print_bs"])//Prints latest body scan - if(!(src.printing)) - src.printing = 1 - var/datum/data/record/record - if ((istype(src.active1, /datum/data/record) && GLOB.data_core.general.Find(src.active1))) - record = active1 - if(!record) return - playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) - sleep(40) - var/datum/asset/asset = get_asset_datum(/datum/asset/simple/paper) - var/obj/item/paper/P = new /obj/item/paper( src.loc ) - P.name = text("Scan: [], []",record.fields["name"],worldtime2text()) - P.info += text("

Official Weyland-Yutani Document
Scan Record

[]

\n
",record.fields["name"]) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["name"] == record.fields["name"]) - if(R.fields["last_scan_time"] && R.fields["last_scan_result"]) - P.info += R.fields["last_scan_result"] - break - else - P.info += "No scan on record." - P.info += text("

This report was printed by [] [].
The [MAIN_SHIP_NAME], []/[], []

\n",last_user_rank,last_user_name,time2text(world.timeofday, "MM/DD"),GLOB.game_year,worldtime2text()) - src.printing = null - - - - src.add_fingerprint(usr) - src.updateUsrDialog() - return - -/obj/structure/machinery/computer/med_data/emp_act(severity) - . = ..() - if(inoperable()) - return - - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if(prob(10/severity)) - switch(rand(1,6)) - if(1) - R.fields["name"] = "[pick(pick(GLOB.first_names_male), pick(GLOB.first_names_female))] [pick(GLOB.last_names)]" - if(2) - R.fields["sex"] = pick("Male", "Female") - if(3) - R.fields["age"] = rand(5, 85) - if(4) - R.fields["b_type"] = pick("A-", "B-", "AB-", "O-", "A+", "B+", "AB+", "O+") - if(5) - R.fields["p_stat"] = pick("*SSD*", "Active", "Physically Unfit", "Disabled") - if(6) - R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") - continue - - else if(prob(1)) - GLOB.data_core.medical -= R - qdel(R) - continue - - -/obj/structure/machinery/computer/med_data/laptop - name = "Medical Laptop" - desc = "Cheap Weyland-Yutani Laptop." - icon_state = "medlaptop" - density = FALSE + user_id_card.forceMove(loc) + user_id_card = null + if("logout") + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGOUT: Session end confirmed.\"") + authenticated = FALSE + if(ishuman(user)) + user_id_card.forceMove(user.loc) + if(!user.get_active_hand()) + user.put_in_hands(user_id_card) + else + user_id_card.forceMove(loc) + user_id_card = null + return TRUE + if("print") + if(!authenticated || !target_id_card) + return + + if(!COOLDOWN_FINISHED(src, print_cooldown)) + visible_message("[SPAN_BOLD("[src]")] states, \"PRINT ERROR: system is still on cooldown.\"") + return + + COOLDOWN_START(src, print_cooldown, PRINT_COOLDOWN_TIME ) + playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) + var/contents = {"

Medical Report

+ Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
+ For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+
+

General Information

+ Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+ Sex: [target_record_general?.fields["sex"]]
+ Age: [target_record_general?.fields["age"]]
+ Blood Type: [target_record_medical?.fields[BLOOD_TYPE]]
+
+

Medical Notes

+ General Notes: [target_record_medical?.fields[NOTES]]
+ Psychiatric History: [target_record_general?.fields[MENTAL]]
+ Disease History: [target_record_medical?.fields[DISEASE]]
+ Disability History: [target_record_medical?.fields[DISABILITY]]
+
+ "} + + // autopsy report gets shwacked ontop if it exists and the target stat is dead + if(target_record_general.fields[HEALTH] == "Deceased" && target_record_medical.fields[AUTOPSY_SUBMISSION]) + contents += {"

Autopsy Report

+ Autopsy Nites: [target_record_medical.fields[AUTOPSY_NOTES]]
+ Cause Of Death: [target_record_medical.fields[DEATH]]
+ "} + + var/obj/item/paper/med_report = new (loc) + med_report.name = "Medical Report" + med_report.info += contents + visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) + return TRUE + if("eject") + if(target_id_card) + if(ishuman(user)) + target_id_card.forceMove(user.loc) + if(!user.get_active_hand()) + user.put_in_hands(target_id_card) + else + target_id_card.forceMove(loc) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD EJECT: Data imprinted. Updating database... Success.\"") + target_record_general = null + target_record_medical = null + target_id_card = null + return TRUE + else + var/obj/item/card/id/id_card = user.get_active_hand() + if (istype(id_card, /obj/item/card/id)) + if(!retrieve_target_records(id_card)) + ui.close() + return + if(user.drop_held_item()) + id_card.forceMove(src) + target_id_card = id_card + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + update_static_data(user) + return TRUE + return FALSE + if("updateStatRecord") + if(params["stat_type"]) // 1 for medical + target_record_medical.fields[params["stat"]] = params["new_value"] + else // 0 for general + target_record_general.fields[params["stat"]] = params["new_value"] + return TRUE + if("submitReport") + if(!target_record_medical.fields[DEATH]) + visible_message("[SPAN_BOLD("[src]")] states, \"LOG ERROR: You must select a cause of death before submitting a report.\"") + return + target_record_medical.fields[AUTOPSY_SUBMISSION] = TRUE + return TRUE + +/obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) + var/list/data = list() + // TODO:make each data var a list instead of harcoding the stat in tgui. + data["name"] = target_record_general?.fields["name"] + data["health"] = target_record_general?.fields[HEALTH] + data["sex"] = target_record_general?.fields["sex"] + data["bloodType"] = target_record_medical?.fields[BLOOD_TYPE] + data["age"] = target_record_general?.fields["age"] + data["notes"] = target_record_medical?.fields[NOTES] + data["death"] = target_record_medical?.fields[DEATH] + data["mental"] = target_record_general?.fields[MENTAL] + data["disease"] = target_record_medical?.fields[DISEASE] + data["disability"] = target_record_medical?.fields[DISABILITY] + data["autopsy"] = target_record_medical?.fields[AUTOPSY_NOTES] + data["existingReport"] = target_record_medical?.fields[AUTOPSY_SUBMISSION] + + data["authenticated"] = authenticated + data["has_id"] = !!target_id_card + data["id_name"] = target_id_card ? target_id_card.name : "-----" + if(target_id_card) + data["id_rank"] = target_id_card.assignment ? target_id_card.assignment : "Unassigned" + data["id_owner"] = target_id_card.registered_name ? target_id_card.registered_name : "-----" + data["access_on_card"] = target_id_card.access + target_id_card.faction_group + data["id_account"] = target_id_card.associated_account_number + + return data + +#undef AUTOPSY_NOTES +#undef NOTES +#undef MENTAL +#undef DISEASE +#undef DISABILITY +#undef HEALTH +#undef DEATH +#undef BLOOD_TYPE +#undef AUTOPSY_SUBMISSION diff --git a/code/game/objects/items/circuitboards/computer.dm b/code/game/objects/items/circuitboards/computer.dm index ecdfba00719d..1d4d14cae84b 100644 --- a/code/game/objects/items/circuitboards/computer.dm +++ b/code/game/objects/items/circuitboards/computer.dm @@ -49,7 +49,7 @@ /obj/item/circuitboard/computer/med_data name = "Circuit board (Medical Records)" - build_path = /obj/structure/machinery/computer/med_data + build_path = /obj/structure/machinery/computer/double_id/med_data /obj/item/circuitboard/computer/pandemic name = "Circuit board (PanD.E.M.I.C. 2200)" @@ -65,7 +65,7 @@ /obj/item/circuitboard/computer/card name = "Circuit board (ID Computer)" - build_path = /obj/structure/machinery/computer/card + build_path = /obj/structure/machinery/computer/double_id/card /obj/item/circuitboard/computer/teleporter name = "Circuit board (Teleporter)" diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index e02bb930d416..d7b53ddd986c 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -8,22 +8,19 @@ #define CARDCON_DEPARTMENT_ENGINEERING "Engineering" #define CARDCON_DEPARTMENT_COMMAND "Command" -/obj/structure/machinery/computer/card - name = "Identification Computer" - desc = "Terminal for programming USCM employee ID card access." - icon_state = "id" - req_access = list(ACCESS_MARINE_DATABASE) - circuit = /obj/item/circuitboard/computer/card +// Parent code for computers that use a user and target card id +// ------------------------------------------------------------------------------------------------------------------------------- // +/obj/structure/machinery/computer/double_id + name = "Computer" + desc = "Terminal that takes a User and target ID" + // user who is modifying the target var/obj/item/card/id/user_id_card + // the poor soul whos status needs to be updated as deceased. var/obj/item/card/id/target_id_card - // What factions we are able to modify - var/list/factions = list(FACTION_MARINE) - var/printing - - var/is_centcom = FALSE + // if we are currently authenticated and logged in. var/authenticated = FALSE -/obj/structure/machinery/computer/card/proc/authenticate(mob/user, obj/item/card/id/id_card) +/obj/structure/machinery/computer/double_id/proc/authenticate(mob/user, obj/item/card/id/id_card) if(!id_card) visible_message("[SPAN_BOLD("[src]")] states, \"AUTH ERROR: Authority confirmation card is missing!\"") return FALSE @@ -36,14 +33,107 @@ visible_message("[SPAN_BOLD("[src]")] states, \"AUTH ERROR: You have not enough authority! Access denied.\"") return FALSE +// copy pasta, yeah some silly logic, it needs to be rewritten. I'll do it later. +/obj/structure/machinery/computer/double_id/attackby(obj/card, mob/user) + if(istype(card, /obj/item/card/id)) + if(!operable()) + to_chat(user, SPAN_NOTICE("You tried to inject \the [card] but \the [src] remains silent.")) + return + var/obj/item/card/id/idcard = card + if(check_access(idcard)) + if(!user_id_card) + if(user.drop_held_item()) + card.forceMove(src) + user_id_card = card + authenticate(user, user_id_card) + else if(!target_id_card) + if(user.drop_held_item()) + card.forceMove(src) + target_id_card = card + update_static_data(user) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + else + to_chat(user, "Both slots are full already. Remove a card first.") + else + if(!target_id_card) + if(user.drop_held_item()) + card.forceMove(src) + target_id_card = card + update_static_data(user) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + else + to_chat(user, "Both slots are full already. Remove a card first.") + else + ..() + +/obj/structure/machinery/computer/double_id/verb/eject_id() + set category = "Object" + set name = "Eject ID Card" + set src in oview(1) + + if(!usr || usr.is_mob_incapacitated()) return + + if(user_id_card) + user_id_card.loc = get_turf(src) + if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) + usr.put_in_hands(user_id_card) + if(operable()) // Powered. Console can response. + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGOUT: Session end confirmed.\"") + else + to_chat(usr, "You remove \the [user_id_card] from \the [src].") + authenticated = FALSE // No card - no access + user_id_card = null + + else if(target_id_card) + target_id_card.loc = get_turf(src) + if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) + usr.put_in_hands(target_id_card) + if(operable()) // Powered. Make comp proceed ejection + GLOB.data_core.manifest_modify(target_id_card.registered_name, target_id_card.registered_ref, target_id_card.assignment, target_id_card.rank) + target_id_card.name = text("[target_id_card.registered_name]'s ID Card ([target_id_card.assignment])") + visible_message("[SPAN_BOLD("[src]")] states, \"CARD EJECT: Data imprinted. Updating database... Success.\"") + else + to_chat(usr, "You remove \the [target_id_card] from \the [src].") + target_id_card = null + + else + to_chat(usr, "There is nothing to remove from the console.") + return + +//made these procs part of the parent since it has the same functionality anyway +/obj/structure/machinery/computer/double_id/attack_hand(mob/user as mob) + if(..() || inoperable()) + return + user.set_interaction(src) + tgui_interact(user) + +/obj/structure/machinery/computer/double_id/attack_remote(mob/user as mob) + return attack_hand(user) + +/obj/structure/machinery/computer/double_id/bullet_act() + return FALSE +// ------------------------------------------------------------------------------------------------------------------------------- // + +// Identification Computer +// ------------------------------------------------------------------------------------------------------------------------------- // +/obj/structure/machinery/computer/double_id/card + name = "Identification Computer" + desc = "Terminal for programming USCM employee ID card access." + icon_state = "id" + req_access = list(ACCESS_MARINE_DATABASE) + circuit = /obj/item/circuitboard/computer/card + // What factions we are able to modify + var/list/factions = list(FACTION_MARINE) + var/printing + var/is_centcom = FALSE -/obj/structure/machinery/computer/card/tgui_interact(mob/user, datum/tgui/ui) +/obj/structure/machinery/computer/double_id/card/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if (!ui) ui = new(user, src, "CardMod", name) ui.open() -/obj/structure/machinery/computer/card/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) +/obj/structure/machinery/computer/double_id/card/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) . = ..() if(.) return @@ -287,7 +377,7 @@ log_idmod(target_id_card, " [user.real_name] changed the account number to '[account]'. ", key_name_admin(user)) return TRUE -/obj/structure/machinery/computer/card/ui_static_data(mob/user) +/obj/structure/machinery/computer/double_id/card/ui_static_data(mob/user) var/list/data = list() data["station_name"] = MAIN_SHIP_NAME data["centcom_access"] = is_centcom @@ -369,7 +459,7 @@ return data -/obj/structure/machinery/computer/card/ui_data(mob/user) +/obj/structure/machinery/computer/double_id/card/ui_data(mob/user) var/list/data = list() data["station_name"] = MAIN_SHIP_NAME @@ -385,86 +475,6 @@ return data -/obj/structure/machinery/computer/card/attackby(obj/O, mob/user) - if(istype(O, /obj/item/card/id)) - if(!operable()) - to_chat(user, SPAN_NOTICE("You tried to inject \the [O] but \the [src] remains silent.")) - return - var/obj/item/card/id/idcard = O - if(check_access(idcard)) - if(!user_id_card) - if(user.drop_held_item()) - O.forceMove(src) - user_id_card = O - authenticate(user, user_id_card) - else if(!target_id_card) - if(user.drop_held_item()) - O.forceMove(src) - target_id_card = O - update_static_data(user) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") - else - to_chat(user, "Both slots are full already. Remove a card first.") - else - if(!target_id_card) - if(user.drop_held_item()) - O.forceMove(src) - target_id_card = O - update_static_data(user) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") - else - to_chat(user, "Both slots are full already. Remove a card first.") - else - ..() - -/obj/structure/machinery/computer/card/attack_remote(mob/user as mob) - return attack_hand(user) - -/obj/structure/machinery/computer/card/bullet_act() - return 0 - -/obj/structure/machinery/computer/card/verb/eject_id() - set category = "Object" - set name = "Eject ID Card" - set src in oview(1) - - if(!usr || usr.is_mob_incapacitated()) return - - if(user_id_card) - user_id_card.loc = get_turf(src) - if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) - usr.put_in_hands(user_id_card) - if(operable()) // Powered. Console can response. - visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGOUT: Session end confirmed.\"") - else - to_chat(usr, "You remove \the [user_id_card] from \the [src].") - authenticated = FALSE // No card - no access - user_id_card = null - - else if(target_id_card) - target_id_card.loc = get_turf(src) - if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) - usr.put_in_hands(target_id_card) - if(operable()) // Powered. Make comp proceed ejection - GLOB.data_core.manifest_modify(target_id_card.registered_name, target_id_card.registered_ref, target_id_card.assignment, target_id_card.rank) - target_id_card.name = text("[target_id_card.registered_name]'s ID Card ([target_id_card.assignment])") - visible_message("[SPAN_BOLD("[src]")] states, \"CARD EJECT: Data imprinted. Updating database... Success.\"") - else - to_chat(usr, "You remove \the [target_id_card] from \the [src].") - target_id_card = null - - else - to_chat(usr, "There is nothing to remove from the console.") - return - -/obj/structure/machinery/computer/card/attack_hand(mob/user as mob) - if(..()) - return - if(inoperable()) - return - user.set_interaction(src) - tgui_interact(user) - #undef CARDCON_DEPARTMENT_MISC #undef CARDCON_DEPARTMENT_MARINE #undef CARDCON_DEPARTMENT_SECURITY @@ -475,6 +485,10 @@ #undef CARDCON_DEPARTMENT_ENGINEERING #undef CARDCON_DEPARTMENT_COMMAND +// ------------------------------------------------------------------------------------------------------------------------------- // + +// TODO: RECODE THE SQUAD CHANGER + //This console changes a marine's squad. It's very simple. //It also does not: change or increment the squad count (used in the login randomizer), nor does it check for jobs. //Which means you could get sillyiness like "Alpha Sulaco Chief Medical Officer" or "Delta Logistics Officer". diff --git a/maps/map_files/BigRed/BigRed.dmm b/maps/map_files/BigRed/BigRed.dmm index 82e04ca58330..7144df260661 100644 --- a/maps/map_files/BigRed/BigRed.dmm +++ b/maps/map_files/BigRed/BigRed.dmm @@ -16768,7 +16768,7 @@ /turf/open/floor, /area/bigredv2/outside/office_complex) "aXu" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor{ icon_state = "white" }, @@ -17841,7 +17841,7 @@ /area/bigredv2/outside/admin_building) "bbm" = ( /obj/structure/surface/table, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /turf/open/floor{ @@ -38915,7 +38915,7 @@ }, /area/bigredv2/caves_north) "tLO" = ( -/obj/structure/machinery/computer/med_data{ +/obj/structure/machinery/computer/double_id/med_data{ density = 0; pixel_y = 16 }, diff --git a/maps/map_files/BigRed/sprinkles/40.viro_open.dmm b/maps/map_files/BigRed/sprinkles/40.viro_open.dmm index 05e058c4071a..f4a0e844e3f3 100644 --- a/maps/map_files/BigRed/sprinkles/40.viro_open.dmm +++ b/maps/map_files/BigRed/sprinkles/40.viro_open.dmm @@ -473,7 +473,7 @@ /area/bigredv2/outside/virology) "bF" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 8 }, /turf/open/floor{ diff --git a/maps/map_files/BigRed/standalone/medbay-v3.dmm b/maps/map_files/BigRed/standalone/medbay-v3.dmm index 80397d168ba7..f179757905da 100644 --- a/maps/map_files/BigRed/standalone/medbay-v3.dmm +++ b/maps/map_files/BigRed/standalone/medbay-v3.dmm @@ -181,7 +181,7 @@ }, /area/bigredv2/outside/medical) "aF" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor{ icon_state = "whitegreenfull" }, diff --git a/maps/map_files/CORSAT/Corsat.dmm b/maps/map_files/CORSAT/Corsat.dmm index 6c179dbc8b2c..9e422e687c51 100644 --- a/maps/map_files/CORSAT/Corsat.dmm +++ b/maps/map_files/CORSAT/Corsat.dmm @@ -2996,7 +2996,7 @@ /area/corsat/omega/offices) "aiR" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/card, +/obj/structure/machinery/computer/double_id/card, /obj/structure/machinery/computer/guestpass, /turf/open/floor/corsat{ dir = 5; @@ -5709,7 +5709,7 @@ /area/corsat/gamma/medbay/morgue) "aqS" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/corsat{ dir = 1; icon_state = "greenwhite" @@ -16441,7 +16441,7 @@ /obj/structure/machinery/light{ dir = 8 }, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /obj/structure/surface/table/woodentable/fancy, @@ -27994,7 +27994,7 @@ /area/corsat/omega/complex) "bAK" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/corsat{ @@ -28117,7 +28117,7 @@ /area/corsat/gamma/medbay) "bBd" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/corsat{ dir = 4; icon_state = "greenwhite" @@ -29350,7 +29350,7 @@ /obj/structure/window/reinforced{ dir = 8 }, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /turf/open/floor/corsat{ @@ -38752,7 +38752,7 @@ /area/corsat/omega/hangar/office) "eoZ" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 8 }, /turf/open/floor/corsat{ @@ -54333,7 +54333,7 @@ /area/corsat/gamma/residential) "pVL" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /turf/open/floor/corsat{ @@ -55537,7 +55537,7 @@ /area/corsat/sigma/airlock/south) "qLI" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 1 }, /turf/open/floor/corsat{ @@ -65095,7 +65095,7 @@ /obj/structure/pipes/standard/simple/hidden/green{ dir = 4 }, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /turf/open/floor/corsat{ diff --git a/maps/map_files/DesertDam/Desert_Dam.dmm b/maps/map_files/DesertDam/Desert_Dam.dmm index fff406145a3a..9f1a4f9e7577 100644 --- a/maps/map_files/DesertDam/Desert_Dam.dmm +++ b/maps/map_files/DesertDam/Desert_Dam.dmm @@ -26737,7 +26737,7 @@ }, /area/desert_dam/building/security/southern_hallway) "bGP" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /obj/structure/machinery/light{ dir = 1 }, @@ -39194,7 +39194,7 @@ /turf/open/floor/wood, /area/desert_dam/building/medical/CMO) "cvl" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/wood, /area/desert_dam/building/medical/CMO) "cvm" = ( @@ -39381,7 +39381,7 @@ }, /area/desert_dam/building/medical/lobby) "cvP" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /obj/structure/window/reinforced{ dir = 1 }, @@ -40946,7 +40946,7 @@ }, /area/desert_dam/building/medical/office2) "cAD" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/prison{ dir = 1; icon_state = "whitered" @@ -40989,7 +40989,7 @@ }, /area/desert_dam/building/medical/emergency_room) "cAI" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/prison{ dir = 1; icon_state = "whitered" @@ -43715,7 +43715,7 @@ }, /area/desert_dam/building/medical/virology_wing) "cIO" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/prison{ dir = 1; icon_state = "whitegreen" @@ -43958,7 +43958,7 @@ /area/desert_dam/building/medical/treatment_room) "cJC" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/prison{ @@ -43980,7 +43980,7 @@ }, /area/desert_dam/building/medical/treatment_room) "cJF" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/prison{ dir = 10; icon_state = "whitegreenfull" @@ -51496,7 +51496,7 @@ /turf/open/desert/dirt, /area/desert_dam/exterior/valley/bar_valley_dam) "dun" = ( -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /obj/structure/surface/table/woodentable/fancy, /turf/open/floor{ dir = 8; @@ -51625,7 +51625,7 @@ }, /area/desert_dam/interior/caves/temple) "duU" = ( -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /obj/structure/surface/table/woodentable/fancy, /turf/open/floor/wood, /area/desert_dam/building/administration/office) @@ -51652,7 +51652,7 @@ }, /area/desert_dam/building/administration/overseer_office) "duZ" = ( -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /obj/structure/surface/table/woodentable/fancy, /turf/open/floor{ dir = 8; diff --git a/maps/map_files/FOP_v2_Cellblocks/Prison_Station_FOP.dmm b/maps/map_files/FOP_v2_Cellblocks/Prison_Station_FOP.dmm index a03946d3c6cf..2cae8ed4166c 100644 --- a/maps/map_files/FOP_v2_Cellblocks/Prison_Station_FOP.dmm +++ b/maps/map_files/FOP_v2_Cellblocks/Prison_Station_FOP.dmm @@ -606,7 +606,7 @@ /area/space) "abs" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/prison{ @@ -747,7 +747,7 @@ /area/prison/research/secret/bioengineering) "abL" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/prison{ icon_state = "whitepurplefull" }, @@ -5206,7 +5206,7 @@ /area/prison/research/RD) "anT" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/carpet, @@ -8593,7 +8593,7 @@ /area/prison/medbay) "axl" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/prison{ @@ -11502,7 +11502,7 @@ /area/prison/medbay) "aFO" = ( /obj/structure/surface/table/reinforced, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/prison{ dir = 10; icon_state = "whitegreenfull" @@ -15130,7 +15130,7 @@ /area/prison/command/secretary_office) "aQH" = ( /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/carpet, /area/prison/command/secretary_office) "aQI" = ( @@ -34990,7 +34990,7 @@ /area/prison/cellblock/highsec/south/south) "bYA" = ( /obj/structure/surface/table/woodentable, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/prison, /area/prison/security/head) "bYB" = ( diff --git a/maps/map_files/FOP_v3_Sciannex/Fiorina_SciAnnex.dmm b/maps/map_files/FOP_v3_Sciannex/Fiorina_SciAnnex.dmm index f6e85338a637..bde81d0a4e55 100644 --- a/maps/map_files/FOP_v3_Sciannex/Fiorina_SciAnnex.dmm +++ b/maps/map_files/FOP_v3_Sciannex/Fiorina_SciAnnex.dmm @@ -4340,7 +4340,7 @@ health = 80 }, /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4 }, /turf/open/floor/prison{ @@ -23963,7 +23963,7 @@ /area/fiorina/tumor/servers) "ouH" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 1 }, /turf/open/floor/plating/plating_catwalk, @@ -26175,7 +26175,7 @@ /area/fiorina/tumor/ice_lab) "pSU" = ( /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/wood, /area/fiorina/station/security/wardens) "pTj" = ( diff --git a/maps/map_files/FOP_v3_Sciannex/sprinkles/10.scavshipholder.dmm b/maps/map_files/FOP_v3_Sciannex/sprinkles/10.scavshipholder.dmm index b2a660473a19..3627a6f43574 100644 --- a/maps/map_files/FOP_v3_Sciannex/sprinkles/10.scavshipholder.dmm +++ b/maps/map_files/FOP_v3_Sciannex/sprinkles/10.scavshipholder.dmm @@ -236,7 +236,7 @@ /area/template_noop) "pw" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 1 }, /turf/open/floor/plating/plating_catwalk, diff --git a/maps/map_files/Kutjevo/Kutjevo.dmm b/maps/map_files/Kutjevo/Kutjevo.dmm index b1beb0dfc2b1..fcebcd699b96 100644 --- a/maps/map_files/Kutjevo/Kutjevo.dmm +++ b/maps/map_files/Kutjevo/Kutjevo.dmm @@ -10003,7 +10003,7 @@ /turf/open/floor/kutjevo/colors/cyan, /area/kutjevo/interior/complex/med) "nCt" = ( -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 4 }, /obj/structure/surface/table/reinforced/prison, @@ -10308,7 +10308,7 @@ /turf/open/auto_turf/sand/layer0, /area/kutjevo/exterior/Northwest_Colony) "nRk" = ( -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 4 }, /obj/structure/surface/table/reinforced/prison, diff --git a/maps/map_files/LV624/LV624.dmm b/maps/map_files/LV624/LV624.dmm index 46f5a179a50e..fc1bc1bce242 100644 --- a/maps/map_files/LV624/LV624.dmm +++ b/maps/map_files/LV624/LV624.dmm @@ -11849,7 +11849,7 @@ /area/lv624/lazarus/hop) "aYM" = ( /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /obj/structure/machinery/light/small{ dir = 8 }, diff --git a/maps/map_files/New_Varadero/New_Varadero.dmm b/maps/map_files/New_Varadero/New_Varadero.dmm index 1450edbbd180..ab24227cc7d6 100644 --- a/maps/map_files/New_Varadero/New_Varadero.dmm +++ b/maps/map_files/New_Varadero/New_Varadero.dmm @@ -15596,7 +15596,7 @@ /area/varadero/interior/caves/east) "kfJ" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_y = 3 }, /turf/open/floor/shiva{ @@ -24583,7 +24583,7 @@ }, /area/varadero/interior/maintenance/security) "pOz" = ( -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 8 }, /obj/structure/surface/table/reinforced/prison, diff --git a/maps/map_files/USS_Almayer/USS_Almayer.dmm b/maps/map_files/USS_Almayer/USS_Almayer.dmm index c87ab7b4c09a..bc217bb2c7fb 100644 --- a/maps/map_files/USS_Almayer/USS_Almayer.dmm +++ b/maps/map_files/USS_Almayer/USS_Almayer.dmm @@ -5922,7 +5922,7 @@ /area/almayer/medical/morgue) "aEO" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 8 }, /obj/structure/machinery/light{ @@ -10771,7 +10771,7 @@ }, /area/almayer/living/cryo_cells) "bho" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /turf/open/floor/almayer{ icon_state = "sterile_green_side" }, @@ -11321,7 +11321,7 @@ /area/almayer/engineering/upper_engineering/starboard) "blZ" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop, +/obj/structure/machinery/computer/double_id/med_data/laptop, /turf/open/floor/almayer{ icon_state = "sterile_green_corner" }, @@ -12869,7 +12869,7 @@ /area/almayer/hallways/lower/starboard_midship_hallway) "bwR" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 1; pixel_y = -4 }, @@ -26749,7 +26749,7 @@ /obj/structure/machinery/computer/squad_changer{ pixel_x = -9 }, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ pixel_x = 9 }, /turf/open/floor/almayer{ @@ -30033,7 +30033,7 @@ "gkK" = ( /obj/structure/pipes/standard/simple/hidden/supply, /obj/structure/surface/table/reinforced/almayer_B, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 8 }, /turf/open/floor/almayer{ @@ -32007,7 +32007,7 @@ /obj/structure/machinery/computer/secure_data{ dir = 4 }, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 4; pixel_y = -18 }, @@ -37452,7 +37452,7 @@ /area/almayer/living/port_emb) "iQB" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 4; layer = 3.2; pixel_y = 4 @@ -56345,7 +56345,7 @@ /area/almayer/command/combat_correspondent) "phw" = ( /obj/structure/surface/table/reinforced/almayer_B, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 8 }, /turf/open/floor/almayer{ @@ -59323,7 +59323,7 @@ pixel_y = 9; req_access_txt = "28" }, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 1; pixel_x = 6; pixel_y = -4 @@ -65345,7 +65345,7 @@ /area/almayer/living/grunt_rnr) "smw" = ( /obj/structure/surface/table/reinforced/almayer_B, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 8 }, /obj/item/device/flashlight/lamp{ @@ -80275,7 +80275,7 @@ /area/almayer/living/grunt_rnr) "xjt" = ( /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 4; pixel_x = 2 }, @@ -81922,7 +81922,7 @@ }, /area/almayer/hallways/upper/starboard) "xMA" = ( -/obj/structure/machinery/computer/med_data, +/obj/structure/machinery/computer/double_id/med_data, /obj/structure/sign/safety/terminal{ pixel_x = 8; pixel_y = -32 diff --git a/maps/map_files/Whiskey_Outpost_v2/Whiskey_Outpost_v2.dmm b/maps/map_files/Whiskey_Outpost_v2/Whiskey_Outpost_v2.dmm index 46200d9f79e4..f065c70cbfd2 100644 --- a/maps/map_files/Whiskey_Outpost_v2/Whiskey_Outpost_v2.dmm +++ b/maps/map_files/Whiskey_Outpost_v2/Whiskey_Outpost_v2.dmm @@ -758,7 +758,7 @@ /area/whiskey_outpost/inside/cic) "cJ" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 8 }, /turf/open/floor/prison{ @@ -1731,7 +1731,7 @@ /area/whiskey_outpost/outside/south/very_far) "gA" = ( /obj/structure/surface/table/woodentable/fancy, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 1 }, /turf/open/floor/prison{ @@ -10709,7 +10709,7 @@ /area/whiskey_outpost/inside/supply) "On" = ( /obj/structure/surface/table/reinforced/prison, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ pixel_x = -6; pixel_y = 3 }, diff --git a/maps/shuttles/ert_shuttle_big.dmm b/maps/shuttles/ert_shuttle_big.dmm index f3983899e249..034689e51c50 100644 --- a/maps/shuttles/ert_shuttle_big.dmm +++ b/maps/shuttles/ert_shuttle_big.dmm @@ -328,7 +328,7 @@ /area/shuttle/ert) "tf" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/card, +/obj/structure/machinery/computer/double_id/card, /turf/open/floor/almayer{ icon_state = "plate" }, @@ -653,7 +653,7 @@ /area/shuttle/ert) "Mx" = ( /obj/structure/surface/table/almayer, -/obj/structure/machinery/computer/med_data/laptop{ +/obj/structure/machinery/computer/double_id/med_data/laptop{ dir = 8 }, /turf/open/floor/almayer{ diff --git a/maps/templates/Chinook.dmm b/maps/templates/Chinook.dmm index bc16f23270fa..04da33b251df 100644 --- a/maps/templates/Chinook.dmm +++ b/maps/templates/Chinook.dmm @@ -376,7 +376,7 @@ }, /area/adminlevel/chinook/sec) "bc" = ( -/obj/structure/machinery/computer/card, +/obj/structure/machinery/computer/double_id/card, /obj/structure/surface/table/reinforced/black, /turf/open/floor/carpet{ desc = "Plush, waterproof carpet. Apparently it's fire resistant while remaining quite soft."; @@ -1950,7 +1950,7 @@ /area/adminlevel/chinook/engineering) "fK" = ( /obj/structure/surface/table/reinforced/black, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 4 }, /turf/open/floor/carpet{ @@ -8247,7 +8247,7 @@ }, /area/adminlevel/chinook/sec) "Ah" = ( -/obj/structure/machinery/computer/card, +/obj/structure/machinery/computer/double_id/card, /obj/structure/surface/table/reinforced/black, /turf/open/floor/carpet{ desc = "Plush, waterproof carpet. Apparently it's fire resistant while remaining quite soft."; @@ -11790,7 +11790,7 @@ /turf/open/floor/kutjevo/multi_tiles, /area/adminlevel/chinook/event) "Me" = ( -/obj/structure/machinery/computer/card, +/obj/structure/machinery/computer/double_id/card, /obj/structure/machinery/light{ dir = 1 }, @@ -15238,7 +15238,7 @@ }, /area/adminlevel/chinook) "Xh" = ( -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 1 }, /obj/structure/machinery/light, @@ -15933,7 +15933,7 @@ "Zj" = ( /obj/structure/machinery/light, /obj/structure/surface/table/reinforced/almayer_B, -/obj/structure/machinery/computer/card{ +/obj/structure/machinery/computer/double_id/card{ dir = 1 }, /turf/open/floor/almayer{ diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedMod.jsx new file mode 100644 index 000000000000..a50dacabe905 --- /dev/null +++ b/tgui/packages/tgui/interfaces/MedMod.jsx @@ -0,0 +1,295 @@ +import { useBackend, useLocalState } from '../backend'; +import { Box, Button, Stack, Input, Dropdown, Section, Tabs, Flex, Icon, Table } from '../components'; +import { Window } from '../layouts'; + +export const MedMod = (props) => { + const [tab2, setTab2] = useLocalState('tab2', 1); + return ( + + + + + setTab2(1)}> + Health Status + + setTab2(2)}> + Medical Record + + + {tab2 === 1 && } + {tab2 === 2 && } + + + + ); +}; + +export const MedicalRecord = (props) => { + const { act, data } = useBackend(); + const [tab, setTab] = useLocalState('tab', 1); + const { authenticated, name, has_id, notes, health, death, mental, disease, disability, autopsy, existingReport } = data; + return ( + <> +
+ act('print') + } + /> + }>
+ {!!has_id && !!authenticated && ( + + + setTab(1)}> + Medical Notes + + setTab(2)}> + Autopsy Report + + + {tab === 1 && ( +
+ + General Notes: + + + act('updateStatRecord', { + stat_type: statType.MEDICAL, // yes, it's hardcoded. Fix later. + stat: stat.NOTES, + new_value: value, + }) + } + /> + + Psychiatric History: + + + act('updateStatRecord', { + stat_type: statType.GENERAL, + stat: stat.MENTAL, + new_value: value, + }) + } /> + + Disease History: + + + act('updateStatRecord', { + stat_type: statType.MEDICAL, + stat: stat.DISEASE, // we hardcode around here boyoz. + new_value: value, + }) + } /> + + Disability History: + + + act('updateStatRecord', { + stat_type: statType.MEDICAL, + stat: stat.DISABILITY, + new_value: value, + }) + }/> + + +
+ )} + {tab === 2 && (// should I have used a table instead of stack hell? Probably. +
+ + { health == "Deceased" && !existingReport && ( + + + Autopsy Notes: + + + act('updateStatRecord', { + stat_type: statType.MEDICAL, + stat: stat.AUTOPSY, // spaghetti noodle code will get fixed eventually, I promise. + new_value: value, + }) + } /> + + + + + + Cause Of Death: + + act('selectCauseOfDeath', { death: value })} + displayText={death} + /> + + + + +
+ )} +
+ )} + + ); +}; + +export const HealthStatus = (props) => { + const { act, data } = useBackend(); + const { + authenticated, + id_owner, + has_id, + id_name, + name, + sex, + age, + bloodType, + health, + } = data; + return ( + <> +
+
+ {!!has_id && !!authenticated && ( +
+ + + + + act('selectHealthStatus', { health: value }) + } + displayText={health} + /> + + + + Name: {name} + Sex: {sex} + Age: {age} + Blood Type: {bloodType} + + + + + + + +
+ )} + + ); +}; + +// ----- const-------- // +const healthStatusOptions = ['Unfit', 'Deceased', 'Active']; + +const deathOptions = [ + 'Organ Failure', + 'Decapitation', + 'Burn Trauma', + 'Bullet Wound', + 'Blunt Force Trauma', + 'Blood Loss', + 'Disease', +]; + +const colors = { + 'Deceased': 'red', + 'Active': 'blue', + 'Unfit': 'yellow', +}; + +// i'll do it with a list instead, hardcoded for now. +const statType = { + MEDICAL: 1, + GENERAL: 0 +}; + +// stats that have input strings. +const stat = { + AUTOPSY: "a_stat", + NOTES: "notes", + MENTAL: "m_stat", + DISEASE: "cdi", + DISABILITY: "mi_dis" +}; +// ----- const -------- // From 925eb0e91038cf2426326d55704f4b5134360e2a Mon Sep 17 00:00:00 2001 From: DOOM Date: Wed, 8 May 2024 23:31:56 -0700 Subject: [PATCH 002/104] e --- tgui/packages/tgui/interfaces/MedMod.jsx | 244 ++++++++++++----------- 1 file changed, 130 insertions(+), 114 deletions(-) diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedMod.jsx index a50dacabe905..acd93a6258af 100644 --- a/tgui/packages/tgui/interfaces/MedMod.jsx +++ b/tgui/packages/tgui/interfaces/MedMod.jsx @@ -6,7 +6,7 @@ export const MedMod = (props) => { const [tab2, setTab2] = useLocalState('tab2', 1); return ( - + setTab2(1)}> @@ -27,19 +27,25 @@ export const MedMod = (props) => { export const MedicalRecord = (props) => { const { act, data } = useBackend(); const [tab, setTab] = useLocalState('tab', 1); - const { authenticated, name, has_id, notes, health, death, mental, disease, disability, autopsy, existingReport } = data; + const { + authenticated, + name, + has_id, + notes, + health, + death, + mental, + disease, + disability, + autopsy, + existingReport, + } = data; return ( <>
- act('print') - } - /> +
{!!has_id && !!authenticated && ( @@ -56,100 +62,116 @@ export const MedicalRecord = (props) => { General Notes: - - act('updateStatRecord', { - stat_type: statType.MEDICAL, // yes, it's hardcoded. Fix later. - stat: stat.NOTES, - new_value: value, - }) - } + + act('updateStatRecord', { + stat_type: statType.MEDICAL, // yes, it's hardcoded. Fix later. + stat: stat.NOTES, + new_value: value, + }) + } /> Psychiatric History: - - act('updateStatRecord', { - stat_type: statType.GENERAL, - stat: stat.MENTAL, - new_value: value, - }) - } /> + + act('updateStatRecord', { + stat_type: statType.GENERAL, + stat: stat.MENTAL, + new_value: value, + }) + } + /> Disease History: - - act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.DISEASE, // we hardcode around here boyoz. - new_value: value, - }) - } /> + + act('updateStatRecord', { + stat_type: statType.MEDICAL, + stat: stat.DISEASE, // we hardcode around here boyoz. + new_value: value, + }) + } + /> Disability History: - - act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.DISABILITY, - new_value: value, - }) - }/> + + act('updateStatRecord', { + stat_type: statType.MEDICAL, + stat: stat.DISABILITY, + new_value: value, + }) + } + /> )} - {tab === 2 && (// should I have used a table instead of stack hell? Probably. + {tab === 2 && ( // should I have used a table instead of stack hell? Probably.
- { health == "Deceased" && !existingReport && ( - - - Autopsy Notes: - - - act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.AUTOPSY, // spaghetti noodle code will get fixed eventually, I promise. - new_value: value, - }) - } /> - - - - - - Cause Of Death: - - act('selectCauseOfDeath', { death: value })} - displayText={death} - /> - - - - -
+ } + /> {!!has_id && !!authenticated && ( @@ -57,7 +58,7 @@ export const MedicalRecord = (props) => { Autopsy Report
- {tab === 1 && ( + {tab === 1 && ( // to do, just map it instead.
General Notes: @@ -222,16 +223,14 @@ export const HealthStatus = (props) => {
-
+ {!!has_id && !!authenticated && ( +
+ + - Ask or force person, to place hand on my scanner. + {human ? `Selected for squad transfer: ${human}` : 'Ask or force person to place hand on my scanner.'} - - )} - {!!human && ( - - Selected for squad transfer: {human} - - )} - -
- {!!(human && has_id) && ( + +
+
+ )} + {!!human && !!has_id && !!authenticated && (
{squads.map((entry) => (
{!!has_id && !!authenticated && (
- + - {human ? `Selected for squad transfer: ${human}` : 'Ask or force person to place hand on my scanner.'} + {human + ? `Selected for squad transfer: ${human}` + : 'Ask or force person to place hand on my scanner.'} - +
)} From 6c1cc46b20009d9ea6415d947d5f04ea1622e6c7 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 21:39:56 -0700 Subject: [PATCH 012/104] c --- code/modules/cm_marines/marines_consoles.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 79aceb408e6e..93331b1458d7 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -12,7 +12,7 @@ // ------------------------------------------------------------------------------------------------------------------------------- // /obj/structure/machinery/computer/double_id name = "Computer" - desc = "Terminal that takes a User and target ID" + desc = "Terminal that takes a user and target ID" // user who is modifying the target var/obj/item/card/id/user_id_card // the poor soul whos status needs to be updated as deceased. From 9277e4d166fd1774e265fdb79fada4b5591f3e57 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 21:46:47 -0700 Subject: [PATCH 013/104] I mean... --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index a882bec41ed4..71e66aa810d2 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -180,7 +180,7 @@ return FALSE if("updateStatRecord") if(params["stat_type"]) // 1 for medical - target_record_medical.fields[params["stat"]] = params["new_value"] + target_record_medical.fields[params["stat"]] = params["new_value"] // might best to just combine the two? Do we even need separate records?! else // 0 for general target_record_general.fields[params["stat"]] = params["new_value"] return TRUE From 7f2f7ee4c0c94df75ac6d139d3ed3b7423073d51 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 21:47:13 -0700 Subject: [PATCH 014/104] t --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 71e66aa810d2..3ac618b6aedc 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -180,7 +180,7 @@ return FALSE if("updateStatRecord") if(params["stat_type"]) // 1 for medical - target_record_medical.fields[params["stat"]] = params["new_value"] // might best to just combine the two? Do we even need separate records?! + target_record_medical.fields[params["stat"]] = params["new_value"] // might be best to just combine the two? Do we even need separate records?! else // 0 for general target_record_general.fields[params["stat"]] = params["new_value"] return TRUE From 868200755f960d9fb478c44b74cec331a4d34843 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 21:47:56 -0700 Subject: [PATCH 015/104] nvm, it makes more sense to have them separate --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 3ac618b6aedc..a882bec41ed4 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -180,7 +180,7 @@ return FALSE if("updateStatRecord") if(params["stat_type"]) // 1 for medical - target_record_medical.fields[params["stat"]] = params["new_value"] // might be best to just combine the two? Do we even need separate records?! + target_record_medical.fields[params["stat"]] = params["new_value"] else // 0 for general target_record_general.fields[params["stat"]] = params["new_value"] return TRUE From f023db72709332f5d114afeea49e54ca9826feae Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:18:16 -0700 Subject: [PATCH 016/104] unshit the copy pasta code. --- code/modules/cm_marines/marines_consoles.dm | 41 ++++++++++----------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 93331b1458d7..3e83f6f65324 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -39,30 +39,27 @@ if(!operable()) to_chat(user, SPAN_NOTICE("You tried to inject \the [card] but \the [src] remains silent.")) return + if(user_id_card && target_id_card) + to_chat(user, "Both slots are full already. Remove a card first.") + return + var/obj/item/card/id/idcard = card - if(check_access(idcard)) - if(!user_id_card) - if(user.drop_held_item()) - idcard.forceMove(src) - user_id_card = idcard + if(!check_access(idcard)) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: No Access.\"") + return + if(!user.drop_held_item()) + return + + idcard.forceMove(src) + if(!user_id_card) + if(user.drop_held_item()) + user_id_card = idcard authenticate(user, user_id_card) - else if(!target_id_card) - if(user.drop_held_item()) - card.forceMove(src) - target_id_card = idcard - update_static_data(user) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") - else - to_chat(user, "Both slots are full already. Remove a card first.") - else - if(!target_id_card) - if(user.drop_held_item()) - card.forceMove(src) - target_id_card = idcard - update_static_data(user) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") - else - to_chat(user, "Both slots are full already. Remove a card first.") + else if(!target_id_card) + if(user.drop_held_item()) + target_id_card = idcard + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + update_static_data(user) else ..() From 795b67d32191cd771bbdfeaaa35a4417c2e9afce Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:19:40 -0700 Subject: [PATCH 017/104] more --- code/modules/cm_marines/marines_consoles.dm | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 3e83f6f65324..fb400fa75448 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -35,10 +35,11 @@ return FALSE /obj/structure/machinery/computer/double_id/attackby(obj/card, mob/user) + if(!operable()) + to_chat(user, SPAN_NOTICE("You tried to inject \the [card] but \the [src] remains silent.")) + return + if(istype(card, /obj/item/card/id)) - if(!operable()) - to_chat(user, SPAN_NOTICE("You tried to inject \the [card] but \the [src] remains silent.")) - return if(user_id_card && target_id_card) to_chat(user, "Both slots are full already. Remove a card first.") return @@ -47,18 +48,17 @@ if(!check_access(idcard)) visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: No Access.\"") return + if(!user.drop_held_item()) return - idcard.forceMove(src) + if(!user_id_card) - if(user.drop_held_item()) - user_id_card = idcard - authenticate(user, user_id_card) - else if(!target_id_card) - if(user.drop_held_item()) - target_id_card = idcard - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + user_id_card = idcard + authenticate(user, user_id_card) + else + target_id_card = idcard + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") update_static_data(user) else ..() From 4c718af459ce9a5a6b73fb3d9b69c6ea59a4deda Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:26:43 -0700 Subject: [PATCH 018/104] m --- code/modules/cm_marines/marines_consoles.dm | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index fb400fa75448..3ee93b219110 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -45,9 +45,6 @@ return var/obj/item/card/id/idcard = card - if(!check_access(idcard)) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: No Access.\"") - return if(!user.drop_held_item()) return From 6d0a9d1d0e5ee338cb6792bdc42d2ecb05efd4db Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:27:47 -0700 Subject: [PATCH 019/104] j --- code/modules/cm_marines/marines_consoles.dm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 3ee93b219110..cdc6330650be 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -43,13 +43,11 @@ if(user_id_card && target_id_card) to_chat(user, "Both slots are full already. Remove a card first.") return - - var/obj/item/card/id/idcard = card - if(!user.drop_held_item()) return - idcard.forceMove(src) + var/obj/item/card/id/idcard = card + idcard.forceMove(src) if(!user_id_card) user_id_card = idcard authenticate(user, user_id_card) From 0aa3dbd6c4d6d61b3eaf5d4651513768150b1598 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:31:03 -0700 Subject: [PATCH 020/104] a --- code/modules/cm_marines/marines_consoles.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index cdc6330650be..0ce9c9884c15 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -525,8 +525,8 @@ if(user.drop_held_item()) card.forceMove(src) user_id_card = card - if(authenticate(user, user_id_card)) - return TRUE + if(authenticate(user, user_id_card)) + return TRUE else if(!user_id_card) return From dd40c9fd4618d12f7064d68ccb3e63191f515580 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 22:42:11 -0700 Subject: [PATCH 021/104] again, fixing copy pasta issues. --- code/modules/cm_marines/marines_consoles.dm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 0ce9c9884c15..507772c6409c 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -520,6 +520,7 @@ playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) switch(action) if("authenticate") + // we place the id into the machine var/obj/item/card = user.get_active_hand() if (istype(card, /obj/item/card/id)) if(user.drop_held_item()) @@ -527,6 +528,7 @@ user_id_card = card if(authenticate(user, user_id_card)) return TRUE + // we eject the id from the machine else if(!user_id_card) return @@ -549,6 +551,7 @@ user_id_card = null return TRUE if("eject") + // we eject the id from the machine if(target_id_card) if(ishuman(user)) target_id_card.forceMove(user.loc) @@ -561,15 +564,17 @@ visible_message("[SPAN_BOLD("[src]")] states, \"CARD EJECT: Data imprinted. Updating database... Success.\"") person_to_modify = null return TRUE + // we place the id into the machine else var/obj/item/card = user.get_active_hand() - if (istype(card, /obj/item/card/id)) - if(user.drop_held_item()) - card.forceMove(src) - target_id_card = card - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") - update_static_data(user) - return TRUE + if (!istype(card, /obj/item/card/id)) + return + if(user.drop_held_item()) + card.forceMove(src) + target_id_card = card + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + update_static_data(user) + return TRUE return FALSE if("PRG_squad") if( From bb66808652efea2de7bc315213b3102ef455e45e Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 23:21:30 -0700 Subject: [PATCH 022/104] piss --- code/modules/cm_marines/marines_consoles.dm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 507772c6409c..45431b323c52 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -43,17 +43,17 @@ if(user_id_card && target_id_card) to_chat(user, "Both slots are full already. Remove a card first.") return - if(!user.drop_held_item()) - return var/obj/item/card/id/idcard = card - idcard.forceMove(src) if(!user_id_card) + if(!authenticate(user, card)) + return user_id_card = idcard - authenticate(user, user_id_card) else target_id_card = idcard visible_message("[SPAN_BOLD("[src]")] states, \"CARD FOUND: Preparing ID modification protocol.\"") + if(user.drop_held_item()) + idcard.forceMove(src) update_static_data(user) else ..() @@ -138,9 +138,10 @@ var/obj/item/I = user.get_active_hand() if (istype(I, /obj/item/card/id)) if(user.drop_held_item()) + if(!authenticate(user, I)) + return I.forceMove(src) user_id_card = I - if(authenticate(user, user_id_card)) return TRUE // Well actualy we have no button for auth card ejection, so just spit it back in user's face else @@ -523,11 +524,12 @@ // we place the id into the machine var/obj/item/card = user.get_active_hand() if (istype(card, /obj/item/card/id)) + if(!authenticate(user, card)) + return if(user.drop_held_item()) card.forceMove(src) user_id_card = card - if(authenticate(user, user_id_card)) - return TRUE + return TRUE // we eject the id from the machine else if(!user_id_card) From 5a19207e5d75ed4f4f57d3fbcaed809c94217a86 Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 23:24:35 -0700 Subject: [PATCH 023/104] t --- code/modules/cm_marines/marines_consoles.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 45431b323c52..b69c64a3fdfb 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -137,9 +137,9 @@ if("PRG_authenticate") var/obj/item/I = user.get_active_hand() if (istype(I, /obj/item/card/id)) + if(!authenticate(user, I)) + return if(user.drop_held_item()) - if(!authenticate(user, I)) - return I.forceMove(src) user_id_card = I return TRUE From 388f4569adfeef0ca0b7ea47151de9dcd8eab04e Mon Sep 17 00:00:00 2001 From: DOOM Date: Thu, 9 May 2024 23:48:01 -0700 Subject: [PATCH 024/104] beno --- code/modules/cm_marines/marines_consoles.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index b69c64a3fdfb..2cc4834c5526 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -634,16 +634,16 @@ data["squads"] = squads return data +/obj/structure/machinery/computer/double_id/squad_changer/attack_alien(mob/living/carbon/xenomorph/xeno_user) + xeno_user.visible_message(SPAN_NOTICE("You hear a beep as [xeno_user]'s limb is scanned to \the [name].")) + visible_message("[SPAN_BOLD("[src]")] states, \"SCAN ENTRY: Unknown lifeform detected! Forbidden operation!\"") + playsound(xeno_user.loc, 'sound/machines/screen_output1.ogg', 25, 1) + return XENO_ATTACK_ACTION + /obj/structure/machinery/computer/double_id/squad_changer/attack_hand(mob/user as mob) if(..()) return - if (isxeno(user)) - user.visible_message(SPAN_NOTICE("You hear a beep as [user]'s limb is scanned to \the [name].")) - visible_message("[SPAN_BOLD("[src]")] states, \"SCAN ENTRY: Unknown lifeform detected! Forbidden operation!\"") - playsound(user.loc, 'sound/machines/screen_output1.ogg', 25, 1) - return - if(user) add_fingerprint(user) From 4d50ea1decb03a70fe61d2ebe812755363353118 Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 10 May 2024 07:27:56 -0700 Subject: [PATCH 025/104] n --- code/modules/cm_marines/marines_consoles.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 2cc4834c5526..edfd1e9601e8 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -521,7 +521,7 @@ playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) switch(action) if("authenticate") - // we place the id into the machine + // we place the user id into the machine var/obj/item/card = user.get_active_hand() if (istype(card, /obj/item/card/id)) if(!authenticate(user, card)) @@ -530,7 +530,7 @@ card.forceMove(src) user_id_card = card return TRUE - // we eject the id from the machine + // we eject the user id from the machine else if(!user_id_card) return @@ -553,7 +553,7 @@ user_id_card = null return TRUE if("eject") - // we eject the id from the machine + // we eject the target id from the machine if(target_id_card) if(ishuman(user)) target_id_card.forceMove(user.loc) @@ -566,7 +566,7 @@ visible_message("[SPAN_BOLD("[src]")] states, \"CARD EJECT: Data imprinted. Updating database... Success.\"") person_to_modify = null return TRUE - // we place the id into the machine + // we place the target id into the machine else var/obj/item/card = user.get_active_hand() if (!istype(card, /obj/item/card/id)) From 7c25a65181003b9c2fab58149b93fe3d3308d016 Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 10 May 2024 18:08:54 -0700 Subject: [PATCH 026/104] update icon --- code/game/machinery/computer/medical.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index a882bec41ed4..0b79a6a903c6 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -149,6 +149,8 @@ var/obj/item/paper/med_report = new (loc) med_report.name = "Medical Report" med_report.info += contents + med_report.update_icon() + visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) return TRUE if("eject") From 08efde8134845e5fb360b042b2c9789deedf11b8 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 12:10:56 -0700 Subject: [PATCH 027/104] Notes, The. --- code/game/machinery/computer/medical.dm | 2 +- tgui/packages/tgui/interfaces/MedMod.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 0b79a6a903c6..02736cfec575 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -142,7 +142,7 @@ // autopsy report gets shwacked ontop if it exists and the target stat is dead if(target_record_general.fields[HEALTH] == "Deceased" && target_record_medical.fields[AUTOPSY_SUBMISSION]) contents += {"

Autopsy Report

- Autopsy Nites: [target_record_medical.fields[AUTOPSY_NOTES]]
+ Autopsy Notes: [target_record_medical.fields[AUTOPSY_NOTES]]
Cause Of Death: [target_record_medical.fields[DEATH]]
"} diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedMod.jsx index d8b2161214b1..37d5e41ddd11 100644 --- a/tgui/packages/tgui/interfaces/MedMod.jsx +++ b/tgui/packages/tgui/interfaces/MedMod.jsx @@ -185,7 +185,7 @@ export const MedicalRecord = (props) => { ) : health !== 'Deceased' ? ( - he patient must be marked as deceased to create an + The patient must be marked as deceased to create an autopsy report. ) : ( From 821327c7f6088966608ef44e2d6ad58ddc7ffa47 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 15:50:58 -0700 Subject: [PATCH 028/104] fix the copy pasta --- code/game/machinery/computer/medical.dm | 59 ++++---- tgui/packages/tgui/interfaces/MedMod.jsx | 163 ++++++++--------------- 2 files changed, 87 insertions(+), 135 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 02736cfec575..4c47f716fdb9 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -9,6 +9,12 @@ #define DEATH "d_stat" // cause of death #define BLOOD_TYPE "b_type" #define AUTOPSY_SUBMISSION "aut_sub" // whether or not an autopsy report has been submitted already for a given record + +// the type of record +#define MEDICAL 1 +#define GENERAL 0 + +// I hate the priting sound. #define PRINT_COOLDOWN_TIME 2 MINUTES /obj/structure/machinery/computer/double_id/med_data//TODO:RIP OUT LEGACY CODE. @@ -76,12 +82,6 @@ var/mob/user = ui.user playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) switch(action) - if("selectHealthStatus") - target_record_general.fields[HEALTH] = params["health"] - return TRUE - if("selectCauseOfDeath") - target_record_medical.fields[DEATH] = params["death"] - return TRUE if("authenticate") var/obj/item/id_card = user.get_active_hand() if (istype(id_card, /obj/item/card/id)) @@ -181,9 +181,9 @@ return TRUE return FALSE if("updateStatRecord") - if(params["stat_type"]) // 1 for medical + if(params["stat_type"] == MEDICAL) target_record_medical.fields[params["stat"]] = params["new_value"] - else // 0 for general + else target_record_general.fields[params["stat"]] = params["new_value"] return TRUE if("submitReport") @@ -193,30 +193,35 @@ target_record_medical.fields[AUTOPSY_SUBMISSION] = TRUE return TRUE +/obj/structure/machinery/computer/double_id/med_data/ui_static_data(mob/user) + var/list/data = list() + // general information, it is never modified. Why pass it in so weirdly? because it makes it easy to add and remove stats in the future. + data["general_record"] = list( + list(target_record_general?.fields["name"],"Name: "), + list(target_record_general?.fields["age"],"Age: "), + list(target_record_general?.fields["sex"],"Sex: "), + list(target_record_medical?.fields[BLOOD_TYPE],"Blood Type: ") + ) + + return data + /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // TODO:make each data var a list instead of harcoding the stat in tgui. - data["name"] = target_record_general?.fields["name"] - data["health"] = target_record_general?.fields[HEALTH] - data["sex"] = target_record_general?.fields["sex"] - data["bloodType"] = target_record_medical?.fields[BLOOD_TYPE] - data["age"] = target_record_general?.fields["age"] - data["notes"] = target_record_medical?.fields[NOTES] - data["death"] = target_record_medical?.fields[DEATH] - data["mental"] = target_record_general?.fields[MENTAL] - data["disease"] = target_record_medical?.fields[DISEASE] - data["disability"] = target_record_medical?.fields[DISABILITY] - data["autopsy"] = target_record_medical?.fields[AUTOPSY_NOTES] - data["existingReport"] = target_record_medical?.fields[AUTOPSY_SUBMISSION] + // medical records, we pass it in as a list so it's better to handle in tgui. + data["medical_record"] = list( + list(MEDICAL, NOTES, target_record_medical?.fields[NOTES],"General Notes: "), + list(GENERAL, MENTAL, target_record_general?.fields[MENTAL],"Psychiatric History: "), + list(MEDICAL, DISEASE, target_record_medical?.fields[DISEASE],"Disease History: "), + list(MEDICAL, DISABILITY, target_record_medical?.fields[DISABILITY],"Disability History: ") + ) + data["death"] = list(MEDICAL, DEATH, target_record_medical?.fields[DEATH],"Cause Of Death: ") + data["health"] = list(GENERAL, HEALTH, target_record_general?.fields[HEALTH],"Health Status: ") + data["autopsy"] = list(MEDICAL, AUTOPSY_NOTES, target_record_medical?.fields[AUTOPSY_NOTES],"Autopsy Notes: ") + data["existingReport"] = target_record_medical?.fields[AUTOPSY_SUBMISSION] data["authenticated"] = authenticated data["has_id"] = !!target_id_card data["id_name"] = target_id_card ? target_id_card.name : "-----" - if(target_id_card) - data["id_rank"] = target_id_card.assignment ? target_id_card.assignment : "Unassigned" - data["id_owner"] = target_id_card.registered_name ? target_id_card.registered_name : "-----" - data["access_on_card"] = target_id_card.access + target_id_card.faction_group - data["id_account"] = target_id_card.associated_account_number return data @@ -229,3 +234,5 @@ #undef DEATH #undef BLOOD_TYPE #undef AUTOPSY_SUBMISSION +#undef MEDICAL +#undef GENERAL diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedMod.jsx index 37d5e41ddd11..d038464b5723 100644 --- a/tgui/packages/tgui/interfaces/MedMod.jsx +++ b/tgui/packages/tgui/interfaces/MedMod.jsx @@ -1,3 +1,4 @@ +import { Fragment } from 'react'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, Stack, Input, Dropdown, Section, Tabs, Flex, Icon } from '../components'; import { Window } from '../layouts'; @@ -29,14 +30,10 @@ export const MedicalRecord = (props) => { const [tab, setTab] = useLocalState('tab', 1); const { authenticated, - name, has_id, - notes, + id_name, + medical_record, health, - death, - mental, - disease, - disability, autopsy, existingReport, } = data; @@ -58,65 +55,27 @@ export const MedicalRecord = (props) => { Autopsy Report - {tab === 1 && ( // to do, just map it instead. + {tab === 1 && (
- General Notes: - - - act('updateStatRecord', { - stat_type: statType.MEDICAL, // yes, it's hardcoded. Fix later. - stat: stat.NOTES, - new_value: value, - }) - } - /> - - Psychiatric History: - - - act('updateStatRecord', { - stat_type: statType.GENERAL, - stat: stat.MENTAL, - new_value: value, - }) - } - /> - - Disease History: - - - act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.DISEASE, // we hardcode around here boyoz. - new_value: value, - }) - } - /> - - Disability History: - - - act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.DISABILITY, - new_value: value, - }) - } - /> - + {medical_record.map((record, index) => ( + + {record[3]} + + + act('updateStatRecord', { + stat_type: record[0], + stat: record[1], + new_value: value, + }) + } + /> + + + ))}
)} @@ -126,15 +85,15 @@ export const MedicalRecord = (props) => { {health == 'Deceased' && !existingReport && ( - Autopsy Notes: + {autopsy[3]} act('updateStatRecord', { - stat_type: statType.MEDICAL, - stat: stat.AUTOPSY, // spaghetti noodle code will get fixed eventually, I promise. + stat_type: autopsy[0], + stat: autopsy[1], new_value: value, }) } @@ -144,17 +103,21 @@ export const MedicalRecord = (props) => { - Cause Of Death: + {death[3]} - act('selectCauseOfDeath', { death: value }) + act('updateStatRecord', { + stat_type: death[0], + stat: death[1], + new_value: value, + }) } - displayText={death ? death : 'NONE'} + displayText={death[2] ? death[2] : 'NONE'} /> @@ -177,13 +140,13 @@ export const MedicalRecord = (props) => { - + {existingReport ? ( - The autopsy report for {name} has been submitted. + The autopsy report for {id_name} has been submitted. - ) : health !== 'Deceased' ? ( + ) : health[2] !== 'Deceased' ? ( The patient must be marked as deceased to create an autopsy report. @@ -207,21 +170,12 @@ export const MedicalRecord = (props) => { export const HealthStatus = (props) => { const { act, data } = useBackend(); - const { - authenticated, - id_owner, - has_id, - id_name, - name, - sex, - age, - bloodType, - health, - } = data; + const { authenticated, has_id, id_name, general_record, health } = data; + return ( <>
{
{!!has_id && !!authenticated && (
- + - act('selectHealthStatus', { health: value }) + act('updateStatRecord', { + stat_type: health[0], + stat: health[1], + new_value: value, + }) } - displayText={health} + displayText={health[2]} /> - Name: {name} - Sex: {sex} - Age: {age} - Blood Type: {bloodType} + {general_record.map(([value, label], index) => ( + + {value} {label} + + ))} @@ -293,18 +252,4 @@ const colors = { 'Unfit': 'yellow', }; -// i'll do it with a list instead, hardcoded for now. -const statType = { - MEDICAL: 1, - GENERAL: 0, -}; - -// stats that have input strings. -const stat = { - AUTOPSY: 'a_stat', - NOTES: 'notes', - MENTAL: 'm_stat', - DISEASE: 'cdi', - DISABILITY: 'mi_dis', -}; // ----- const -------- // From 0172d5e51e4e1fd1e7b57111dc594be684848489 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 16:03:13 -0700 Subject: [PATCH 029/104] fix --- code/game/machinery/computer/medical.dm | 2 +- tgui/packages/tgui/interfaces/MedMod.jsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 4c47f716fdb9..e523ab84fe98 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -208,7 +208,7 @@ /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // medical records, we pass it in as a list so it's better to handle in tgui. + // medical records, we pass it in as a list so it's better to handle in tgui. Might be better to pass in an associated list for clarity? data["medical_record"] = list( list(MEDICAL, NOTES, target_record_medical?.fields[NOTES],"General Notes: "), list(GENERAL, MENTAL, target_record_general?.fields[MENTAL],"Psychiatric History: "), diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedMod.jsx index d038464b5723..1b119cbda8d5 100644 --- a/tgui/packages/tgui/interfaces/MedMod.jsx +++ b/tgui/packages/tgui/interfaces/MedMod.jsx @@ -36,6 +36,7 @@ export const MedicalRecord = (props) => { health, autopsy, existingReport, + death, } = data; return ( <> @@ -82,7 +83,7 @@ export const MedicalRecord = (props) => { {tab === 2 && ( // should I have used a table instead of stack hell? Probably.
- {health == 'Deceased' && !existingReport && ( + {health[2] == 'Deceased' && !existingReport && ( {autopsy[3]} @@ -217,7 +218,7 @@ export const HealthStatus = (props) => { {general_record.map(([value, label], index) => ( - {value} {label} + {label} {value} ))} From 44c1b787afabf84360e0ebc783c8fcab108d4169 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 16:06:26 -0700 Subject: [PATCH 030/104] comments --- code/game/machinery/computer/medical.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index e523ab84fe98..30280520846a 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -14,7 +14,7 @@ #define MEDICAL 1 #define GENERAL 0 -// I hate the priting sound. +// I hate the printing sound effect. #define PRINT_COOLDOWN_TIME 2 MINUTES /obj/structure/machinery/computer/double_id/med_data//TODO:RIP OUT LEGACY CODE. @@ -208,7 +208,7 @@ /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // medical records, we pass it in as a list so it's better to handle in tgui. Might be better to pass in an associated list for clarity? + // medical records, we pass it in as a list so it's better to handle in tgui. Might be ideal to pass in an associated list for clarity? data["medical_record"] = list( list(MEDICAL, NOTES, target_record_medical?.fields[NOTES],"General Notes: "), list(GENERAL, MENTAL, target_record_general?.fields[MENTAL],"Psychiatric History: "), From 79b9bb7b96f7f14ce22be17128313607473e88d3 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 16:06:49 -0700 Subject: [PATCH 031/104] already one --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 30280520846a..02e7ed2ff6d1 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -17,7 +17,7 @@ // I hate the printing sound effect. #define PRINT_COOLDOWN_TIME 2 MINUTES -/obj/structure/machinery/computer/double_id/med_data//TODO:RIP OUT LEGACY CODE. +/obj/structure/machinery/computer/double_id/med_data name = "Medical Records" desc = "This can be used to check medical records." icon_state = "medcomp" From a4eab3cb6b551d0a79afdf1aacae780fda829c36 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 11 May 2024 16:08:13 -0700 Subject: [PATCH 032/104] comments --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 02e7ed2ff6d1..6b5a0abc92dd 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -208,7 +208,7 @@ /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // medical records, we pass it in as a list so it's better to handle in tgui. Might be ideal to pass in an associated list for clarity? + // medical records, we pass it in as a list so it's better to handle in tgui. Might be ideal to pass in an associated list instead? data["medical_record"] = list( list(MEDICAL, NOTES, target_record_medical?.fields[NOTES],"General Notes: "), list(GENERAL, MENTAL, target_record_general?.fields[MENTAL],"Psychiatric History: "), From 295ff7a94e050ea5d393f929d4daf1bcdf22f6f0 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 12 May 2024 14:02:02 -0700 Subject: [PATCH 033/104] progress, partial datacore overhaul. --- code/__DEFINES/human.dm | 88 ++ code/__HELPERS/unsorted.dm | 4 +- code/datums/datacore.dm | 162 +-- code/defines/procs/records.dm | 149 ++- code/game/machinery/computer/medical.dm | 85 +- code/game/machinery/computer/security.dm | 1131 ++++++++++------- code/game/machinery/computer/skills.dm | 6 +- code/game/machinery/medical_pod/autodoc.dm | 2 +- code/game/objects/items/pamphlets.dm | 2 +- .../modules/cm_marines/equipment/kit_boxes.dm | 2 +- code/modules/gear_presets/uscm.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 6 +- .../mob/living/carbon/human/human_defines.dm | 3 + code/modules/mob/living/carbon/human/life.dm | 2 +- tgui/packages/tgui/interfaces/SecMod.jsx | 255 ++++ 17 files changed, 1182 insertions(+), 721 deletions(-) create mode 100644 tgui/packages/tgui/interfaces/SecMod.jsx diff --git a/code/__DEFINES/human.dm b/code/__DEFINES/human.dm index f2d60983b74c..8530eacd2c73 100644 --- a/code/__DEFINES/human.dm +++ b/code/__DEFINES/human.dm @@ -215,3 +215,91 @@ #define RELIGION_AGNOSTICISM "Agnostic" #define MAXIMUM_DROPPED_OBJECTS_REMEMBERED 2 + +// DEFINES FOR RECORD SYSTEM STAT TYPES, arguably pointless to create defines for these, could of just renamed the string but eh, who cares. +// --------------------------------------------------------------------------------------------------------------- // + +// general records +#define MOB_NAME "name" +#define RECORD_UNIQUE_ID "id" +#define MOB_SHOWN_RANK "rank" +#define MOB_REAL_RANK "real_rank" +#define MOB_SEX "sex" +#define MOB_AGE "age" +#define MOB_ETHNICITY "ethnicity" +#define MOB_HEALTH_STATUS "p_stat" +#define MOB_MENTAL_STATUS "m_stat" +#define MOB_SPECIES "species" +#define MOB_ORIGIN "origin" +#define MOB_SHOWN_FACTION "faction" +#define MOB_REAL_FACTION "mob_faction" +#define MOB_RELIGION "religion" +#define MOB_SQUAD "squad" +#define MOB_GENERAL_NOTES "g_notes" +#define MOB_EXPLOIT_RECORD "mob_exploit_record" +#define MOB_WEAKREF "ref" + +#define GENERAL_RECORD_LIST list(MOB_NAME, RECORD_UNIQUE_ID, MOB_SHOWN_RANK, MOB_REAL_RANK, MOB_SEX, MOB_AGE, MOB_ETHNICITY, MOB_HEALTH_STATUS, MOB_MENTAL_STATUS, MOB_SPECIES, MOB_ORIGIN, MOB_SHOWN_FACTION, MOB_REAL_FACTION, MOB_RELIGION, MOB_SQUAD, MOB_GENERAL_NOTES, MOB_EXPLOIT_RECORD, MOB_WEAKREF) + +// security record stat types +#define MOB_INCIDENTS "incidents" +#define MOB_CRIMINAL_STATUS "criminal" +#define MOB_SECURITY_COMMENT_LOG "comments" +#define MOB_SECURITY_NOTES "s_notes" + +#define SECURITY_RECORD_LIST list(MOB_INCIDENTS, MOB_CRIMINAL_STATUS, MOB_SECURITY_COMMENT_LOG, MOB_SECURITY_NOTES) + +// medical record stat types +#define MOB_BLOOD_TYPE "b_type" +#define MOB_DISABILITIES "mi_dis" +#define MOB_AUTOPSY_NOTES "a_stat" +#define MOB_MEDICAL_NOTES "m_notes" +#define MOB_DISEASES "cdi" +#define MOB_CAUSE_OF_DEATH "d_stat" +#define MOB_AUTOPSY_SUBMISSION "aut_sub" +#define MOB_LAST_SCAN_TIME "last_scan_time" +#define MOB_LAST_SCAN_RESULT "last_scan_result" +#define MOB_AUTODOC_DATA "autodoc_data" +#define MOB_AUTODOC_MANUAL "autodoc_manual" + +#define MEDICAL_RECORD_LIST list(MOB_BLOOD, MOB_DISABILITIES, MOB_AUTOPSY_NOTES, MOB_MEDICAL_NOTES, MOB_DISEASES, MOB_CAUSE_OF_DEATH, MOB_AUTOPSY_SUBMISSION, MOB_LAST_SCAN_TIME, MOB_LAST_SCAN_RESULT, MOB_AUTODOC_DATA, MOB_AUTODOC_MANUAL) + +// --------------------------------------------------------------------------------------------------------------- // + +// The actual stat that is set, for now we reduce the useless bullshit no one cares about and keep it minimal. +// --------------------------------------------------------------------------------------------------------------- // + +// gender/sex stats +#define MOB_STAT_SEX_MALE "Male" +#define MOB_STAT_SEX_FEMALE "Female" + +#define MOB_STAT_GENDER_LIST list(MOB_STAT_SEX_MALE, MOB_STAT_SEX_FEMALE) + +// health stats +#define MOB_STAT_HEALTH_DECEASED "Deceased" +#define MOB_STAT_HEALTH_ACTIVE "Active" +#define MOB_STAT_HEALTH_UNFIT "Unfit" + +#define MOB_STAT_HEALTH_LIST list(MOB_STAT_SEX_MALE, MOB_STAT_SEX_FEMALE) + +// Mental stats +#define MOB_STAT_MENTAL_STATUS_STABLE "Stable" +#define MOB_STAT_MENTAL_STATUS_ON_WATCH "Watch" // i.e. potentailly unstable +#define MOB_STAT_MENTAL_STATUS_UNSTABLE "Insane" + +#define MOB_STAT_MENTAL_STATUS_LIST list(MOB_STAT_MENTAL_STATUS_STABLE, MOB_STAT_MENTAL_STATUS_ON_WATCH, MOB_STAT_MENTAL_STATUS_UNSTABLE) + +// crime stats +#define MOB_STAT_CRIME_NONE "None" +#define MOB_STAT_CRIME_ARREST "Arrest" +#define MOB_STAT_CRIME_INCARCERATED "Incarcerated" + +#define MOB_STAT_MENTAL_STATUS_LIST list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARDCERATED) +// ------------------------------------------------------------------------------------------------------------------ // + +// types of records +#define RECORD_TYPE_GENERAL "general" +#define RECORD_TYPE_SECURITY "security" +#define RECORD_TYPE_MEDICAL "medical" +#define RECORD_TYPE_STATIC "locked" // immutable records, keeping it for now I guess. + diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7e4c5676c8d1..3acadd5fe752 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -275,8 +275,8 @@ var/mob_ref = WEAKREF(src) for(var/list/L in list(GLOB.data_core.general, GLOB.data_core.medical, GLOB.data_core.security, GLOB.data_core.locked)) for(var/datum/data/record/record_entry in L) - if(record_entry.fields["ref"] == mob_ref) - record_entry.fields["name"] = newname + if(record_entry.fields[MOB_WEAKREF] == mob_ref) + record_entry.fields[MOB_NAME] = newname record_entry.name = newname break diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index ae19a3044678..b28cad2165c3 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -86,13 +86,13 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) var/list/squad_sublists = GLOB.ROLES_SQUAD_ALL.Copy() //Are there any marines in the squad? for(var/datum/data/record/record_entry in GLOB.data_core.general) - if(record_entry.fields["mob_faction"] != FACTION_MARINE) //we process only USCM humans + if(record_entry.fields[MOB_REAL_FACTION] != FACTION_MARINE) //we process only USCM humans continue - var/name = record_entry.fields["name"] - var/rank = record_entry.fields["rank"] - var/real_rank = record_entry.fields["real_rank"] - var/squad_name = record_entry.fields["squad"] + var/name = record_entry.fields[MOB_NAME] + var/rank = record_entry.fields[MOB_SHOWN_RANK] + var/real_rank = record_entry.fields[MOB_REAL_RANK] + var/squad_name = record_entry.fields[MOB_SQUAD] if(isnull(name) || isnull(rank) || isnull(real_rank)) continue @@ -104,7 +104,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) break isactive[name] = active ? "Active" : "Inactive" else - isactive[name] = record_entry.fields["p_stat"] + isactive[name] = record_entry.fields[MOB_HEALTH_STATUS] //cael - to prevent multiple appearances of a player/job combination, add a continue after each line if(real_rank in GLOB.ROLES_CIC) @@ -212,142 +212,46 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) if(H.job in jobs_to_check) manifest_inject(H) -/datum/datacore/proc/manifest_modify(name, ref, assignment, rank, p_stat) - var/datum/data/record/foundrecord +/datum/datacore/proc/manifest_modify(name, ref, assignment, rank, health_status, record_id_ref = null) + var/datum/data/record/found_record = null + found_record = retrieve_record(record_id_ref, name, ref, RECORD_TYPE_GENERAL) - var/use_name = isnull(ref) - for(var/datum/data/record/record_entry in GLOB.data_core.general) - if(use_name) - if(record_entry.fields["name"] == name) - foundrecord = record_entry - break - else - if(record_entry.fields["ref"] == ref) - foundrecord = record_entry - break - - if(foundrecord) + if(found_record) if(assignment) - foundrecord.fields["rank"] = assignment + found_record.fields[MOB_SHOWN_RANK] = assignment if(rank) - foundrecord.fields["real_rank"] = rank - if(p_stat) - foundrecord.fields["p_stat"] = p_stat - if(!use_name) - if(name) - foundrecord.fields["name"] = name + found_record.fields[MOB_REAL_RANK] = rank + if(health_status) + found_record.fields[MOB_HEALTH_STATUS] = health_status + if(name) + found_record.fields[MOB_NAME] = name return TRUE return FALSE /datum/datacore/proc/manifest_inject(mob/living/carbon/human/target) - var/assignment - if(target.job) - assignment = target.job - else - assignment = "Unassigned" - - var/id = add_zero(num2hex(target.gid), 6) //this was the best they could come up with? A large random number? *sigh* - //var/icon/front = new(get_id_photo(H), dir = SOUTH) - //var/icon/side = new(get_id_photo(H), dir = WEST) - - //General Record - var/datum/data/record/record_general = new() - record_general.fields["id"] = id - record_general.fields["name"] = target.real_name - record_general.name = target.real_name - record_general.fields["real_rank"] = target.job - record_general.fields["rank"] = assignment - record_general.fields["squad"] = target.assigned_squad ? target.assigned_squad.name : null - record_general.fields["age"] = target.age - record_general.fields["p_stat"] = "Active" - record_general.fields["m_stat"] = "Stable" - record_general.fields["sex"] = target.gender - record_general.fields["species"] = target.get_species() - record_general.fields["origin"] = target.origin - record_general.fields["faction"] = target.personal_faction - record_general.fields["mob_faction"] = target.faction - record_general.fields["religion"] = target.religion - record_general.fields["ref"] = WEAKREF(target) - //record_general.fields["photo_front"] = front - //record_general.fields["photo_side"] = side - - if(target.gen_record && !jobban_isbanned(target, "Records")) - record_general.fields["notes"] = target.gen_record - else - record_general.fields["notes"] = "No notes found." - general += record_general - - //Medical Record - var/datum/data/record/record_medical = new() - record_medical.fields["id"] = id - record_medical.fields["name"] = target.real_name - record_medical.name = target.name - record_medical.fields["b_type"] = target.blood_type - record_medical.fields["mi_dis"] = "None" - record_medical.fields["mi_dis_d"] = "No minor disabilities have been declared." - record_medical.fields["ma_dis"] = "None" - record_medical.fields["ma_dis_d"] = "No major disabilities have been diagnosed." - record_medical.fields["alg"] = "None" - record_medical.fields["alg_d"] = "No allergies have been detected in this patient." - record_medical.fields["cdi"] = "None" - record_medical.fields["cdi_d"] = "No diseases have been diagnosed at the moment." - record_medical.fields["last_scan_time"] = null - record_medical.fields["last_scan_result"] = "No scan data on record" // body scanner results - record_medical.fields["autodoc_data"] = list() - record_medical.fields["autodoc_manual"] = list() - record_medical.fields["ref"] = WEAKREF(target) - - if(target.med_record && !jobban_isbanned(target, "Records")) - record_medical.fields["notes"] = target.med_record - else - record_medical.fields["notes"] = "No notes found." - medical += record_medical - - //Security Record - var/datum/data/record/record_security = new() - record_security.fields["id"] = id - record_security.fields["name"] = target.real_name - record_security.name = target.real_name - record_security.fields["criminal"] = "None" - record_security.fields["incident"] = "" - record_security.fields["ref"] = WEAKREF(target) - - if(target.sec_record && !jobban_isbanned(target, "Records")) - var/new_comment = list("entry" = target.sec_record, "created_by" = list("name" = "\[REDACTED\]", "rank" = "Military Police"), "deleted_by" = null, "deleted_at" = null, "created_at" = "Pre-Deployment") - record_security.fields["comments"] = list("1" = new_comment) - record_security.fields["notes"] = target.sec_record - security += record_security - - - //Locked Record - var/datum/data/record/record_locked = new() - record_locked.fields["id"] = md5("[target.real_name][target.job]") - record_locked.fields["name"] = target.real_name - record_locked.name = target.real_name - record_locked.fields["rank"] = target.job - record_locked.fields["age"] = target.age - record_locked.fields["sex"] = target.gender - record_locked.fields["b_type"] = target.b_type - record_locked.fields["species"] = target.get_species() - record_locked.fields["origin"] = target.origin - record_locked.fields["faction"] = target.personal_faction - record_locked.fields["religion"] = target.religion - record_locked.fields["ref"] = WEAKREF(target) - - if(target.exploit_record && !jobban_isbanned(target, "Records")) - record_locked.fields["exploit_record"] = target.exploit_record + + if(!(target)) // big problemo. + return + + // they already have a record. + if(target.record_id_ref) + return + + var/id_ref = null + if(target.ckey) + id_ref = "[target.ckey]" // should be unique right? else - record_locked.fields["exploit_record"] = "No additional information acquired." - locked += record_locked + id_ref = text("[]", add_zero(num2hex(rand(1, 1.6777215E7)), 6)) // not a player controlled mob. + target.record_id_ref = id_ref + create_general_record(target) + create_medical_record(target) + create_security_record(target) + create_static_character_record(target) /proc/get_id_photo(mob/living/carbon/human/H) var/icon/preview_icon = null - //var/g = "m" - //if (H.gender == FEMALE) - // g = "f" - var/icon/icobase = H.species.icobase var/icon/temp diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index a9d40f993629..3671d1c805fa 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -1,50 +1,103 @@ -/proc/CreateGeneralRecord() - var/datum/data/record/general_record = new /datum/data/record() - general_record.fields["name"] = "New Record" - general_record.name = "New Record" - general_record.fields["id"] = text("[]", add_zero(num2hex(rand(1, 1.6777215E7)), 6)) - general_record.fields["rank"] = "Unassigned" - general_record.fields["real_rank"] = "Unassigned" - general_record.fields["sex"] = "Male" - general_record.fields["age"] = "Unknown" - general_record.fields["ethnicity"] = "Unknown" - general_record.fields["p_stat"] = "Active" - general_record.fields["m_stat"] = "Stable" - general_record.fields["species"] = "Human" - general_record.fields["origin"] = "Unknown" - general_record.fields["faction"] = "Unknown" - general_record.fields["mob_faction"] = "Unknown" - general_record.fields["religion"] = "Unknown" - GLOB.data_core.general += general_record - return general_record - -/proc/CreateSecurityRecord(name as text, id as text) - var/datum/data/record/security_record = new /datum/data/record() - security_record.fields["name"] = name - security_record.fields["id"] = id - security_record.name = text("Security Record #[id]") - security_record.fields["incidents"] = "None" - GLOB.data_core.security += security_record - return security_record +// mob ref is a failsafe, ideally we just access through the id. +/proc/retrieve_record(record_id = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL) + if(!record_id && !mob_name && !mob_ref) + return + + var/datum/datacore/database = GLOB.data_core + if(!database) + return // should never happen but who knows. + + var/datum/data/record/retrieved_record = null + var/list/selected_record_type = null + + switch(record_type) + if(RECORD_TYPE_GENERAL) + selected_record_type = database.general + if(RECORD_TYPE_SECURITY) + selected_record_type = database.security + if(RECORD_TYPE_MEDICAL) + selected_record_type = database.medical + if(RECORD_TYPE_STATIC) + selected_record_type = database.locked + else + return + if(record_id) + retrieved_record = selected_record_type[record_id] + else + var/mob/living/carbon/human/human_ref = mob_ref + for(var/record_id_query as anything in selected_record_type) + var/datum/data/record/record = selected_record_type[record_id_query] + if(record.fields[MOB_NAME] == mob_name || record.fields[MOB_WEAKREF] == human_ref) + retrieved_record = record + break + + return retrieved_record + +/proc/create_general_record(mob/living/carbon/human/person) + var/datum/data/record/general_record = new() + general_record.fields[MOB_NAME] = person.real_name ? person.real_name : "Unassigned" + general_record.name = person.real_name ? person.real_name : "New Record" + general_record.fields[MOB_SHOWN_RANK] = person.job ? person.job : "Unassigned" // yes they are the same at the start, but this can change depending on an alt title. + general_record.fields[MOB_REAL_RANK] = person.job ? person.job : "Unassigned" + general_record.fields[MOB_SEX] = person.gender ? person.gender : "Unknown" + general_record.fields[MOB_SQUAD] = person.assigned_squad ? person.assigned_squad.name : null + general_record.fields[MOB_AGE] = person.age ? person.age : "Unknown" + general_record.fields[MOB_HEALTH_STATUS] = MOB_STAT_HEALTH_ACTIVE // always starts as active + general_record.fields[MOB_MENTAL_STATUS] = MOB_STAT_MENTAL_STATUS_STABLE // debatable, haha. + general_record.fields[MOB_SPECIES] = person?.get_species() + general_record.fields[MOB_ORIGIN] = person.origin ? person.origin :"Unknown" + general_record.fields[MOB_SHOWN_FACTION] = person.personal_faction ? person.personal_faction : "Unknown" + general_record.fields[MOB_REAL_FACTION] = person.faction ? person.faction : "Unknown" + general_record.fields[MOB_RELIGION] = person.religion ? person.religion : "Unknown" + general_record.fields[MOB_WEAKREF] = WEAKREF(person) + general_record.fields[MOB_GENERAL_NOTES] = person.gen_record && !jobban_isbanned(person, "Records") ? person.gen_record : "No notes found." + GLOB.data_core.general[person.record_id_ref] += general_record + +/proc/create_security_record(mob/living/carbon/human/person) + var/datum/data/record/security_record = new() + security_record.fields[MOB_NAME] = person.name ? person.name : "Unknown" + security_record.name = text("Security Record") + security_record.fields[MOB_CRIMINAL_STATUS] = "None" + security_record.fields[MOB_INCIDENTS] = "None" + security_record.fields[MOB_WEAKREF] = WEAKREF(person) + + if(person.sec_record && !jobban_isbanned(person, "Records")) + var/new_comment = list("entry" = person.sec_record, "created_by" = list("name" = "\[REDACTED\]", "rank" = "Military Police"), "deleted_by" = null, "deleted_at" = null, "created_at" = "Pre-Deployment") + security_record.fields[MOB_SECURITY_COMMENT_LOG] = list("1" = new_comment) + security_record.fields[MOB_SECURITY_NOTES] = person.sec_record + GLOB.data_core.security[person.record_id_ref] += security_record /proc/create_medical_record(mob/living/carbon/human/person) - var/datum/data/record/medical_record = new /datum/data/record() - medical_record.fields["id"] = null - medical_record.fields["name"] = person.real_name - medical_record.name = person.real_name - medical_record.fields["b_type"] = person.b_type - medical_record.fields["mi_dis"] = "None" - medical_record.fields["mi_dis_d"] = "No minor disabilities have been declared." - medical_record.fields["ma_dis"] = "None" - medical_record.fields["ma_dis_d"] = "No major disabilities have been diagnosed." - medical_record.fields["alg"] = "None" - medical_record.fields["alg_d"] = "No allergies have been detected in this patient." - medical_record.fields["cdi"] = "None" - medical_record.fields["cdi_d"] = "No diseases have been diagnosed at the moment." - medical_record.fields["last_scan_time"] = null - medical_record.fields["last_scan_result"] = "No scan data on record" - medical_record.fields["autodoc_data"] = list() - medical_record.fields["autodoc_manual"] = list() - medical_record.fields["ref"] = WEAKREF(person) - GLOB.data_core.medical += medical_record - return medical_record + var/datum/data/record/medical_record = new() + medical_record.fields[MOB_NAME] = person.real_name ? person.real_name : "Unknown" + medical_record.name = person.real_name ? person.real_name : "New Medical Record" + medical_record.fields[MOB_BLOOD_TYPE] = person.b_type ? person.b_type : "Unknown" + medical_record.fields[MOB_DISABILITIES] = "None" + medical_record.fields[MOB_AUTOPSY_NOTES] = null + medical_record.fields[MOB_MEDICAL_NOTES] = person.med_record && !jobban_isbanned(person, "Records") ? person.med_record : "No notes found." + medical_record.fields[MOB_DISEASES] = "None" + medical_record.fields[MOB_CAUSE_OF_DEATH] = "None" + medical_record.fields[MOB_AUTOPSY_SUBMISSION] = FALSE + medical_record.fields[MOB_LAST_SCAN_TIME] = null + medical_record.fields[MOB_LAST_SCAN_RESULT] = "No scan data on record" + medical_record.fields[MOB_AUTODOC_DATA] = list() + medical_record.fields[MOB_AUTODOC_MANUAL] = list() + medical_record.fields[MOB_WEAKREF] = WEAKREF(person) + GLOB.data_core.medical[person.record_id_ref] += medical_record + +/proc/create_static_character_record(mob/living/carbon/human/person) + var/datum/data/record/record_locked = new() + record_locked.fields[RECORD_UNIQUE_ID] = md5("[person.real_name][person.job]") + record_locked.fields[MOB_NAME] = person.real_name + record_locked.name = person.real_name + record_locked.fields[MOB_REAL_RANK] = person.job + record_locked.fields[MOB_AGE] = person.age + record_locked.fields[MOB_SEX] = person.gender + record_locked.fields[MOB_BLOOD_TYPE] = person.b_type + record_locked.fields[MOB_SPECIES] = person.get_species() + record_locked.fields[MOB_ORIGIN] = person.origin + record_locked.fields[MOB_SHOWN_FACTION] = person.personal_faction + record_locked.fields[MOB_RELIGION] = person.religion + record_locked.fields[MOB_WEAKREF] = WEAKREF(person) + record_locked.fields[MOB_EXPLOIT_RECORD] = person.exploit_record && !jobban_isbanned(person, "Records") ? person.exploit_record : "No additional information acquired" + GLOB.data_core.locked[person.record_id_ref] += record_locked diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 6b5a0abc92dd..44ba912a9795 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -1,14 +1,4 @@ -// eventually someone will have to make these into global defines and change all the occurrences. - -#define AUTOPSY_NOTES "a_stat" // autopsy notes -#define NOTES "notes" // general medical notes -#define MENTAL "m_stat" // psychiatric illnesses -#define DISEASE "cdi" -#define DISABILITY "mi_dis" -#define HEALTH "p_stat" // current health status -#define DEATH "d_stat" // cause of death -#define BLOOD_TYPE "b_type" -#define AUTOPSY_SUBMISSION "aut_sub" // whether or not an autopsy report has been submitted already for a given record + // the type of record #define MEDICAL 1 @@ -44,14 +34,14 @@ visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to read target ID.\"") return FALSE - for(var/datum/data/record/medical_record as anything in GLOB.data_core.medical) - if(medical_record.fields["name"] == target_id.registered_name) - target_record_medical = medical_record - break - for(var/datum/data/record/general_record as anything in GLOB.data_core.general) - if(general_record.fields["name"] == target_id.registered_name) - target_record_general = general_record - break + if(!target_id.registered_ref) + visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to find target in database.\"") + return FALSE + + var/mob/living/carbon/human/referenced_human = target_id.registered_ref + if(referenced_human) + target_record_medical = retrieve_record(record_id = referenced_human.record_id_ref, record_type = RECORD_TYPE_MEDICAL) + target_record_general = retrieve_record(record_id = referenced_human.record_id_ref, record_type = RECORD_TYPE_GENERAL) if(!target_record_medical || !target_record_general) visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to retrieve target records.\"") @@ -127,23 +117,23 @@

General Information

Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
- Sex: [target_record_general?.fields["sex"]]
- Age: [target_record_general?.fields["age"]]
- Blood Type: [target_record_medical?.fields[BLOOD_TYPE]]
+ Sex: [target_record_general?.fields[MOB_SEX]]
+ Age: [target_record_general?.fields[MOB_AGE]]
+ Blood Type: [target_record_medical?.fields[MOB_BLOOD_TYPE]]

Medical Notes

- General Notes: [target_record_medical?.fields[NOTES]]
- Psychiatric History: [target_record_general?.fields[MENTAL]]
- Disease History: [target_record_medical?.fields[DISEASE]]
- Disability History: [target_record_medical?.fields[DISABILITY]]
+ General Notes: [target_record_medical?.fields[MOB_MEDICAL_NOTES]]
+ Psychiatric History: [target_record_general?.fields[MOB_MENTAL_STATUS]]
+ Disease History: [target_record_medical?.fields[MOB_DISEASES]]
+ Disability History: [target_record_medical?.fields[MOB_DISABILITIES]]

"} // autopsy report gets shwacked ontop if it exists and the target stat is dead - if(target_record_general.fields[HEALTH] == "Deceased" && target_record_medical.fields[AUTOPSY_SUBMISSION]) + if(target_record_general.fields[MOB_HEALTH_STATUS] == MOB_STAT_HEALTH_DECEASED && target_record_medical.fields[MOB_AUTOPSY_SUBMISSION]) contents += {"

Autopsy Report

- Autopsy Notes: [target_record_medical.fields[AUTOPSY_NOTES]]
- Cause Of Death: [target_record_medical.fields[DEATH]]
+ Autopsy Notes: [target_record_medical.fields[MOB_AUTOPSY_NOTES]]
+ Cause Of Death: [target_record_medical.fields[MOB_CAUSE_OF_DEATH]]
"} var/obj/item/paper/med_report = new (loc) @@ -187,20 +177,20 @@ target_record_general.fields[params["stat"]] = params["new_value"] return TRUE if("submitReport") - if(!target_record_medical.fields[DEATH]) + if(!target_record_medical.fields[MOB_CAUSE_OF_DEATH]) visible_message("[SPAN_BOLD("[src]")] states, \"LOG ERROR: You must select a cause of death before submitting a report.\"") return - target_record_medical.fields[AUTOPSY_SUBMISSION] = TRUE + target_record_medical.fields[MOB_AUTOPSY_SUBMISSION] = TRUE return TRUE /obj/structure/machinery/computer/double_id/med_data/ui_static_data(mob/user) var/list/data = list() // general information, it is never modified. Why pass it in so weirdly? because it makes it easy to add and remove stats in the future. data["general_record"] = list( - list(target_record_general?.fields["name"],"Name: "), - list(target_record_general?.fields["age"],"Age: "), - list(target_record_general?.fields["sex"],"Sex: "), - list(target_record_medical?.fields[BLOOD_TYPE],"Blood Type: ") + list(target_record_general?.fields[MOB_NAME],"Name: "), + list(target_record_general?.fields[MOB_AGE],"Age: "), + list(target_record_general?.fields[MOB_SEX],"Sex: "), + list(target_record_medical?.fields[MOB_BLOOD_TYPE],"Blood Type: ") ) return data @@ -210,29 +200,20 @@ // medical records, we pass it in as a list so it's better to handle in tgui. Might be ideal to pass in an associated list instead? data["medical_record"] = list( - list(MEDICAL, NOTES, target_record_medical?.fields[NOTES],"General Notes: "), - list(GENERAL, MENTAL, target_record_general?.fields[MENTAL],"Psychiatric History: "), - list(MEDICAL, DISEASE, target_record_medical?.fields[DISEASE],"Disease History: "), - list(MEDICAL, DISABILITY, target_record_medical?.fields[DISABILITY],"Disability History: ") + list(MEDICAL, MOB_MEDICAL_NOTES, target_record_medical?.fields[MOB_MEDICAL_NOTES],"General Notes: "), + list(GENERAL, MOB_MENTAL_STATUS, target_record_general?.fields[MOB_MENTAL_STATUS],"Psychiatric History: "), + list(MEDICAL, MOB_DISEASES, target_record_medical?.fields[MOB_DISEASES],"Disease History: "), + list(MEDICAL, MOB_DISABILITIES, target_record_medical?.fields[MOB_DISABILITIES],"Disability History: ") ) - data["death"] = list(MEDICAL, DEATH, target_record_medical?.fields[DEATH],"Cause Of Death: ") - data["health"] = list(GENERAL, HEALTH, target_record_general?.fields[HEALTH],"Health Status: ") - data["autopsy"] = list(MEDICAL, AUTOPSY_NOTES, target_record_medical?.fields[AUTOPSY_NOTES],"Autopsy Notes: ") - data["existingReport"] = target_record_medical?.fields[AUTOPSY_SUBMISSION] + data["death"] = list(MEDICAL, MOB_CAUSE_OF_DEATH, target_record_medical?.fields[MOB_CAUSE_OF_DEATH],"Cause Of Death: ") + data["health"] = list(GENERAL, MOB_HEALTH_STATUS, target_record_general?.fields[MOB_HEALTH_STATUS],"Health Status: ") + data["autopsy"] = list(MEDICAL, MOB_AUTOPSY_NOTES, target_record_medical?.fields[MOB_AUTOPSY_NOTES],"Autopsy Notes: ") + data["existingReport"] = target_record_medical?.fields[MOB_AUTOPSY_SUBMISSION] data["authenticated"] = authenticated data["has_id"] = !!target_id_card data["id_name"] = target_id_card ? target_id_card.name : "-----" return data -#undef AUTOPSY_NOTES -#undef NOTES -#undef MENTAL -#undef DISEASE -#undef DISABILITY -#undef HEALTH -#undef DEATH -#undef BLOOD_TYPE -#undef AUTOPSY_SUBMISSION #undef MEDICAL #undef GENERAL diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 4138d89908d4..e28057193a99 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -1,489 +1,556 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 -/obj/structure/machinery/computer/secure_data//TODO:SANITY +#define SECURITY 1 +#define GENERAL 0 + +/obj/structure/machinery/computer/secure_data//TODO:MIGRATE THIS SHIT TO TGUI. name = "Security Records" desc = "Used to view and edit personnel's security records" icon_state = "security" req_access = list(ACCESS_MARINE_BRIG) circuit = /obj/item/circuitboard/computer/secure_data - var/obj/item/card/id/scan = null + + // if the user currently logged into the system + var/authenticated = FALSE + + // the mob we select to view security logs from. + var/mob/living/carbon/human/target_mob + + // fugly list that we pass into tgui to display the data. Why fugly? see the retreieve_general_records proc. + var/list/general_records = list() + + // ID of the user currently griefing the logs + var/obj/item/card/id/user_id_card = null + var/obj/item/device/clue_scanner/scanner = null - var/rank = null - var/screen = 1 - var/datum/data/record/active1 = null - var/datum/data/record/active2 = null - var/a_id = null - var/temp = null - var/printing = null - var/can_change_id = 0 - var/list/Perp - var/tempname = null - //Sorting Variables - var/sortBy = "name" - var/order = 1 // -1 = Descending - 1 = Ascending - -/obj/structure/machinery/computer/secure_data/attackby(obj/item/O as obj, user as mob) - - if(istype(O, /obj/item/device/clue_scanner) && !scanner) - var/obj/item/device/clue_scanner/S = O - if(!S.print_list) - to_chat(user, SPAN_WARNING("There are no prints stored in \the [S]!")) - return - if(usr.drop_held_item()) - O.forceMove(src) - scanner = O - to_chat(user, "You insert [O].") + // target's security record + var/list/target_security_record = list() - ..() +/obj/structure/machinery/computer/secure_data/proc/authenticate(mob/user, obj/item/card/id/id_card) + if(!id_card) + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH ERROR: Authority confirmation card is missing!\"") + return FALSE -/obj/structure/machinery/computer/secure_data/attack_remote(mob/user as mob) - return attack_hand(user) + if(check_access(id_card)) + authenticated = TRUE + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGIN: Welcome, [id_card.registered_name]. Access granted.\"") + update_static_data(user) + return TRUE -//Someone needs to break down the dat += into chunks instead of long ass lines. -/obj/structure/machinery/computer/secure_data/attack_hand(mob/user as mob) - if(..() || inoperable()) - to_chat(user, SPAN_INFO("It does not appear to be working.")) - return + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH ERROR: You have not enough authority! Access denied.\"") + return FALSE - if(!allowed(usr)) - to_chat(user, SPAN_WARNING("Access denied.")) +/obj/structure/machinery/computer/secure_data/attackby(obj/card, mob/user) + if(!operable()) + to_chat(user, SPAN_NOTICE("You tried to inject \the [card] but \the [src] remains silent.")) return - if(!is_mainship_level(z)) - to_chat(user, SPAN_DANGER("Unable to establish a connection: \black You're too far away from the station!")) - return - var/dat + if(istype(card, /obj/item/card/id)) + if(user_id_card) + to_chat(user, "Remove the card first.") + return - if (temp) - dat = text("[]

Clear Screen", temp, src) + var/obj/item/card/id/idcard = card + if(!authenticate(user, card) && !is_not_allowed(user)) + return + user_id_card = idcard + if(user.drop_held_item()) + idcard.forceMove(src) + update_static_data(user) else - switch(screen) - if(1.0) - dat += {" -

"} - dat += text("Search Records
", src) - dat += text("New Record
", src) - if(scanner) - dat += text("Read Fingerprint
", src) - dat += {" -

- - - - -
Records:
- - - - - - -"} - if(!isnull(GLOB.data_core.general)) - for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order)) - var/crimstat = "" - for(var/datum/data/record/E in GLOB.data_core.security) - if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) - crimstat = E.fields["criminal"] - var/background - switch(crimstat) - if("*Arrest*") - background = "'background-color:#990c28;'" - if("Incarcerated") - background = "'background-color:#a16832;'" - if("Released") - background = "'background-color:#2981b3;'" - if("Suspect") - background = "'background-color:#686A6C;'" - if("NJP") - background = "'background-color:#faa20a;'" - if("None") - background = "'background-color:#008743;'" - if("") - background = "'background-color:#FFFFFF;'" - crimstat = "No Record." - dat += text("", background, src, R, R.fields["name"]) - dat += text("", R.fields["id"]) - dat += text("", R.fields["rank"]) - dat += text("", crimstat) - dat += "
NameIDRankCriminal Status
[][][][]

" - dat += text("Record Maintenance

", src) - if(2.0) - dat += "Records Maintenance
" - dat += "
Delete All Records

Back" - if(3.0) - dat += "
Security Record

" - if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) - dat += text(" \ -
\ - Name: [active1.fields["name"]]
\ - ID: [active1.fields["id"]]
\n \ - Sex: [active1.fields["sex"]]
\n \ - Age: [active1.fields["age"]]
\n \ - Rank: [active1.fields["rank"]]
\n \ - Physical Status: [active1.fields["p_stat"]]
\n \ - Mental Status: [active1.fields["m_stat"]]
Photo:
\ - \ -

Update front photo

Update side photo
\ -
") - else - dat += "General Record Lost!
" - if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) - dat += text("
\n
Security Data

\n \ - Criminal Status: []
\n \ - Incidents: [active2.fields["incident"]]
\n \ - \n
\n
Comments/Log

", \ - src, active2.fields["criminal"]) - if(islist(active2.fields["comments"])) - var/counter = 1 - for(var/com_i in active2.fields["comments"]) - var/comment = active2.fields["comments"][com_i] - var/comment_markup = text("[] / [] ([])\n", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) - if (isnull(comment["deleted_by"])) - comment_markup += text("Delete comment", src, counter) - comment_markup += text("
[]", comment["entry"]) - else - comment_markup += text("
Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) - counter++ - dat += "[comment_markup]

" - else - dat += "No comments

" - dat += text("Add comment

", src) - else - dat += "Security Record Lost!
" - dat += text("New Security Record

", src) - dat += text("\nPrint Record
\nBack
", src, src) - if(4.0) - if(!Perp.len) - dat += text("ERROR. String could not be located.

Back", src) - else - dat += {" - - "} - dat += text("", tempname) - dat += {" - -
Search Results for '[]':
- - - - - - - "} - for(var/i=1, i<=Perp.len, i += 2) - var/crimstat = "" - var/datum/data/record/R = Perp[i] - if(istype(Perp[i+1],/datum/data/record/)) - var/datum/data/record/E = Perp[i+1] - crimstat = E.fields["criminal"] - var/background - switch(crimstat) - if("*Arrest*") - background = "'background-color:#BB1133;'" - if("Incarcerated") - background = "'background-color:#B6732F;'" - if("Released") - background = "'background-color:#3BB9FF;'" - if("Suspect") - background = "'background-color:#686A6C;'" - if("NJP") - background = "'background-color:#faa20a;'" - if("None") - background = "'background-color:#1AAFFF;'" - if("") - background = "" - crimstat = "No Record." - dat += text("", background, src, R, R.fields["name"]) - dat += text("", R.fields["id"]) - dat += text("", R.fields["rank"]) - dat += text("", crimstat) - dat += "
NameIDRankCriminal Status
[][][][]

" - dat += text("
Return to index.", src) - if(5) - dat += generate_fingerprint_menu() - - show_browser(user, dat, "Security Records", "secure_rec", "size=600x400") + ..() + +/obj/structure/machinery/computer/secure_data/verb/eject_id() + set category = "Object" + set name = "Eject ID Card" + set src in oview(1) + + if(!usr || usr.is_mob_incapacitated()) return + + if(user_id_card) + user_id_card.loc = get_turf(src) + if(!usr.get_active_hand() && istype(usr,/mob/living/carbon/human)) + usr.put_in_hands(user_id_card) + if(operable()) + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGOUT: Session end confirmed.\"") + else + to_chat(usr, "You remove \the [user_id_card] from \the [src].") + authenticated = FALSE + user_id_card = null + else + to_chat(usr, "There is nothing to remove from the console.") return -/*Revised /N -I can't be bothered to look more of the actual code outside of switch but that probably needs revising too. -What a mess.*/ -/obj/structure/machinery/computer/secure_data/Topic(href, href_list) - if(..()) +// dump the general records, get all of them. Immutable data for now. +/obj/structure/machinery/computer/secure_data/proc/retrieve_general_records() + var/list/full_general_record + for(var/record as anything in GLOB.data_core.general) + var/datum/data/record/new_record = GLOB.data_core.general[record] + if(new_record[MOB_WEAKREF]) + full_general_record += list( + list(new_record?.fields[MOB_NAME],"Name: "), + list(new_record?.fields[MOB_AGE],"Age: "), + list(new_record?.fields[MOB_SEX],"Sex: "), + list(new_record?.fields[MOB_BLOOD_TYPE],"Blood Type: "), + new_record[MOB_WEAKREF] // so we know who is selecteed in tgui. + ) + + return full_general_record + +// to make accessing the records more performant we only retrieve the security logs when a new target is selected in tgui or the record itself is updated. +/obj/structure/machinery/computer/secure_data/proc/retrieve_target_security_record(mob/living/carbon/human/user) + if(!user) return - if (!( GLOB.data_core.general.Find(active1) )) - active1 = null - if (!( GLOB.data_core.security.Find(active2) )) - active2 = null - if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (isSilicon(usr))) - usr.set_interaction(src) - switch(href_list["choice"]) -// SORTING! - if("Sorting") - // Reverse the order if clicked twice - if(sortBy == href_list["sort"]) - if(order == 1) - order = -1 - else - order = 1 - else - // New sorting order! - sortBy = href_list["sort"] - order = initial(order) -//BASIC FUNCTIONS - if("Clear Screen") - temp = null - - if ("Return") - screen = 1 - active1 = null - active2 = null - - if("read_fingerprint") - screen = 5 - - if("print_report") - var/obj/item/paper/fingerprint/P = new /obj/item/paper/fingerprint(src, scanner.print_list) - P.forceMove(loc) - var/refkey = "" - for(var/obj/effect/decal/prints/print in scanner.print_list) - refkey += print.criminal_name - P.name = "fingerprint report ([md5(refkey)])" - playsound(loc, 'sound/machines/twobeep.ogg', 15, 1) - - if("return_menu") - screen = 1 - - if("return_clear") - QDEL_NULL_LIST(scanner.print_list) - scanner.update_icon() - scanner.forceMove(get_turf(src)) - scanner = null - screen = 1 - -//RECORD FUNCTIONS - if("Search Records") - var/t1 = input("Search String: (Partial Name or ID or Rank)", "Secure. records", null, null) as text - if ((!t1 || usr.stat || usr.is_mob_restrained() || !in_range(src, usr))) - return - Perp = new/list() - t1 = lowertext(t1) - var/list/components = splittext(t1, " ") - if(components.len > 5) - return //Lets not let them search too greedily. - for(var/datum/data/record/R in GLOB.data_core.general) - var/temptext = R.fields["name"] + " " + R.fields["id"] + " " + R.fields["rank"] - for(var/i = 1, i<=components.len, i++) - if(findtext(temptext,components[i])) - var/prelist = new/list(2) - prelist[1] = R - Perp += prelist - for(var/i = 1, i<=Perp.len, i+=2) - for(var/datum/data/record/E in GLOB.data_core.security) - var/datum/data/record/R = Perp[i] - if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) - Perp[i+1] = E - tempname = t1 - screen = 4 - - if("Record Maintenance") - screen = 2 - active1 = null - active2 = null - - if ("Browse Record") - var/datum/data/record/R = locate(href_list["d_rec"]) - var/S = locate(href_list["d_rec"]) - if (!( GLOB.data_core.general.Find(R) )) - temp = "Record Not Found!" - else - for(var/datum/data/record/E in GLOB.data_core.security) - if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"])) - S = E - active1 = R - active2 = S - screen = 3 - - - if ("Print Record") - if (!( printing )) - printing = 1 - var/datum/data/record/record1 = null - var/datum/data/record/record2 = null - if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) - record1 = active1 - if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) - record2 = active2 - sleep(50) - var/obj/item/paper/P = new /obj/item/paper( loc ) - P.info = "
Security Record

" - if (record1) - P.info += text("Name: []
\nID: []
\nSex: []
\nAge: []
\nRank: []
\nPhysical Status: []
\nMental Status: []
Criminal Status: []
", record1.fields["name"], record1.fields["id"], record1.fields["sex"], record1.fields["age"], record1.fields["rank"], record1.fields["p_stat"], record1.fields["m_stat"], record2.fields["criminal"]) - P.name = text("Security Record ([])", record1.fields["name"]) - else - P.info += "General Record Lost!
" - P.name = "Security Record" - if (record2) - P.info += text("
\n
Security Data

\nIncidents: [record2.fields["incident"]]
\n
\n
Comments/Log

") - if(islist(record2.fields["comments"]) || length(record2.fields["comments"]) > 0) - for(var/com_i in record2.fields["comments"]) - var/comment = record2.fields["comments"][com_i] - var/comment_markup = text("[] / [] ([])
", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) - if (isnull(comment["deleted_by"])) - comment_markup += comment["entry"] - else - comment_markup += text("Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) - P.info += "[comment_markup]

" - else - P.info += text("No comments
") - else - P.info += "Security Record Lost!
" - P.info += "" - printing = null - updateUsrDialog() -//RECORD DELETE - if ("Delete All Records") - temp = "" - temp += "Are you sure you wish to delete all Security records?
" - temp += "Yes
" - temp += "No" - - if ("Purge All Records") - for(var/datum/data/record/R in GLOB.data_core.security) - GLOB.data_core.security -= R - qdel(R) - temp = "All Security records deleted." - - if ("Add Entry") - if (!(istype(active2, /datum/data/record))) - return - var/a2 = active2 - var/t1 = copytext(trim(strip_html(input("Your name and time will be added to this new comment.", "Add a comment", null, null) as message)),1,MAX_MESSAGE_LEN) - if((!t1 || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isSilicon(usr))) || active2 != a2)) - return - var/created_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) - var/new_comment = list("entry" = t1, "created_by" = list("name" = "", "rank" = ""), "deleted_by" = null, "deleted_at" = null, "created_at" = created_at) - if(istype(usr,/mob/living/carbon/human)) - var/mob/living/carbon/human/U = usr - new_comment["created_by"] = list("name" = U.get_authentification_name(), "rank" = U.get_assignment()) - if(!islist(active2.fields["comments"])) - active2.fields["comments"] = list("1" = new_comment) - else - var/new_com_i = length(active2.fields["comments"]) + 1 - active2.fields["comments"]["[new_com_i]"] = new_comment - to_chat(usr, text("You have added a new comment to the Security Record of [].", active2.fields["name"])) - if ("Delete Entry") - if(!islist(active2.fields["comments"])) - return - if(active2.fields["comments"][href_list["del_c"]]) - var/updated_comments = active2.fields["comments"] - var/deleter = "" - if(istype(usr,/mob/living/carbon/human)) - var/mob/living/carbon/human/U = usr - deleter = "[U.get_authentification_name()] ([U.get_assignment()])" - updated_comments[href_list["del_c"]]["deleted_by"] = deleter - updated_comments[href_list["del_c"]]["deleted_at"] = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) - active2.fields["comments"] = updated_comments - to_chat(usr, text("You have deleted a comment from the Security Record of [].", active2.fields["name"])) -//RECORD CREATE - if ("New Record (Security)") - if ((istype(active1, /datum/data/record) && !( istype(active2, /datum/data/record) ))) - active2 = CreateSecurityRecord(active1.fields["name"], active1.fields["id"]) - screen = 3 - - if ("New Record (General)") - active1 = CreateGeneralRecord() - active2 = null - -//FIELD FUNCTIONS - if ("Edit Field") - if (is_not_allowed(usr)) - return - var/a1 = active1 - switch(href_list["field"]) - if("name") - if (istype(active1, /datum/data/record)) - var/t1 = reject_bad_name(input(usr, "Please input name:", "Secure. records", active1.fields["name"]) as text|null) - if (!t1 || active1 != a1) - return - message_admins("[key_name(usr)] has changed the record name of [active1.fields["name"]] to [t1]") - active1.fields["name"] = t1 - if("sex") - if (istype(active1, /datum/data/record)) - if (active1.fields["sex"] == "Male") - active1.fields["sex"] = "Female" - else - active1.fields["sex"] = "Male" - if("age") - if (istype(active1, /datum/data/record)) - var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num - if (!t1 || active1 != a1) - return - active1.fields["age"] = t1 - if("criminal") - if (istype(active2, /datum/data/record)) - temp = "
Criminal Status:
" - temp += "" - if("rank") - //This was so silly before the change. Now it actually works without beating your head against the keyboard. /N - if (istype(active1, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) - temp = "
Occupation:
" - temp += "
    " - for(var/rank in GLOB.joblist) - temp += "
  • [rank]
  • " - temp += "
" - else - alert(usr, "You do not have the required rank to do this!") - if("species") - if (istype(active1, /datum/data/record)) - var/t1 = copytext(trim(strip_html(input("Please enter race:", "General records", active1.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) - if (!t1 || active1 != a1) - return - active1.fields["species"] = t1 - - -//TEMPORARY MENU FUNCTIONS - else//To properly clear as per clear screen. - temp=null - switch(href_list["choice"]) - if ("Change Rank") - if (active1) - active1.fields["rank"] = href_list["rank"] - if(href_list["rank"] in GLOB.joblist) - active1.fields["real_rank"] = href_list["real_rank"] - - if ("Change Criminal Status") - if (active2) - switch(href_list["criminal2"]) - if("none") - active2.fields["criminal"] = "None" - if("arrest") - active2.fields["criminal"] = "*Arrest*" - if("incarcerated") - active2.fields["criminal"] = "Incarcerated" - if("released") - active2.fields["criminal"] = "Released" - if("suspect") - active2.fields["criminal"] = "Suspect" - if("njp") - active2.fields["criminal"] = "NJP" - - for(var/mob/living/carbon/human/H in GLOB.human_mob_list) - H.sec_hud_set_security_status() - - add_fingerprint(usr) - updateUsrDialog() - return + var/list/target_record + var/datum/data/record/target_sec_record = GLOB.data_core.security[user.record_id_ref] + target_record += list( + list(MOB_CRIMINAL_STATUS, target_sec_record?.fields[MOB_CRIMINAL_STATUS],"Criminal Status: "), + list(MOB_INCIDENTS, target_sec_record?.fields[MOB_INCIDENTS],"Incidents: "), + list(MOB_SECURITY_COMMENT_LOG, target_sec_record?.fields[MOB_SECURITY_COMMENT_LOG], "Security Entry: "), + list(MOB_SECURITY_NOTES, target_sec_record?.fields[MOB_SECURITY_NOTES], "Security Notes: ") + ) + + return target_record + + +/obj/structure/machinery/computer/secure_data/attack_hand(mob/user as mob) + if(..() || inoperable()) + return + + general_records = retrieve_general_records() + if(!general_records) + visible_message("[SPAN_BOLD("[src]")] states, \"DATACORE FAILURE: Unable to retrieve database logs.\"") + return + user.set_interaction(src) + tgui_interact(user) + +/obj/structure/machinery/computer/secure_data/attack_remote(mob/user as mob) + return attack_hand(user) + +/obj/structure/machinery/computer/secure_data/bullet_act() + return FALSE + +// //Someone needs to break down the dat += into chunks instead of long ass lines. +// /obj/structure/machinery/computer/secure_data/attack_hand(mob/user as mob) +// if(..() || inoperable()) +// to_chat(user, SPAN_INFO("It does not appear to be working.")) +// return + +// if(!allowed(usr)) +// to_chat(user, SPAN_WARNING("Access denied.")) +// return + +// if(!is_mainship_level(z)) +// to_chat(user, SPAN_DANGER("Unable to establish a connection: \black You're too far away from the station!")) +// return +// var/dat + +// if (temp) +// dat = text("[]

Clear Screen", temp, src) +// else +// switch(screen) +// if(1.0) +// dat += {" +//

"} +// dat += text("Search Records
", src) +// if(scanner) +// dat += text("Read Fingerprint
", src) +// dat += {" +//

+// +// +// +// +//
Records:
+// +// +// +// +// +// +// "} +// if(!isnull(GLOB.data_core.general)) +// for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order)) +// var/crimstat = "" +// for(var/datum/data/record/E in GLOB.data_core.security) +// if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) +// crimstat = E.fields["criminal"] +// var/background +// switch(crimstat) +// if("*Arrest*") +// background = "'background-color:#990c28;'" +// if("Incarcerated") +// background = "'background-color:#a16832;'" +// if("Released") +// background = "'background-color:#2981b3;'" +// if("Suspect") +// background = "'background-color:#686A6C;'" +// if("NJP") +// background = "'background-color:#faa20a;'" +// if("None") +// background = "'background-color:#008743;'" +// if("") +// background = "'background-color:#FFFFFF;'" +// crimstat = "No Record." +// dat += text("", background, src, R, R.fields["name"]) +// dat += text("", R.fields["id"]) +// dat += text("", R.fields["rank"]) +// dat += text("", crimstat) +// dat += "
NameIDRankCriminal Status
[][][][]

" +// dat += text("Record Maintenance

", src) +// if(2.0) +// dat += "Records Maintenance
" +// dat += "
Delete All Records

Back" +// if(3.0) +// dat += "
Security Record

" +// if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) +// dat += text(" \ +//
\ +// Name: [active1.fields["name"]]
\ +// ID: [active1.fields["id"]]
\n \ +// Sex: [active1.fields["sex"]]
\n \ +// Age: [active1.fields["age"]]
\n \ +// Rank: [active1.fields["rank"]]
\n \ +// Physical Status: [active1.fields["p_stat"]]
\n \ +// Mental Status: [active1.fields["m_stat"]]
Photo:
\ +// \ +//

Update front photo

Update side photo
\ +//
") +// else +// dat += "General Record Lost!
" +// if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) +// dat += text("
\n
Security Data

\n \ +// Criminal Status: []
\n \ +// Incidents: [active2.fields["incident"]]
\n \ +// \n
\n
Comments/Log

", \ +// src, active2.fields["criminal"]) +// if(islist(active2.fields["comments"])) +// var/counter = 1 +// for(var/com_i in active2.fields["comments"]) +// var/comment = active2.fields["comments"][com_i] +// var/comment_markup = text("[] / [] ([])\n", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) +// if (isnull(comment["deleted_by"])) +// comment_markup += text("Delete comment", src, counter) +// comment_markup += text("
[]", comment["entry"]) +// else +// comment_markup += text("
Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) +// counter++ +// dat += "[comment_markup]

" +// else +// dat += "No comments

" +// dat += text("Add comment

", src) +// else +// dat += "Security Record Lost!
" +// dat += text("\nPrint Record
\nBack
", src, src) +// if(4.0) +// if(!Perp.len) +// dat += text("ERROR. String could not be located.

Back", src) +// else +// dat += {" +// +// "} +// dat += text("", tempname) +// dat += {" +// +//
Search Results for '[]':
+// +// +// +// +// +// +// "} +// for(var/i=1, i<=Perp.len, i += 2) +// var/crimstat = "" +// var/datum/data/record/R = Perp[i] +// if(istype(Perp[i+1],/datum/data/record/)) +// var/datum/data/record/E = Perp[i+1] +// crimstat = E.fields["criminal"] +// var/background +// switch(crimstat) +// if("*Arrest*") +// background = "'background-color:#BB1133;'" +// if("Incarcerated") +// background = "'background-color:#B6732F;'" +// if("Released") +// background = "'background-color:#3BB9FF;'" +// if("Suspect") +// background = "'background-color:#686A6C;'" +// if("NJP") +// background = "'background-color:#faa20a;'" +// if("None") +// background = "'background-color:#1AAFFF;'" +// if("") +// background = "" +// crimstat = "No Record." +// dat += text("", background, src, R, R.fields["name"]) +// dat += text("", R.fields["id"]) +// dat += text("", R.fields["rank"]) +// dat += text("", crimstat) +// dat += "
NameIDRankCriminal Status
[][][][]

" +// dat += text("
Return to index.", src) +// if(5) +// dat += generate_fingerprint_menu() + +// show_browser(user, dat, "Security Records", "secure_rec", "size=600x400") +// return + +// /*Revised /N +// I can't be bothered to look more of the actual code outside of switch but that probably needs revising too. +// What a mess.*/ +// /obj/structure/machinery/computer/secure_data/Topic(href, href_list) +// if(..()) +// return +// if (!( GLOB.data_core.general.Find(active1) )) +// active1 = null +// if (!( GLOB.data_core.security.Find(active2) )) +// active2 = null +// if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (isSilicon(usr))) +// usr.set_interaction(src) +// switch(href_list["choice"]) +// // SORTING! +// if("Sorting") +// // Reverse the order if clicked twice +// if(sortBy == href_list["sort"]) +// if(order == 1) +// order = -1 +// else +// order = 1 +// else +// // New sorting order! +// sortBy = href_list["sort"] +// order = initial(order) +// //BASIC FUNCTIONS +// if("Clear Screen") +// temp = null + +// if ("Return") +// screen = 1 +// active1 = null +// active2 = null + +// if("read_fingerprint") +// screen = 5 + +// if("print_report") +// var/obj/item/paper/fingerprint/P = new /obj/item/paper/fingerprint(src, scanner.print_list) +// P.forceMove(loc) +// var/refkey = "" +// for(var/obj/effect/decal/prints/print in scanner.print_list) +// refkey += print.criminal_name +// P.name = "fingerprint report ([md5(refkey)])" +// playsound(loc, 'sound/machines/twobeep.ogg', 15, 1) + +// if("return_menu") +// screen = 1 + +// if("return_clear") +// QDEL_NULL_LIST(scanner.print_list) +// scanner.update_icon() +// scanner.forceMove(get_turf(src)) +// scanner = null +// screen = 1 + +// //RECORD FUNCTIONS +// if("Search Records") +// var/t1 = input("Search String: (Partial Name or ID or Rank)", "Secure. records", null, null) as text +// if ((!t1 || usr.stat || usr.is_mob_restrained() || !in_range(src, usr))) +// return +// Perp = new/list() +// t1 = lowertext(t1) +// var/list/components = splittext(t1, " ") +// if(components.len > 5) +// return //Lets not let them search too greedily. +// for(var/datum/data/record/R in GLOB.data_core.general) +// var/temptext = R.fields["name"] + " " + R.fields["id"] + " " + R.fields["rank"] +// for(var/i = 1, i<=components.len, i++) +// if(findtext(temptext,components[i])) +// var/prelist = new/list(2) +// prelist[1] = R +// Perp += prelist +// for(var/i = 1, i<=Perp.len, i+=2) +// for(var/datum/data/record/E in GLOB.data_core.security) +// var/datum/data/record/R = Perp[i] +// if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) +// Perp[i+1] = E +// tempname = t1 +// screen = 4 + +// if("Record Maintenance") +// screen = 2 +// active1 = null +// active2 = null + +// if ("Browse Record") +// var/datum/data/record/R = locate(href_list["d_rec"]) +// var/S = locate(href_list["d_rec"]) +// if (!( GLOB.data_core.general.Find(R) )) +// temp = "Record Not Found!" +// else +// for(var/datum/data/record/E in GLOB.data_core.security) +// if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"])) +// S = E +// active1 = R +// active2 = S +// screen = 3 + + +// if ("Print Record") +// if (!( printing )) +// printing = 1 +// var/datum/data/record/record1 = null +// var/datum/data/record/record2 = null +// if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) +// record1 = active1 +// if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) +// record2 = active2 +// sleep(50) +// var/obj/item/paper/P = new /obj/item/paper( loc ) +// P.info = "
Security Record

" +// if (record1) +// P.info += text("Name: []
\nID: []
\nSex: []
\nAge: []
\nRank: []
\nPhysical Status: []
\nMental Status: []
Criminal Status: []
", record1.fields["name"], record1.fields["id"], record1.fields["sex"], record1.fields["age"], record1.fields["rank"], record1.fields["p_stat"], record1.fields["m_stat"], record2.fields["criminal"]) +// P.name = text("Security Record ([])", record1.fields["name"]) +// else +// P.info += "General Record Lost!
" +// P.name = "Security Record" +// if (record2) +// P.info += text("
\n
Security Data

\nIncidents: [record2.fields["incident"]]
\n
\n
Comments/Log

") +// if(islist(record2.fields["comments"]) || length(record2.fields["comments"]) > 0) +// for(var/com_i in record2.fields["comments"]) +// var/comment = record2.fields["comments"][com_i] +// var/comment_markup = text("[] / [] ([])
", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) +// if (isnull(comment["deleted_by"])) +// comment_markup += comment["entry"] +// else +// comment_markup += text("Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) +// P.info += "[comment_markup]

" +// else +// P.info += text("No comments
") +// else +// P.info += "Security Record Lost!
" +// P.info += "" +// printing = null +// updateUsrDialog() + +// if ("Add Entry") +// if (!(istype(active2, /datum/data/record))) +// return +// var/a2 = active2 +// var/t1 = copytext(trim(strip_html(input("Your name and time will be added to this new comment.", "Add a comment", null, null) as message)),1,MAX_MESSAGE_LEN) +// if((!t1 || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isSilicon(usr))) || active2 != a2)) +// return +// var/created_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) +// var/new_comment = list("entry" = t1, "created_by" = list("name" = "", "rank" = ""), "deleted_by" = null, "deleted_at" = null, "created_at" = created_at) +// if(istype(usr,/mob/living/carbon/human)) +// var/mob/living/carbon/human/U = usr +// new_comment["created_by"] = list("name" = U.get_authentification_name(), "rank" = U.get_assignment()) +// if(!islist(active2.fields["comments"])) +// active2.fields["comments"] = list("1" = new_comment) +// else +// var/new_com_i = length(active2.fields["comments"]) + 1 +// active2.fields["comments"]["[new_com_i]"] = new_comment +// to_chat(usr, text("You have added a new comment to the Security Record of [].", active2.fields["name"])) + +// if ("Delete Entry") +// if(!islist(active2.fields["comments"])) +// return +// if(active2.fields["comments"][href_list["del_c"]]) +// var/updated_comments = active2.fields["comments"] +// var/deleter = "" +// if(istype(usr,/mob/living/carbon/human)) +// var/mob/living/carbon/human/U = usr +// deleter = "[U.get_authentification_name()] ([U.get_assignment()])" +// updated_comments[href_list["del_c"]]["deleted_by"] = deleter +// updated_comments[href_list["del_c"]]["deleted_at"] = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) +// active2.fields["comments"] = updated_comments +// to_chat(usr, text("You have deleted a comment from the Security Record of [].", active2.fields["name"])) + +// //FIELD FUNCTIONS +// if ("Edit Field") +// if (is_not_allowed(usr)) +// return +// var/a1 = active1 +// switch(href_list["field"]) +// if("name") +// if (istype(active1, /datum/data/record)) +// var/t1 = reject_bad_name(input(usr, "Please input name:", "Secure. records", active1.fields["name"]) as text|null) +// if (!t1 || active1 != a1) +// return +// message_admins("[key_name(usr)] has changed the record name of [active1.fields["name"]] to [t1]") +// active1.fields["name"] = t1 +// if("sex") +// if (istype(active1, /datum/data/record)) +// if (active1.fields["sex"] == "Male") +// active1.fields["sex"] = "Female" +// else +// active1.fields["sex"] = "Male" +// if("age") +// if (istype(active1, /datum/data/record)) +// var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num +// if (!t1 || active1 != a1) +// return +// active1.fields["age"] = t1 +// if("criminal") +// if (istype(active2, /datum/data/record)) +// temp = "
Criminal Status:
" +// temp += "" +// if("rank") +// //This was so silly before the change. Now it actually works without beating your head against the keyboard. /N +// if (istype(active1, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) +// temp = "
Occupation:
" +// temp += "
    " +// for(var/rank in GLOB.joblist) +// temp += "
  • [rank]
  • " +// temp += "
" +// else +// alert(usr, "You do not have the required rank to do this!") +// if("species") +// if (istype(active1, /datum/data/record)) +// var/t1 = copytext(trim(strip_html(input("Please enter race:", "General records", active1.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) +// if (!t1 || active1 != a1) +// return +// active1.fields["species"] = t1 + + +// //TEMPORARY MENU FUNCTIONS +// else//To properly clear as per clear screen. +// temp=null +// switch(href_list["choice"]) +// if ("Change Rank") +// if (active1) +// active1.fields["rank"] = href_list["rank"] +// if(href_list["rank"] in GLOB.joblist) +// active1.fields["real_rank"] = href_list["real_rank"] + +// if ("Change Criminal Status") +// if (active2) +// switch(href_list["criminal2"]) +// if("none") +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_NONE +// if("arrest") +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_ARREST +// if("incarcerated") +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_INCARCERATED +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_RELEASED +// if("suspect") +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_SUSPECT +// if("njp") +// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_NJP + +// for(var/mob/living/carbon/human/H in GLOB.human_mob_list) +// H.sec_hud_set_security_status() + +// add_fingerprint(usr) +// updateUsrDialog() +// return /obj/structure/machinery/computer/secure_data/proc/generate_fingerprint_menu() var/dat = "" @@ -521,24 +588,134 @@ What a mess.*/ if(prob(10/severity)) switch(rand(1,6)) if(1) - R.fields["name"] = "[pick(pick(GLOB.first_names_male), pick(GLOB.first_names_female))] [pick(GLOB.last_names)]" + R.fields[MOB_NAME] = "[pick(pick(GLOB.first_names_male), pick(GLOB.first_names_female))] [pick(GLOB.last_names)]" if(2) - R.fields["sex"] = pick("Male", "Female") + R.fields[MOB_SEX] = pick(MOB_STAT_SEX_MALE, MOB_STAT_SEX_FEMALE) if(3) - R.fields["age"] = rand(5, 85) + R.fields[MOB_AGE] = rand(5, 85) if(4) - R.fields["criminal"] = pick("None", "*Arrest*", "Incarcerated", "Released", "Suspect", "NJP") + R.fields[MOB_CRIMINAL_STATUS] = pick(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARCERATED) if(5) - R.fields["p_stat"] = pick("*Unconscious*", "Active", "Physically Unfit") + R.fields[MOB_HEALTH_STATUS] = pick(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_ACTIVE, MOB_STAT_HEALTH_UNFIT) if(6) - R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") - continue - - else if(prob(1)) - GLOB.data_core.security -= R - qdel(R) + R.fields[MOB_MENTAL_STATUS] = pick(MOB_STAT_MENTAL_STATUS_UNSTABLE, MOB_STAT_MENTAL_STATUS_ON_WATCH, MOB_STAT_MENTAL_STATUS_STABLE) continue /obj/structure/machinery/computer/secure_data/detective_computer icon = 'icons/obj/structures/machinery/computer.dmi' icon_state = "messyfiles" + +// TGUI SEC +// ------------------------------------------------------------------------------------------------------ // +/obj/structure/machinery/computer/secure_data/tgui_interact(mob/user, datum/tgui/ui) + + ui = SStgui.try_update_ui(user, src, ui) + if (!ui) + ui = new(user, src, "SecMod", name) + ui.open() + +/obj/structure/machinery/computer/secure_data/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + var/mob/user = ui.user + playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) + switch(action) + if("authenticate") + var/obj/item/id_card = user.get_active_hand() + if (istype(id_card, /obj/item/card/id)) + if(user.drop_held_item()) + id_card.forceMove(src) + user_id_card = id_card + if(authenticate(user, user_id_card)) + return TRUE + else + if(!user_id_card) + return + if(ishuman(user)) + user_id_card.forceMove(user.loc) + if(!user.get_active_hand()) + user.put_in_hands(user_id_card) + else + user_id_card.forceMove(loc) + user_id_card = null + if("logout") + visible_message("[SPAN_BOLD("[src]")] states, \"AUTH LOGOUT: Session end confirmed.\"") + authenticated = FALSE + if(ishuman(user)) + user_id_card.forceMove(user.loc) + if(!user.get_active_hand()) + user.put_in_hands(user_id_card) + else + user_id_card.forceMove(loc) + user_id_card = null + return TRUE + // if("print") + // if(!authenticated) + // return + + // if(!COOLDOWN_FINISHED(src, print_cooldown)) + // visible_message("[SPAN_BOLD("[src]")] states, \"PRINT ERROR: system is still on cooldown.\"") + // return + + // COOLDOWN_START(src, print_cooldown, PRINT_COOLDOWN_TIME ) + // playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) + // var/contents = {"

Medical Report

+ // Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
+ // For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+ //
+ //

General Information

+ // Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+ // Sex: [target_record_general?.fields[MOB_SEX]]
+ // Age: [target_record_general?.fields[MOB_AGE]]
+ // Blood Type: [target_record_medical?.fields[MOB_BLOOD_TYPE]]
+ //
+ //

Medical Notes

+ // General Notes: [target_record_medical?.fields[MOB_MEDICAL_NOTES]]
+ // Psychiatric History: [target_record_general?.fields[MOB_MENTAL_STATUS]]
+ // Disease History: [target_record_medical?.fields[MOB_DISEASES]]
+ // Disability History: [target_record_medical?.fields[MOB_DISABILITIES]]
+ //
+ // "} + + // // autopsy report gets shwacked ontop if it exists and the target stat is dead + // if(target_record_general.fields[MOB_HEALTH_STATUS] == MOB_STAT_HEALTH_DECEASED && target_record_medical.fields[MOB_AUTOPSY_SUBMISSION]) + // contents += {"

Autopsy Report

+ // Autopsy Notes: [target_record_medical.fields[MOB_AUTOPSY_NOTES]]
+ // Cause Of Death: [target_record_medical.fields[MOB_CAUSE_OF_DEATH]]
+ // "} + + // var/obj/item/paper/med_report = new (loc) + // med_report.name = "Medical Report" + // med_report.info += contents + // med_report.update_icon() + + // visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) + // return TRUE + if("selectTarget") + var/mob/living/carbon/human/new_rec_target = params["new_user"] + if(new_rec_target != target_mob) + target_security_record = retrieve_target_security_record(new_rec_target) + target_mob = new_rec_target + return TRUE + + if("updateStatRecord") + GLOB.data_core.security[target_mob.record_id_ref].fields[params["stat"]] = params["new_value"] + return TRUE + +/obj/structure/machinery/computer/secure_data/ui_static_data(mob/user) + var/list/data = list() + data["general_record"] = general_records + + return data + +/obj/structure/machinery/computer/secure_data/ui_data(mob/user) + var/list/data = list() + + data["security_record"] = target_security_record + data["authenticated"] = authenticated + data["has_id"] = !!user_id_card + data["id_name"] = user_id_card ? user_id_card.name : "-----" + + return data diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index cc4d93f5a24c..c5568313554a 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -1,6 +1,6 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 -/obj/structure/machinery/computer/skills//TODO:SANITY +/obj/structure/machinery/computer/skills//TODO:MIGRATE TO TGUI name = "Employment Records" desc = "Used to view personnel's employment records" icon_state = "medlaptop" @@ -265,9 +265,6 @@ What a mess.*/ temp = "
Are you sure you wish to delete the record (ALL)?
" temp += "Yes
" temp += "No" -//RECORD CREATE - if ("New Record (General)") - active1 = CreateGeneralRecord() //FIELD FUNCTIONS if ("Edit Field") @@ -366,4 +363,3 @@ What a mess.*/ GLOB.data_core.security -= R qdel(R) continue - diff --git a/code/game/machinery/medical_pod/autodoc.dm b/code/game/machinery/medical_pod/autodoc.dm index 7049df4c661c..610ca5512273 100644 --- a/code/game/machinery/medical_pod/autodoc.dm +++ b/code/game/machinery/medical_pod/autodoc.dm @@ -669,7 +669,7 @@ for(var/datum/data/record/R as anything in GLOB.data_core.medical) if (R.fields["ref"] == occupant_ref) N = R - if(isnull(N)) + // if(isnull(N)) N = create_medical_record(connected.occupant) if(!isnull(N.fields["autodoc_manual"])) diff --git a/code/game/objects/items/pamphlets.dm b/code/game/objects/items/pamphlets.dm index 763d78bd6ea6..2e675b59b301 100644 --- a/code/game/objects/items/pamphlets.dm +++ b/code/game/objects/items/pamphlets.dm @@ -97,7 +97,7 @@ var/obj/item/card/id/ID = user.wear_id ID.set_assignment((user.assigned_squad ? (user.assigned_squad.name + " ") : "") + "Spotter") - GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), "Spotter") + GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), "Spotter", record_id_ref = user.record_id_ref) /obj/item/pamphlet/skill/machinegunner name = "heavy machinegunner instructional pamphlet" diff --git a/code/modules/cm_marines/equipment/kit_boxes.dm b/code/modules/cm_marines/equipment/kit_boxes.dm index c26bafe7123a..38ebbd908b4d 100644 --- a/code/modules/cm_marines/equipment/kit_boxes.dm +++ b/code/modules/cm_marines/equipment/kit_boxes.dm @@ -298,7 +298,7 @@ if(specialist_assignment) user.put_in_hands(spec_box) ID.set_assignment((user.assigned_squad && squad_assignment_update ? (user.assigned_squad.name + " ") : "") + ID.assignment + " ([specialist_assignment])") - GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), ID.assignment) + GLOB.data_core.manifest_modify(user.real_name, WEAKREF(user), ID.assignment, user.record_id_ref) return TRUE return FALSE diff --git a/code/modules/gear_presets/uscm.dm b/code/modules/gear_presets/uscm.dm index eec3b6157877..e495089b19a5 100644 --- a/code/modules/gear_presets/uscm.dm +++ b/code/modules/gear_presets/uscm.dm @@ -32,7 +32,7 @@ . = ..() if(!auto_squad_name || (should_block_game_interaction(new_human) && !ert_squad)) return - if(!GLOB.data_core.manifest_modify(new_human.real_name, WEAKREF(new_human), assignment, rank)) + if(!GLOB.data_core.manifest_modify(new_human.real_name, WEAKREF(new_human), assignment, rank, new_human.record_id_ref)) GLOB.data_core.manifest_inject(new_human) var/obj/item/card/id/ID = new_human.wear_id diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index d13d5aa94053..28a48ef5fc0b 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -1172,7 +1172,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/mob/living/carbon/human/H = mind.original if(istype(H)) ref = WEAKREF(H) - GLOB.data_core.manifest_modify(name, ref, null, null, "*Deceased*") + GLOB.data_core.manifest_modify(name, ref, null, null, MOB_STAT_HEALTH_DECEASED) /mob/dead/observer/verb/view_kill_feed() diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index c97e4344cabf..67e9361a9583 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -12,7 +12,7 @@ - GLOB.data_core.manifest_modify(real_name, WEAKREF(src), null, null, "*Deceased*") + GLOB.data_core.manifest_modify(real_name, WEAKREF(src), null, null, MOB_STAT_HEALTH_DECEASED, record_id_ref = record_id_ref) if(is_a_synth) spawn_gibs() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index bc7d11c25e1f..a9d587a8aad0 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -21,6 +21,10 @@ if(SSticker?.mode?.hardcore) hardcore = TRUE //For WO disposing of corpses + if(ishuman_strict(src)) // turns out when u spawn mobs out of thin air they don't have records! + if(!src.record_id_ref) + GLOB.data_core.manifest_inject(src) + /mob/living/carbon/human/initialize_pass_flags(datum/pass_flags_container/PF) ..() if (PF) @@ -626,7 +630,7 @@ for(var/datum/data/record/R in GLOB.data_core.general) if(R.fields["id"] == E.fields["id"]) - var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", R.fields["p_stat"], list("*SSD*", "*Deceased*", "Physically Unfit", "Active", "Disabled", "Cancel")) + var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", R.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) if(hasHUD(usr,"medical")) if(setmedical != "Cancel") diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index e611452e9de7..728094548067 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -170,6 +170,9 @@ /// Stored image references associated with focus-fire. var/image/focused_fire_marker + // in the case of player controlled mobs it's the ckey, otherwise the original implementation of a large ass number. + var/record_id_ref = null + /client/var/cached_human_playtime /client/proc/get_total_human_playtime(skip_cache = FALSE) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 1a43138421e4..5d87a2aad8a8 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -7,7 +7,7 @@ return if(undefibbable && stat == DEAD || spawned_corpse) - GLOB.data_core.manifest_modify(real_name, WEAKREF(src), null, null, "*Deceased*") + GLOB.data_core.manifest_modify(real_name, WEAKREF(src), null, null, MOB_STAT_HEALTH_DECEASED, record_id_ref = record_id_ref) SShuman.processable_human_list -= src if(hardcore) qdel(src) //We just delete the corpse on WO to keep things simple and lag-free diff --git a/tgui/packages/tgui/interfaces/SecMod.jsx b/tgui/packages/tgui/interfaces/SecMod.jsx new file mode 100644 index 000000000000..91fcd0d6d7c8 --- /dev/null +++ b/tgui/packages/tgui/interfaces/SecMod.jsx @@ -0,0 +1,255 @@ +import { useLocalState } from '../backend'; +import { Box, Tabs } from '../components'; +import { Window } from '../layouts'; + +export const SecMod = (props) => { + const [tab2, setTab2] = useLocalState('tab2', 1); + return ( + + + + + setTab2(1)}> + Criminal Status + + setTab2(2)}> + Security Log + + + {tab2 === 1 && } + {tab2 === 2 && } + + + + ); +}; + +// export const MedicalRecord = (props) => { +// const { act, data } = useBackend(); +// const [tab, setTab] = useLocalState('tab', 1); +// const { +// authenticated, +// has_id, +// id_name, +// medical_record, +// health, +// autopsy, +// existingReport, +// death, +// } = data; +// return ( +// <> +//
act('print')} /> +// } +// /> +// {!!has_id && !!authenticated && ( +// +// +// setTab(1)}> +// Medical Notes +// +// setTab(2)}> +// Autopsy Report +// +// +// {tab === 1 && ( +//
+// +// {medical_record.map((record, index) => ( +// +// {record[3]} +// +// +// act('updateStatRecord', { +// stat_type: record[0], +// stat: record[1], +// new_value: value, +// }) +// } +// /> +// +// +// ))} +// +//
+// )} +// {tab === 2 && ( // should I have used a table instead of stack hell? Probably. +//
+// +// {health[2] == 'Deceased' && !existingReport && ( +// +// +// {autopsy[3]} +// +// +// act('updateStatRecord', { +// stat_type: autopsy[0], +// stat: autopsy[1], +// new_value: value, +// }) +// } +// /> +// +// +// +// +// +// {death[3]} +// +// +// act('updateStatRecord', { +// stat_type: death[0], +// stat: death[1], +// new_value: value, +// }) +// } +// displayText={death[2] ? death[2] : 'NONE'} +// /> +// +// +// +// +//
+// )} +//
+// )} +// +// ); +// }; + +// export const CrewStatus = (props) => { +// const { act, data } = useBackend(); +// const { authenticated, has_id, id_name, general_record, health } = data; + +// return ( +// <> +//
{ +// act(authenticated ? 'logout' : 'authenticate'); +// }} +// /> +// }> +//
+// {!!has_id && !!authenticated && ( +//
+// +// +// +// +// act('updateStatRecord', { +// stat_type: health[0], +// stat: health[1], +// new_value: value, +// }) +// } +// displayText={health[2]} +// /> +// +// +// +// {general_record.map(([value, label], index) => ( +// +// {label} {value} +// +// ))} +// +// +// +// +// +// +// +//
+// )} +// +// ); +// }; + +// // ----- const-------- // +// const healthStatusOptions = ['Unfit', 'Deceased', 'Active']; + +// const deathOptions = [ +// 'Organ Failure', +// 'Decapitation', +// 'Burn Trauma', +// 'Bullet Wound', +// 'Blunt Force Trauma', +// 'Blood Loss', +// 'Disease', +// ]; + +// const colors = { +// 'Deceased': 'red', +// 'Active': 'blue', +// 'Unfit': 'yellow', +// }; + +// // ----- const -------- // From 65155a089f81f8d1e077caad03cffcfd1b844205 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 12 May 2024 16:23:42 -0700 Subject: [PATCH 034/104] changes --- code/__DEFINES/human.dm | 2 +- code/datums/datacore.dm | 1 - code/defines/procs/records.dm | 3 +-- code/game/machinery/computer/medical.dm | 10 ++-------- code/modules/mob/living/carbon/human/human.dm | 6 +----- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/code/__DEFINES/human.dm b/code/__DEFINES/human.dm index 8530eacd2c73..9c4658aafbae 100644 --- a/code/__DEFINES/human.dm +++ b/code/__DEFINES/human.dm @@ -294,7 +294,7 @@ #define MOB_STAT_CRIME_ARREST "Arrest" #define MOB_STAT_CRIME_INCARCERATED "Incarcerated" -#define MOB_STAT_MENTAL_STATUS_LIST list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARDCERATED) +#define MOB_STAT_CRIME_STATUS_LIST list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARDCERATED) // ------------------------------------------------------------------------------------------------------------------ // // types of records diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index b28cad2165c3..8a06fb81ec6b 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -243,7 +243,6 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) else id_ref = text("[]", add_zero(num2hex(rand(1, 1.6777215E7)), 6)) // not a player controlled mob. target.record_id_ref = id_ref - create_general_record(target) create_medical_record(target) create_security_record(target) diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 3671d1c805fa..1908e05107bd 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -24,10 +24,9 @@ if(record_id) retrieved_record = selected_record_type[record_id] else - var/mob/living/carbon/human/human_ref = mob_ref for(var/record_id_query as anything in selected_record_type) var/datum/data/record/record = selected_record_type[record_id_query] - if(record.fields[MOB_NAME] == mob_name || record.fields[MOB_WEAKREF] == human_ref) + if(record.fields[MOB_NAME] == mob_name || record.fields[MOB_WEAKREF] == mob_ref) retrieved_record = record break diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 44ba912a9795..161370afef05 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -34,14 +34,8 @@ visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to read target ID.\"") return FALSE - if(!target_id.registered_ref) - visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to find target in database.\"") - return FALSE - - var/mob/living/carbon/human/referenced_human = target_id.registered_ref - if(referenced_human) - target_record_medical = retrieve_record(record_id = referenced_human.record_id_ref, record_type = RECORD_TYPE_MEDICAL) - target_record_general = retrieve_record(record_id = referenced_human.record_id_ref, record_type = RECORD_TYPE_GENERAL) + target_record_medical = retrieve_record(mob_name = target_id.registered_name, mob_ref = target_id.registered_ref, record_type = RECORD_TYPE_MEDICAL) + target_record_general = retrieve_record(mob_name = target_id.registered_name, mob_ref = target_id.registered_ref, record_type = RECORD_TYPE_GENERAL) if(!target_record_medical || !target_record_general) visible_message("[SPAN_BOLD("[src]")] states, \"CARD FAILURE: Unable to retrieve target records.\"") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index a9d587a8aad0..74d396cd897a 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -19,11 +19,7 @@ prev_gender = gender // Debug for plural genders if(SSticker?.mode?.hardcore) - hardcore = TRUE //For WO disposing of corpses - - if(ishuman_strict(src)) // turns out when u spawn mobs out of thin air they don't have records! - if(!src.record_id_ref) - GLOB.data_core.manifest_inject(src) + hardcore = TRUE //For WO disposing of corpsess /mob/living/carbon/human/initialize_pass_flags(datum/pass_flags_container/PF) ..() From b8773aa9b4e3e6cff40bd4bedb1f2b85f8a3501d Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 12 May 2024 19:57:44 -0700 Subject: [PATCH 035/104] progress. --- code/game/machinery/computer/medical.dm | 5 +- code/game/machinery/computer/security.dm | 78 ++------- tgui/packages/tgui/interfaces/SecMod.jsx | 210 ++++++++++++----------- 3 files changed, 132 insertions(+), 161 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 161370afef05..94774966e1c4 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -179,7 +179,8 @@ /obj/structure/machinery/computer/double_id/med_data/ui_static_data(mob/user) var/list/data = list() - // general information, it is never modified. Why pass it in so weirdly? because it makes it easy to add and remove stats in the future. + // general information, it is never modified. + // TODO, UTILIZE AN OBJECT INSTEAD. data["general_record"] = list( list(target_record_general?.fields[MOB_NAME],"Name: "), list(target_record_general?.fields[MOB_AGE],"Age: "), @@ -192,7 +193,7 @@ /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // medical records, we pass it in as a list so it's better to handle in tgui. Might be ideal to pass in an associated list instead? + // TODO, UTILIZE AN OBJECT INSTEAD. data["medical_record"] = list( list(MEDICAL, MOB_MEDICAL_NOTES, target_record_medical?.fields[MOB_MEDICAL_NOTES],"General Notes: "), list(GENERAL, MOB_MENTAL_STATUS, target_record_general?.fields[MOB_MENTAL_STATUS],"Psychiatric History: "), diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index e28057193a99..1b39130a41a2 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -86,14 +86,13 @@ var/list/full_general_record for(var/record as anything in GLOB.data_core.general) var/datum/data/record/new_record = GLOB.data_core.general[record] - if(new_record[MOB_WEAKREF]) - full_general_record += list( - list(new_record?.fields[MOB_NAME],"Name: "), - list(new_record?.fields[MOB_AGE],"Age: "), - list(new_record?.fields[MOB_SEX],"Sex: "), - list(new_record?.fields[MOB_BLOOD_TYPE],"Blood Type: "), - new_record[MOB_WEAKREF] // so we know who is selecteed in tgui. - ) + // TODO: PASS IN AN OBJECT INSTEAD + full_general_record += list( + list(new_record?.fields[MOB_NAME],"Name: "), + list(new_record?.fields[MOB_AGE],"Age: "), + list(new_record?.fields[MOB_SEX],"Sex: "), + list(new_record?.fields[MOB_BLOOD_TYPE],"Blood Type: "), + ) return full_general_record @@ -104,7 +103,8 @@ var/list/target_record var/datum/data/record/target_sec_record = GLOB.data_core.security[user.record_id_ref] - target_record += list( + target_record = list( + // TODO: PASS IN AN OBJECT INSTEAD list(MOB_CRIMINAL_STATUS, target_sec_record?.fields[MOB_CRIMINAL_STATUS],"Criminal Status: "), list(MOB_INCIDENTS, target_sec_record?.fields[MOB_INCIDENTS],"Incidents: "), list(MOB_SECURITY_COMMENT_LOG, target_sec_record?.fields[MOB_SECURITY_COMMENT_LOG], "Security Entry: "), @@ -651,55 +651,15 @@ user_id_card.forceMove(loc) user_id_card = null return TRUE - // if("print") - // if(!authenticated) - // return - - // if(!COOLDOWN_FINISHED(src, print_cooldown)) - // visible_message("[SPAN_BOLD("[src]")] states, \"PRINT ERROR: system is still on cooldown.\"") - // return - - // COOLDOWN_START(src, print_cooldown, PRINT_COOLDOWN_TIME ) - // playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) - // var/contents = {"

Medical Report

- // Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
- // For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
- //
- //

General Information

- // Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
- // Sex: [target_record_general?.fields[MOB_SEX]]
- // Age: [target_record_general?.fields[MOB_AGE]]
- // Blood Type: [target_record_medical?.fields[MOB_BLOOD_TYPE]]
- //
- //

Medical Notes

- // General Notes: [target_record_medical?.fields[MOB_MEDICAL_NOTES]]
- // Psychiatric History: [target_record_general?.fields[MOB_MENTAL_STATUS]]
- // Disease History: [target_record_medical?.fields[MOB_DISEASES]]
- // Disability History: [target_record_medical?.fields[MOB_DISABILITIES]]
- //
- // "} - - // // autopsy report gets shwacked ontop if it exists and the target stat is dead - // if(target_record_general.fields[MOB_HEALTH_STATUS] == MOB_STAT_HEALTH_DECEASED && target_record_medical.fields[MOB_AUTOPSY_SUBMISSION]) - // contents += {"

Autopsy Report

- // Autopsy Notes: [target_record_medical.fields[MOB_AUTOPSY_NOTES]]
- // Cause Of Death: [target_record_medical.fields[MOB_CAUSE_OF_DEATH]]
- // "} - - // var/obj/item/paper/med_report = new (loc) - // med_report.name = "Medical Report" - // med_report.info += contents - // med_report.update_icon() - - // visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) - // return TRUE if("selectTarget") - var/mob/living/carbon/human/new_rec_target = params["new_user"] - if(new_rec_target != target_mob) - target_security_record = retrieve_target_security_record(new_rec_target) - target_mob = new_rec_target + var/name = params["new_user"] + if(name == target_mob.name) + return + for(var/mob/living/carbon/human/selected_human in GLOB.human_mob_list) + if(selected_human.name == name) + target_mob = selected_human + target_security_record = retrieve_target_security_record(target_mob) return TRUE - if("updateStatRecord") GLOB.data_core.security[target_mob.record_id_ref].fields[params["stat"]] = params["new_value"] return TRUE @@ -707,15 +667,15 @@ /obj/structure/machinery/computer/secure_data/ui_static_data(mob/user) var/list/data = list() data["general_record"] = general_records - return data /obj/structure/machinery/computer/secure_data/ui_data(mob/user) var/list/data = list() + data["selecteded_target_name"] = target_mob ? target_mob.name : "None"// is there a selected target. data["security_record"] = target_security_record - data["authenticated"] = authenticated data["has_id"] = !!user_id_card - data["id_name"] = user_id_card ? user_id_card.name : "-----" + data["id_name"] = user_id_card ? user_id_card?.name : "-----" + data["authenticated"] = authenticated return data diff --git a/tgui/packages/tgui/interfaces/SecMod.jsx b/tgui/packages/tgui/interfaces/SecMod.jsx index 91fcd0d6d7c8..903ae698f2aa 100644 --- a/tgui/packages/tgui/interfaces/SecMod.jsx +++ b/tgui/packages/tgui/interfaces/SecMod.jsx @@ -1,46 +1,40 @@ -import { useLocalState } from '../backend'; -import { Box, Tabs } from '../components'; +import { Fragment } from 'react'; +import { useBackend, useLocalState } from '../backend'; +import { Box, Button, Stack, Section, Tabs, Flex, Icon } from '../components'; import { Window } from '../layouts'; +// just trying to get this to work, i'll fix it up later and implement your suggested changes paul. export const SecMod = (props) => { const [tab2, setTab2] = useLocalState('tab2', 1); return ( - + setTab2(1)}> Criminal Status - setTab2(2)}> + {/* setTab2(2)}> Security Log - + */} - {tab2 === 1 && } - {tab2 === 2 && } + {/* {tab2 === 2 && } */} + {tab2 === 1 && } ); }; -// export const MedicalRecord = (props) => { +// export const SecurityRecord = (props) => { // const { act, data } = useBackend(); // const [tab, setTab] = useLocalState('tab', 1); -// const { -// authenticated, -// has_id, -// id_name, -// medical_record, -// health, -// autopsy, -// existingReport, -// death, -// } = data; +// const { authenticated, has_id, id_name, security_record, selected_target } = +// data; // return ( // <> //
act('print')} /> // } @@ -168,88 +162,104 @@ export const SecMod = (props) => { // ); // }; -// export const CrewStatus = (props) => { -// const { act, data } = useBackend(); -// const { authenticated, has_id, id_name, general_record, health } = data; - -// return ( -// <> -//
{ -// act(authenticated ? 'logout' : 'authenticate'); -// }} -// /> -// }> -//
-// {!!has_id && !!authenticated && ( -//
-// -// -// -// -// act('updateStatRecord', { -// stat_type: health[0], -// stat: health[1], -// new_value: value, -// }) -// } -// displayText={health[2]} -// /> -// -// -// -// {general_record.map(([value, label], index) => ( -// -// {label} {value} -// -// ))} -// -// -// -// -// -// -// -//
-// )} -// -// ); -// }; +// TODO: UTILIZE OBJECTS. +export const CrewStatus = (props) => { + const { act, data } = useBackend(); + const { + authenticated, + has_id, + id_name, + general_record, + security_record, + selected_target_name, + } = data; -// // ----- const-------- // -// const healthStatusOptions = ['Unfit', 'Deceased', 'Active']; + return ( + <> +
{ + act(authenticated ? 'logout' : 'authenticate'); + }} + /> + } + /> + {!!has_id && !!authenticated && ( +
+ {general_record.map((record, index) => ( + + ))} +
+ )} + + ); +}; -// const deathOptions = [ -// 'Organ Failure', -// 'Decapitation', -// 'Burn Trauma', -// 'Bullet Wound', -// 'Blunt Force Trauma', -// 'Blood Loss', -// 'Disease', -// ]; +// ------- const-------- // +const crimeStatusOptions = ['Arrest', 'None', 'Incarcerated']; -// const colors = { -// 'Deceased': 'red', -// 'Active': 'blue', -// 'Unfit': 'yellow', -// }; +const colors = { + 'Arrest': 'red', + 'None': 'blue', + 'Incarcerated': 'yellow', +}; -// // ----- const -------- // +// ----- const -------- // From 8f71b5db4e1cfadb0fd0ab56e62031086af6d581 Mon Sep 17 00:00:00 2001 From: DOOM Date: Mon, 13 May 2024 15:34:56 -0700 Subject: [PATCH 036/104] progress --- code/defines/procs/records.dm | 11 ++ code/game/machinery/computer/medical.dm | 71 ++++++-- code/game/machinery/computer/security.dm | 117 +++++++----- .../interfaces/{MedMod.jsx => MedRec.jsx} | 58 +++--- .../interfaces/{SecMod.jsx => SecRec.jsx} | 170 +++++++++--------- 5 files changed, 259 insertions(+), 168 deletions(-) rename tgui/packages/tgui/interfaces/{MedMod.jsx => MedRec.jsx} (83%) rename tgui/packages/tgui/interfaces/{SecMod.jsx => SecRec.jsx} (70%) diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 1908e05107bd..0a7f234e94d4 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -32,6 +32,17 @@ return retrieved_record +/proc/insert_record_stat(record_id = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL, stat_type = null, new_stat = null) + if(!stat_type || !new_stat) + return + + var/datum/data/record/retrieved_record = retrieve_record(record_id, mob_name, mob_ref, record_type) + if(!retrieved_record) + return FALSE + retrieved_record[stat_type] = new_stat + + return TRUE + /proc/create_general_record(mob/living/carbon/human/person) var/datum/data/record/general_record = new() general_record.fields[MOB_NAME] = person.real_name ? person.real_name : "Unassigned" diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 94774966e1c4..595670516851 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -55,7 +55,7 @@ ui = SStgui.try_update_ui(user, src, ui) if (!ui) - ui = new(user, src, "MedMod", name) + ui = new(user, src, "MedRec", name) ui.open() /obj/structure/machinery/computer/double_id/med_data/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) @@ -179,13 +179,23 @@ /obj/structure/machinery/computer/double_id/med_data/ui_static_data(mob/user) var/list/data = list() - // general information, it is never modified. - // TODO, UTILIZE AN OBJECT INSTEAD. data["general_record"] = list( - list(target_record_general?.fields[MOB_NAME],"Name: "), - list(target_record_general?.fields[MOB_AGE],"Age: "), - list(target_record_general?.fields[MOB_SEX],"Sex: "), - list(target_record_medical?.fields[MOB_BLOOD_TYPE],"Blood Type: ") + list( + value = target_record_general?.fields[MOB_NAME], + message = "Name: " + ), + list( + value = target_record_general?.fields[MOB_AGE], + message ="Age: " + ), + list( + value = target_record_general?.fields[MOB_SEX], + message ="Sex: " + ), + list( + value = target_record_medical?.fields[MOB_BLOOD_TYPE], + message = "Blood Type: " + ) ) return data @@ -193,16 +203,47 @@ /obj/structure/machinery/computer/double_id/med_data/ui_data(mob/user) var/list/data = list() - // TODO, UTILIZE AN OBJECT INSTEAD. data["medical_record"] = list( - list(MEDICAL, MOB_MEDICAL_NOTES, target_record_medical?.fields[MOB_MEDICAL_NOTES],"General Notes: "), - list(GENERAL, MOB_MENTAL_STATUS, target_record_general?.fields[MOB_MENTAL_STATUS],"Psychiatric History: "), - list(MEDICAL, MOB_DISEASES, target_record_medical?.fields[MOB_DISEASES],"Disease History: "), - list(MEDICAL, MOB_DISABILITIES, target_record_medical?.fields[MOB_DISABILITIES],"Disability History: ") + list( + stat_type = MEDICAL, + stat = MOB_MEDICAL_NOTES, + value = target_record_medical?.fields[MOB_MEDICAL_NOTES], + message = "General Notes: " + ), + list( + stat_type = GENERAL, + stat = MOB_MENTAL_STATUS, + value = target_record_general?.fields[MOB_MENTAL_STATUS], + message = "Psychiatric History: " + ), + list( + stat_type = MEDICAL, + stat = MOB_DISEASES, + value = target_record_medical?.fields[MOB_DISEASES], + message = "Disease History: " + ), + list( + stat_type = MEDICAL, + stat = MOB_DISABILITIES, + value = target_record_medical?.fields[MOB_DISABILITIES], + message = "Disability History: " + ) ) - data["death"] = list(MEDICAL, MOB_CAUSE_OF_DEATH, target_record_medical?.fields[MOB_CAUSE_OF_DEATH],"Cause Of Death: ") - data["health"] = list(GENERAL, MOB_HEALTH_STATUS, target_record_general?.fields[MOB_HEALTH_STATUS],"Health Status: ") - data["autopsy"] = list(MEDICAL, MOB_AUTOPSY_NOTES, target_record_medical?.fields[MOB_AUTOPSY_NOTES],"Autopsy Notes: ") + data["death"] = list( + stat_type = MEDICAL, + stat = MOB_CAUSE_OF_DEATH, + value = target_record_medical?.fields[MOB_CAUSE_OF_DEATH], + message = "Cause Of Death: ") + data["health"] = list( + stat_type = GENERAL, + stat = MOB_HEALTH_STATUS, + value = target_record_general?.fields[MOB_HEALTH_STATUS], + message = "Health Status: ") + data["autopsy"] = list( + stat_type = MEDICAL, + stat = MOB_AUTOPSY_NOTES, + value = target_record_medical?.fields[MOB_AUTOPSY_NOTES], + message = "Autopsy Notes: ") data["existingReport"] = target_record_medical?.fields[MOB_AUTOPSY_SUBMISSION] data["authenticated"] = authenticated data["has_id"] = !!target_id_card diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 1b39130a41a2..efb1f5f0c786 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -8,22 +8,17 @@ icon_state = "security" req_access = list(ACCESS_MARINE_BRIG) circuit = /obj/item/circuitboard/computer/secure_data - // if the user currently logged into the system var/authenticated = FALSE - - // the mob we select to view security logs from. - var/mob/living/carbon/human/target_mob - - // fugly list that we pass into tgui to display the data. Why fugly? see the retreieve_general_records proc. - var/list/general_records = list() - // ID of the user currently griefing the logs var/obj/item/card/id/user_id_card = null - var/obj/item/device/clue_scanner/scanner = null - - // target's security record + // the names of all living human mobs. + var/list/human_mob_names = list() + // the name of the mob we select to view security logs from. + var/target_mob + // target's record + var/list/target_general_record = list() var/list/target_security_record = list() /obj/structure/machinery/computer/secure_data/proc/authenticate(mob/user, obj/item/card/id/id_card) @@ -81,45 +76,77 @@ to_chat(usr, "There is nothing to remove from the console.") return -// dump the general records, get all of them. Immutable data for now. -/obj/structure/machinery/computer/secure_data/proc/retrieve_general_records() - var/list/full_general_record +// dump the general records, get all of the names. Immutable data for the players. +/obj/structure/machinery/computer/secure_data/proc/retrieve_human_mob_names() + var/list/mob_names + + // No, we can't use GLOB.human_mob_list since a mob is removed from that list when it gets deleted. for(var/record as anything in GLOB.data_core.general) var/datum/data/record/new_record = GLOB.data_core.general[record] - // TODO: PASS IN AN OBJECT INSTEAD - full_general_record += list( - list(new_record?.fields[MOB_NAME],"Name: "), - list(new_record?.fields[MOB_AGE],"Age: "), - list(new_record?.fields[MOB_SEX],"Sex: "), - list(new_record?.fields[MOB_BLOOD_TYPE],"Blood Type: "), - ) + mob_names += new_record.fields[MOB_NAME] - return full_general_record + return mob_names // to make accessing the records more performant we only retrieve the security logs when a new target is selected in tgui or the record itself is updated. -/obj/structure/machinery/computer/secure_data/proc/retrieve_target_security_record(mob/living/carbon/human/user) - if(!user) +/obj/structure/machinery/computer/secure_data/proc/retrieve_target_record(username) + if(!username) return - var/list/target_record - var/datum/data/record/target_sec_record = GLOB.data_core.security[user.record_id_ref] - target_record = list( - // TODO: PASS IN AN OBJECT INSTEAD - list(MOB_CRIMINAL_STATUS, target_sec_record?.fields[MOB_CRIMINAL_STATUS],"Criminal Status: "), - list(MOB_INCIDENTS, target_sec_record?.fields[MOB_INCIDENTS],"Incidents: "), - list(MOB_SECURITY_COMMENT_LOG, target_sec_record?.fields[MOB_SECURITY_COMMENT_LOG], "Security Entry: "), - list(MOB_SECURITY_NOTES, target_sec_record?.fields[MOB_SECURITY_NOTES], "Security Notes: ") + // lowkey this use of associated lists for the record_id is unnecesasry in the new implementation, whatever, in 10 years someone can refactor it again. + var/datum/data/record/target_sec_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_SECURITY) + var/datum/data/record/target_gen_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_GENERAL) + target_general_record = list( + name = list( + value = target_gen_record?.fields[MOB_NAME], + message = "Name: " + ), + age =list( + value = target_gen_record?.fields[MOB_AGE], + message ="Age: " + ), + sex = list( + value = target_gen_record?.fields[MOB_SEX], + message ="Sex: " + ), + blood_type = list( + value = target_gen_record?.fields[MOB_BLOOD_TYPE], + message = "Blood Type: " + ) + ) + + target_security_record = list( + crime_stat = list( + stat = MOB_CRIMINAL_STATUS, + value = target_sec_record?.fields[MOB_CRIMINAL_STATUS], + message = "Criminal Status: " + ), + incident =list( + stat = MOB_INCIDENTS, + value = target_sec_record?.fields[MOB_INCIDENTS], + message = "Incidents: " + ), + entry = list( + stat = MOB_SECURITY_COMMENT_LOG, + value = target_sec_record?.fields[MOB_SECURITY_COMMENT_LOG], + message ="Security Entry: " + ), + notes = list( + stat = MOB_SECURITY_NOTES, + value = target_sec_record?.fields[MOB_SECURITY_NOTES], + message ="Security Notes: " + ) ) - return target_record + if(!target_gen_record || !target_security_record) + return FALSE + return TRUE /obj/structure/machinery/computer/secure_data/attack_hand(mob/user as mob) if(..() || inoperable()) return - general_records = retrieve_general_records() - if(!general_records) + if(!retrieve_human_mob_names()) visible_message("[SPAN_BOLD("[src]")] states, \"DATACORE FAILURE: Unable to retrieve database logs.\"") return user.set_interaction(src) @@ -611,7 +638,7 @@ ui = SStgui.try_update_ui(user, src, ui) if (!ui) - ui = new(user, src, "SecMod", name) + ui = new(user, src, "SecRec", name) ui.open() /obj/structure/machinery/computer/secure_data/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) @@ -653,27 +680,29 @@ return TRUE if("selectTarget") var/name = params["new_user"] - if(name == target_mob.name) + if(name == target_mob) return - for(var/mob/living/carbon/human/selected_human in GLOB.human_mob_list) - if(selected_human.name == name) - target_mob = selected_human - target_security_record = retrieve_target_security_record(target_mob) + target_mob = name + retrieve_target_record(name) return TRUE if("updateStatRecord") - GLOB.data_core.security[target_mob.record_id_ref].fields[params["stat"]] = params["new_value"] + insert_record_stat(mob_name = target_mob, record_type = RECORD_TYPE_SECURITY, stat_type = params["stat"], new_stat = params["new_value"]) + retrieve_target_record(target_mob) // let's update after we change any information. return TRUE + /obj/structure/machinery/computer/secure_data/ui_static_data(mob/user) var/list/data = list() - data["general_record"] = general_records + data["mob_names"] = human_mob_names return data /obj/structure/machinery/computer/secure_data/ui_data(mob/user) var/list/data = list() - data["selecteded_target_name"] = target_mob ? target_mob.name : "None"// is there a selected target. + data["human_mob_list"] = GLOB.human_mob_list + data["selected_target_name"] = target_mob ? target_mob : "None"// is there a selected target. data["security_record"] = target_security_record + data["general_record"] = target_general_record data["has_id"] = !!user_id_card data["id_name"] = user_id_card ? user_id_card?.name : "-----" data["authenticated"] = authenticated diff --git a/tgui/packages/tgui/interfaces/MedMod.jsx b/tgui/packages/tgui/interfaces/MedRec.jsx similarity index 83% rename from tgui/packages/tgui/interfaces/MedMod.jsx rename to tgui/packages/tgui/interfaces/MedRec.jsx index 1b119cbda8d5..2a6cba76fbb1 100644 --- a/tgui/packages/tgui/interfaces/MedMod.jsx +++ b/tgui/packages/tgui/interfaces/MedRec.jsx @@ -3,7 +3,7 @@ import { useBackend, useLocalState } from '../backend'; import { Box, Button, Stack, Input, Dropdown, Section, Tabs, Flex, Icon } from '../components'; import { Window } from '../layouts'; -export const MedMod = (props) => { +export const MedRec = (props) => { const [tab2, setTab2] = useLocalState('tab2', 1); return ( @@ -24,7 +24,6 @@ export const MedMod = (props) => { ); }; - export const MedicalRecord = (props) => { const { act, data } = useBackend(); const [tab, setTab] = useLocalState('tab', 1); @@ -38,6 +37,7 @@ export const MedicalRecord = (props) => { existingReport, death, } = data; + return ( <>
{ {medical_record.map((record, index) => ( - {record[3]} + {record.message} act('updateStatRecord', { - stat_type: record[0], - stat: record[1], + stat_type: record.stat_type, + stat: record.stat, new_value: value, }) } @@ -80,21 +80,21 @@ export const MedicalRecord = (props) => {
)} - {tab === 2 && ( // should I have used a table instead of stack hell? Probably. + {tab === 2 && (
- {health[2] == 'Deceased' && !existingReport && ( + {health.value === 'Deceased' && !existingReport && ( - {autopsy[3]} + {autopsy.message} act('updateStatRecord', { - stat_type: autopsy[0], - stat: autopsy[1], + stat_type: autopsy.stat_type, + stat: autopsy.stat, new_value: value, }) } @@ -104,21 +104,23 @@ export const MedicalRecord = (props) => { - {death[3]} + {death.message} act('updateStatRecord', { - stat_type: death[0], - stat: death[1], + stat_type: death.stat_type, + stat: death.stat, new_value: value, }) } - displayText={death[2] ? death[2] : 'NONE'} + displayText={ + death.value ? death.value : 'NONE' + } /> @@ -141,13 +143,13 @@ export const MedicalRecord = (props) => { - + {existingReport ? ( The autopsy report for {id_name} has been submitted. - ) : health[2] !== 'Deceased' ? ( + ) : health.value !== 'Deceased' ? ( The patient must be marked as deceased to create an autopsy report. @@ -169,6 +171,7 @@ export const MedicalRecord = (props) => { ); }; +// HealthStatus component export const HealthStatus = (props) => { const { act, data } = useBackend(); const { authenticated, has_id, id_name, general_record, health } = data; @@ -196,29 +199,29 @@ export const HealthStatus = (props) => {
{!!has_id && !!authenticated && (
- + act('updateStatRecord', { - stat_type: health[0], - stat: health[1], + stat_type: health.stat_type, + stat: health.stat, new_value: value, }) } - displayText={health[2]} + displayText={health.value} /> - {general_record.map(([value, label], index) => ( + {general_record.map(({ value, message }, index) => ( - {label} {value} + {message} {value} ))} @@ -233,7 +236,6 @@ export const HealthStatus = (props) => { ); }; - // ----- const-------- // const healthStatusOptions = ['Unfit', 'Deceased', 'Active']; diff --git a/tgui/packages/tgui/interfaces/SecMod.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx similarity index 70% rename from tgui/packages/tgui/interfaces/SecMod.jsx rename to tgui/packages/tgui/interfaces/SecRec.jsx index 903ae698f2aa..bb0f8f4a52cd 100644 --- a/tgui/packages/tgui/interfaces/SecMod.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -1,32 +1,36 @@ import { Fragment } from 'react'; import { useBackend, useLocalState } from '../backend'; -import { Box, Button, Stack, Section, Tabs, Flex, Icon } from '../components'; +import { Box, Button, Section, Tabs, Flex, Icon, Stack, Dropdown } from '../components'; import { Window } from '../layouts'; // just trying to get this to work, i'll fix it up later and implement your suggested changes paul. -export const SecMod = (props) => { +export const SecRec = (props) => { const [tab2, setTab2] = useLocalState('tab2', 1); return ( - + setTab2(1)}> + Crew Manifest + + setTab2(2)}> Criminal Status - {/* setTab2(2)}> - Security Log - */} + setTab2(2)}> + Criminal History + - {/* {tab2 === 2 && } */} - {tab2 === 1 && } + {tab2 === 1 && } + {tab2 === 2 && } + {/* {tab2 === 3 && } */} ); }; -// export const SecurityRecord = (props) => { +// export const CrimeHist = (props) => { // const { act, data } = useBackend(); // const [tab, setTab] = useLocalState('tab', 1); // const { authenticated, has_id, id_name, security_record, selected_target } = @@ -162,22 +166,49 @@ export const SecMod = (props) => { // ); // }; -// TODO: UTILIZE OBJECTS. -export const CrewStatus = (props) => { +// TODO - IMPLEMENT SEARCH BAR. +export const CrewManifest = (props) => { + const { act, data } = useBackend(); + const { human_mob_list } = data; + + return ( +
+ act('PRG_print', { + mode: 0, + }) + } + /> + }> + + {human_mob_list.map((record, index) => ( + {record} + ))} + +
+ ); +}; + +export const CrimeStat = (props) => { const { act, data } = useBackend(); const { authenticated, has_id, id_name, - general_record, - security_record, - selected_target_name, + general_record = [], + security_record = [], + selected_target_named, } = data; return ( <>
{ /> } /> - {!!has_id && !!authenticated && ( -
- {general_record.map((record, index) => ( - - ))} -
- )} + {!!has_id && + !!authenticated && + !!selected_target_named && + !!general_record.length && + !!security_record.length && ( +
+ + + + + act('updateStatRecord', { + stat: security_record.stat, + new_value: value, + }) + } + displayText={security_record.crime_stat} + /> + + + + {general_record.map(({ value, message }, index) => ( + + {message} {value} + + ))} + + + + + + + +
+ )} ); }; -// ------- const-------- // +// ----- const -------- // const crimeStatusOptions = ['Arrest', 'None', 'Incarcerated']; const colors = { - 'Arrest': 'red', - 'None': 'blue', - 'Incarcerated': 'yellow', + Arrest: 'red', + None: 'blue', + Incarcerated: 'yellow', }; - -// ----- const -------- // From 6fb02b92ed005a089cc8c1c07a5113900aee1f68 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 13:22:58 -0700 Subject: [PATCH 037/104] progress, needs testing. --- code/__DEFINES/human.dm | 3 +- code/__HELPERS/unsorted.dm | 10 +- code/datums/datacore.dm | 24 +- code/datums/medal_awards.dm | 18 +- code/datums/mob_hud.dm | 35 +- code/defines/procs/records.dm | 14 +- code/game/jobs/role_authority.dm | 6 +- code/game/machinery/computer/security.dm | 508 ++---------------- code/game/machinery/computer/sentencing.dm | 10 +- code/game/machinery/cryopod.dm | 19 +- code/game/machinery/medical_pod/autodoc.dm | 63 +-- .../game/machinery/medical_pod/bodyscanner.dm | 11 +- code/game/objects/items/bodybag.dm | 14 +- .../admin/player_panel/actions/physical.dm | 22 +- code/modules/client/preferences.dm | 9 +- code/modules/cm_marines/overwatch.dm | 38 +- .../mob/living/carbon/human/examine.dm | 23 +- code/modules/mob/living/carbon/human/human.dm | 85 ++- code/modules/paperwork/filingcabinet.dm | 20 +- tgui/packages/tgui/interfaces/MedRec.jsx | 264 ++++----- tgui/packages/tgui/interfaces/SecRec.jsx | 413 +++++++------- 21 files changed, 556 insertions(+), 1053 deletions(-) diff --git a/code/__DEFINES/human.dm b/code/__DEFINES/human.dm index 9c4658aafbae..89f0b550d437 100644 --- a/code/__DEFINES/human.dm +++ b/code/__DEFINES/human.dm @@ -294,7 +294,7 @@ #define MOB_STAT_CRIME_ARREST "Arrest" #define MOB_STAT_CRIME_INCARCERATED "Incarcerated" -#define MOB_STAT_CRIME_STATUS_LIST list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARDCERATED) +#define MOB_STAT_CRIME_STATUS_LIST list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARCERATED) // ------------------------------------------------------------------------------------------------------------------ // // types of records @@ -303,3 +303,4 @@ #define RECORD_TYPE_MEDICAL "medical" #define RECORD_TYPE_STATIC "locked" // immutable records, keeping it for now I guess. +#define RECORD_TYPE_LIST list(RECORD_TYPE_GENERAL, RECORD_TYPE_SECURITY, RECORD_TYPE_MEDICAL, RECORD_TYPE_STATIC ) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 3acadd5fe752..a84ed7babe9d 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -272,13 +272,9 @@ if(oldname) //update the datacore records! This is goig to be a bit costly. - var/mob_ref = WEAKREF(src) - for(var/list/L in list(GLOB.data_core.general, GLOB.data_core.medical, GLOB.data_core.security, GLOB.data_core.locked)) - for(var/datum/data/record/record_entry in L) - if(record_entry.fields[MOB_WEAKREF] == mob_ref) - record_entry.fields[MOB_NAME] = newname - record_entry.name = newname - break + for(var/record_type in RECORD_TYPE_LIST) + insert_record_stat(mob_name = oldname, record_type = record_type, stat_type = MOB_WEAKREF, new_stat = WEAKREF(src)) + insert_record_stat(mob_name = oldname, record_type = record_type, stat_type = MOB_NAME, new_stat = newname) //update our pda and id if we have them on our person var/list/searching = GetAllContents(searchDepth = 3) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 8a06fb81ec6b..33cda40b1cad 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -32,12 +32,13 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) ) departments += marines_by_squad var/list/manifest_out = list() - for(var/datum/data/record/record_entry in GLOB.data_core.general) - if(record_entry.fields["mob_faction"] != FACTION_MARINE) //we process only USCM humans + for(var/record in GLOB.data_core.general) + var/datum/data/record/record_entry = GLOB.data_core.general[general] // I regret using associated lists for this. + if(record_entry.fields[MOB_REAL_FACTION] != FACTION_MARINE) //we process only USCM humans continue - var/name = record_entry.fields["name"] - var/rank = record_entry.fields["rank"] - var/squad = record_entry.fields["squad"] + var/name = record_entry.fields[MOB_NAME] + var/rank = record_entry.fields[MOB_REAL_RANK] + var/squad = record_entry.fields[MOB_SQUAD] if(isnull(name) || isnull(rank)) continue var/has_department = FALSE @@ -51,8 +52,8 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) if(!manifest_out[department]) manifest_out[department] = list() manifest_out[department] += list(list( - "name" = name, - "rank" = rank + MOB_NAME = name, + MOB_SHOWN_RANK = rank )) has_department = TRUE break @@ -60,8 +61,8 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) if(!manifest_out["Miscellaneous"]) manifest_out["Miscellaneous"] = list() manifest_out["Miscellaneous"] += list(list( - "name" = name, - "rank" = rank + MOB_NAME = name, + MOB_SHOWN_RANK = rank )) return manifest_out @@ -85,6 +86,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) var/dept_flags = NO_FLAGS //Is there anybody in the department?. var/list/squad_sublists = GLOB.ROLES_SQUAD_ALL.Copy() //Are there any marines in the squad? + // fix for(var/datum/data/record/record_entry in GLOB.data_core.general) if(record_entry.fields[MOB_REAL_FACTION] != FACTION_MARINE) //we process only USCM humans continue @@ -214,13 +216,13 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) /datum/datacore/proc/manifest_modify(name, ref, assignment, rank, health_status, record_id_ref = null) var/datum/data/record/found_record = null - found_record = retrieve_record(record_id_ref, name, ref, RECORD_TYPE_GENERAL) + found_record = retrieve_record(mob_ref = ref, mob_name = name, record_type =RECORD_TYPE_GENERAL, record_id_ref = record_id_ref) if(found_record) if(assignment) found_record.fields[MOB_SHOWN_RANK] = assignment if(rank) - found_record.fields[MOB_REAL_RANK] = rank + found_record.fields[MOB_SHOWN_RANK] = rank if(health_status) found_record.fields[MOB_HEALTH_STATUS] = health_status if(name) diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 818d623033d2..5852e0849dc6 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -45,9 +45,10 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/datum/data/record/record in GLOB.data_core.general) - var/recipient_name = record.fields["name"] - recipient_ranks[recipient_name] = record.fields["rank"] + for(var/record_name in GLOB.data_core.general) + var/datum/data/record/record = GLOB.data_core.general[record_name] + var/recipient_name = record.fields[MOB_NAME] + recipient_ranks[recipient_name] = record.fields[MOB_REAL_RANK] possible_recipients += recipient_name var/chosen_recipient = tgui_input_list(usr, "Who do you want to award a medal to?", "Medal Recipient", possible_recipients) if(!chosen_recipient) @@ -163,9 +164,11 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME /proc/give_medal_award_prefilled(medal_location, mob/giving_mob, chosen_recipient, recipient_rank, recipient_ckey, reason, _medal_type) var/list/recipient_ranks = list() - for(var/datum/data/record/record in GLOB.data_core.general) - var/recipient_name = record.fields["name"] - recipient_ranks[recipient_name] = record.fields["rank"] + //fix + for(var/record_name in GLOB.data_core.general) + var/datum/data/record/record = GLOB.data_core.general[record_name] + var/recipient_name = record.fields[MOB_NAME] + recipient_ranks[recipient_name] = record.fields[MOB_SHOWN_RANK] if(!chosen_recipient) return FALSE @@ -473,7 +476,8 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/datum/data/record/record in GLOB.data_core.general) + for(var/record_name in GLOB.data_core.general) + var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields["name"] if(recipient_name == recommendation_giver.real_name) continue diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index 437d0e6a662d..5b1a4f4afb67 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -622,27 +622,20 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( if(!GLOB.data_core) return - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == perpref) - for(var/datum/data/record/R in GLOB.data_core.security) - if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) - holder.icon_state = "hudsec_wanted" - criminal = TRUE - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated")) - holder.icon_state = "hudsec_prisoner" - criminal = TRUE - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released")) - holder.icon_state = "hudsec_released" - criminal = FALSE - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Suspect")) - holder.icon_state = "hudsec_suspect" - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "NJP")) - holder.icon_state = "hudsec_njp" - break + var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) + switch(security_record.fields[MOB_CRIMINAL_STATUS]) + if(MOB_STAT_CRIME_ARREST) + holder.icon_state = "hudsec_wanted" + criminal = TRUE + return + if(MOB_STAT_CRIME_INCARCERATED) + holder.icon_state = "hudsec_prisoner" + criminal = TRUE + return + if(MOB_STAT_CRIME_NONE) + holder.icon_state = null + criminal = FALSE + //Squad HUD /mob/proc/hud_set_squad() diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 0a7f234e94d4..2bb9f88aee95 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -34,12 +34,12 @@ /proc/insert_record_stat(record_id = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL, stat_type = null, new_stat = null) if(!stat_type || !new_stat) - return + return FALSE var/datum/data/record/retrieved_record = retrieve_record(record_id, mob_name, mob_ref, record_type) if(!retrieved_record) return FALSE - retrieved_record[stat_type] = new_stat + retrieved_record.fields[stat_type] = new_stat return TRUE @@ -68,13 +68,9 @@ security_record.fields[MOB_NAME] = person.name ? person.name : "Unknown" security_record.name = text("Security Record") security_record.fields[MOB_CRIMINAL_STATUS] = "None" - security_record.fields[MOB_INCIDENTS] = "None" + security_record.fields[MOB_INCIDENTS] = list() security_record.fields[MOB_WEAKREF] = WEAKREF(person) - - if(person.sec_record && !jobban_isbanned(person, "Records")) - var/new_comment = list("entry" = person.sec_record, "created_by" = list("name" = "\[REDACTED\]", "rank" = "Military Police"), "deleted_by" = null, "deleted_at" = null, "created_at" = "Pre-Deployment") - security_record.fields[MOB_SECURITY_COMMENT_LOG] = list("1" = new_comment) - security_record.fields[MOB_SECURITY_NOTES] = person.sec_record + security_record.fields[MOB_SECURITY_NOTES] = person.sec_record && !jobban_isbanned(person, "Records") ? person.sec_record : "No notes found." GLOB.data_core.security[person.record_id_ref] += security_record /proc/create_medical_record(mob/living/carbon/human/person) @@ -109,5 +105,5 @@ record_locked.fields[MOB_SHOWN_FACTION] = person.personal_faction record_locked.fields[MOB_RELIGION] = person.religion record_locked.fields[MOB_WEAKREF] = WEAKREF(person) - record_locked.fields[MOB_EXPLOIT_RECORD] = person.exploit_record && !jobban_isbanned(person, "Records") ? person.exploit_record : "No additional information acquired" + record_locked.fields[MOB_EXPLOIT_RECORD] = !jobban_isbanned(person, "Records") ? person.exploit_record : "No additional information acquired" GLOB.data_core.locked[person.record_id_ref] += record_locked diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm index 58c9ad5b5092..d0d0ea14ebb7 100644 --- a/code/game/jobs/role_authority.dm +++ b/code/game/jobs/role_authority.dm @@ -795,11 +795,7 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou new_squad.update_free_mar() var/marine_ref = WEAKREF(transfer_marine) - for(var/datum/data/record/t in GLOB.data_core.general) //we update the crew manifest - if(t.fields["ref"] == marine_ref) - t.fields["squad"] = new_squad.name - break - + insert_record_stat( record_id_ref = transfer_marine.record_id_ref, mob_ref = marine_ref, record_type = RECORD_TYPE_GENERAL, stat_type = MOB_SQUAD, new_stat = new_squad.name ) transfer_marine.hud_set_squad() // returns TRUE if transfer_marine's role is at max capacity in the new squad diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index efb1f5f0c786..7a6502447202 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -17,9 +17,13 @@ var/list/human_mob_names = list() // the name of the mob we select to view security logs from. var/target_mob - // target's record + // target's general record var/list/target_general_record = list() - var/list/target_security_record = list() + + // target security related logs, it needs to be separate because otherwise it's a pain to parse in tgui. + var/list/crime_stat = list() + var/list/incident = list() + var/list/notes = list() /obj/structure/machinery/computer/secure_data/proc/authenticate(mob/user, obj/item/card/id/id_card) if(!id_card) @@ -76,7 +80,7 @@ to_chat(usr, "There is nothing to remove from the console.") return -// dump the general records, get all of the names. Immutable data for the players. +// dump the general records, get all of the names. Immutable data. /obj/structure/machinery/computer/secure_data/proc/retrieve_human_mob_names() var/list/mob_names @@ -92,52 +96,42 @@ if(!username) return - // lowkey this use of associated lists for the record_id is unnecesasry in the new implementation, whatever, in 10 years someone can refactor it again. + // lowkey this use of associated lists for the record_id is unnecessary in the new implementation, whatever, in 10 years someone can refactor it again. var/datum/data/record/target_sec_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_SECURITY) var/datum/data/record/target_gen_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_GENERAL) target_general_record = list( - name = list( + list( value = target_gen_record?.fields[MOB_NAME], message = "Name: " ), - age =list( + list( value = target_gen_record?.fields[MOB_AGE], message ="Age: " ), - sex = list( + list( value = target_gen_record?.fields[MOB_SEX], message ="Sex: " ), - blood_type = list( - value = target_gen_record?.fields[MOB_BLOOD_TYPE], - message = "Blood Type: " - ) ) - target_security_record = list( - crime_stat = list( - stat = MOB_CRIMINAL_STATUS, - value = target_sec_record?.fields[MOB_CRIMINAL_STATUS], - message = "Criminal Status: " - ), - incident =list( - stat = MOB_INCIDENTS, - value = target_sec_record?.fields[MOB_INCIDENTS], - message = "Incidents: " - ), - entry = list( - stat = MOB_SECURITY_COMMENT_LOG, - value = target_sec_record?.fields[MOB_SECURITY_COMMENT_LOG], - message ="Security Entry: " - ), - notes = list( - stat = MOB_SECURITY_NOTES, - value = target_sec_record?.fields[MOB_SECURITY_NOTES], - message ="Security Notes: " - ) + crime_stat = list( + stat = MOB_CRIMINAL_STATUS, + value = target_sec_record?.fields[MOB_CRIMINAL_STATUS], + message = "Criminal Status: " + ) + incident = list( + stat = MOB_INCIDENTS, + value = target_sec_record?.fields[MOB_INCIDENTS], + message = "Incidents: " + ) + notes = list( + stat = MOB_SECURITY_NOTES, + value = target_sec_record?.fields[MOB_SECURITY_NOTES], + message ="Security Notes: " ) - if(!target_gen_record || !target_security_record) + if(!target_gen_record || !crime_stat) + visible_message("[SPAN_BOLD("[src]")] states, \"DATACORE FAILURE: Unable to retrieve database logs.\"") return FALSE return TRUE @@ -158,427 +152,6 @@ /obj/structure/machinery/computer/secure_data/bullet_act() return FALSE -// //Someone needs to break down the dat += into chunks instead of long ass lines. -// /obj/structure/machinery/computer/secure_data/attack_hand(mob/user as mob) -// if(..() || inoperable()) -// to_chat(user, SPAN_INFO("It does not appear to be working.")) -// return - -// if(!allowed(usr)) -// to_chat(user, SPAN_WARNING("Access denied.")) -// return - -// if(!is_mainship_level(z)) -// to_chat(user, SPAN_DANGER("Unable to establish a connection: \black You're too far away from the station!")) -// return -// var/dat - -// if (temp) -// dat = text("[]

Clear Screen", temp, src) -// else -// switch(screen) -// if(1.0) -// dat += {" -//

"} -// dat += text("Search Records
", src) -// if(scanner) -// dat += text("Read Fingerprint
", src) -// dat += {" -//

-// -// -// -// -//
Records:
-// -// -// -// -// -// -// "} -// if(!isnull(GLOB.data_core.general)) -// for(var/datum/data/record/R in sortRecord(GLOB.data_core.general, sortBy, order)) -// var/crimstat = "" -// for(var/datum/data/record/E in GLOB.data_core.security) -// if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) -// crimstat = E.fields["criminal"] -// var/background -// switch(crimstat) -// if("*Arrest*") -// background = "'background-color:#990c28;'" -// if("Incarcerated") -// background = "'background-color:#a16832;'" -// if("Released") -// background = "'background-color:#2981b3;'" -// if("Suspect") -// background = "'background-color:#686A6C;'" -// if("NJP") -// background = "'background-color:#faa20a;'" -// if("None") -// background = "'background-color:#008743;'" -// if("") -// background = "'background-color:#FFFFFF;'" -// crimstat = "No Record." -// dat += text("", background, src, R, R.fields["name"]) -// dat += text("", R.fields["id"]) -// dat += text("", R.fields["rank"]) -// dat += text("", crimstat) -// dat += "
NameIDRankCriminal Status
[][][][]

" -// dat += text("Record Maintenance

", src) -// if(2.0) -// dat += "Records Maintenance
" -// dat += "
Delete All Records

Back" -// if(3.0) -// dat += "
Security Record

" -// if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) -// dat += text(" \ -//
\ -// Name: [active1.fields["name"]]
\ -// ID: [active1.fields["id"]]
\n \ -// Sex: [active1.fields["sex"]]
\n \ -// Age: [active1.fields["age"]]
\n \ -// Rank: [active1.fields["rank"]]
\n \ -// Physical Status: [active1.fields["p_stat"]]
\n \ -// Mental Status: [active1.fields["m_stat"]]
Photo:
\ -// \ -//

Update front photo

Update side photo
\ -//
") -// else -// dat += "General Record Lost!
" -// if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) -// dat += text("
\n
Security Data

\n \ -// Criminal Status: []
\n \ -// Incidents: [active2.fields["incident"]]
\n \ -// \n
\n
Comments/Log

", \ -// src, active2.fields["criminal"]) -// if(islist(active2.fields["comments"])) -// var/counter = 1 -// for(var/com_i in active2.fields["comments"]) -// var/comment = active2.fields["comments"][com_i] -// var/comment_markup = text("[] / [] ([])\n", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) -// if (isnull(comment["deleted_by"])) -// comment_markup += text("Delete comment", src, counter) -// comment_markup += text("
[]", comment["entry"]) -// else -// comment_markup += text("
Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) -// counter++ -// dat += "[comment_markup]

" -// else -// dat += "No comments

" -// dat += text("Add comment

", src) -// else -// dat += "Security Record Lost!
" -// dat += text("\nPrint Record
\nBack
", src, src) -// if(4.0) -// if(!Perp.len) -// dat += text("ERROR. String could not be located.

Back", src) -// else -// dat += {" -// -// "} -// dat += text("", tempname) -// dat += {" -// -//
Search Results for '[]':
-// -// -// -// -// -// -// "} -// for(var/i=1, i<=Perp.len, i += 2) -// var/crimstat = "" -// var/datum/data/record/R = Perp[i] -// if(istype(Perp[i+1],/datum/data/record/)) -// var/datum/data/record/E = Perp[i+1] -// crimstat = E.fields["criminal"] -// var/background -// switch(crimstat) -// if("*Arrest*") -// background = "'background-color:#BB1133;'" -// if("Incarcerated") -// background = "'background-color:#B6732F;'" -// if("Released") -// background = "'background-color:#3BB9FF;'" -// if("Suspect") -// background = "'background-color:#686A6C;'" -// if("NJP") -// background = "'background-color:#faa20a;'" -// if("None") -// background = "'background-color:#1AAFFF;'" -// if("") -// background = "" -// crimstat = "No Record." -// dat += text("", background, src, R, R.fields["name"]) -// dat += text("", R.fields["id"]) -// dat += text("", R.fields["rank"]) -// dat += text("", crimstat) -// dat += "
NameIDRankCriminal Status
[][][][]

" -// dat += text("
Return to index.", src) -// if(5) -// dat += generate_fingerprint_menu() - -// show_browser(user, dat, "Security Records", "secure_rec", "size=600x400") -// return - -// /*Revised /N -// I can't be bothered to look more of the actual code outside of switch but that probably needs revising too. -// What a mess.*/ -// /obj/structure/machinery/computer/secure_data/Topic(href, href_list) -// if(..()) -// return -// if (!( GLOB.data_core.general.Find(active1) )) -// active1 = null -// if (!( GLOB.data_core.security.Find(active2) )) -// active2 = null -// if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (isSilicon(usr))) -// usr.set_interaction(src) -// switch(href_list["choice"]) -// // SORTING! -// if("Sorting") -// // Reverse the order if clicked twice -// if(sortBy == href_list["sort"]) -// if(order == 1) -// order = -1 -// else -// order = 1 -// else -// // New sorting order! -// sortBy = href_list["sort"] -// order = initial(order) -// //BASIC FUNCTIONS -// if("Clear Screen") -// temp = null - -// if ("Return") -// screen = 1 -// active1 = null -// active2 = null - -// if("read_fingerprint") -// screen = 5 - -// if("print_report") -// var/obj/item/paper/fingerprint/P = new /obj/item/paper/fingerprint(src, scanner.print_list) -// P.forceMove(loc) -// var/refkey = "" -// for(var/obj/effect/decal/prints/print in scanner.print_list) -// refkey += print.criminal_name -// P.name = "fingerprint report ([md5(refkey)])" -// playsound(loc, 'sound/machines/twobeep.ogg', 15, 1) - -// if("return_menu") -// screen = 1 - -// if("return_clear") -// QDEL_NULL_LIST(scanner.print_list) -// scanner.update_icon() -// scanner.forceMove(get_turf(src)) -// scanner = null -// screen = 1 - -// //RECORD FUNCTIONS -// if("Search Records") -// var/t1 = input("Search String: (Partial Name or ID or Rank)", "Secure. records", null, null) as text -// if ((!t1 || usr.stat || usr.is_mob_restrained() || !in_range(src, usr))) -// return -// Perp = new/list() -// t1 = lowertext(t1) -// var/list/components = splittext(t1, " ") -// if(components.len > 5) -// return //Lets not let them search too greedily. -// for(var/datum/data/record/R in GLOB.data_core.general) -// var/temptext = R.fields["name"] + " " + R.fields["id"] + " " + R.fields["rank"] -// for(var/i = 1, i<=components.len, i++) -// if(findtext(temptext,components[i])) -// var/prelist = new/list(2) -// prelist[1] = R -// Perp += prelist -// for(var/i = 1, i<=Perp.len, i+=2) -// for(var/datum/data/record/E in GLOB.data_core.security) -// var/datum/data/record/R = Perp[i] -// if ((E.fields["name"] == R.fields["name"] && E.fields["id"] == R.fields["id"])) -// Perp[i+1] = E -// tempname = t1 -// screen = 4 - -// if("Record Maintenance") -// screen = 2 -// active1 = null -// active2 = null - -// if ("Browse Record") -// var/datum/data/record/R = locate(href_list["d_rec"]) -// var/S = locate(href_list["d_rec"]) -// if (!( GLOB.data_core.general.Find(R) )) -// temp = "Record Not Found!" -// else -// for(var/datum/data/record/E in GLOB.data_core.security) -// if ((E.fields["name"] == R.fields["name"] || E.fields["id"] == R.fields["id"])) -// S = E -// active1 = R -// active2 = S -// screen = 3 - - -// if ("Print Record") -// if (!( printing )) -// printing = 1 -// var/datum/data/record/record1 = null -// var/datum/data/record/record2 = null -// if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) -// record1 = active1 -// if ((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2))) -// record2 = active2 -// sleep(50) -// var/obj/item/paper/P = new /obj/item/paper( loc ) -// P.info = "
Security Record

" -// if (record1) -// P.info += text("Name: []
\nID: []
\nSex: []
\nAge: []
\nRank: []
\nPhysical Status: []
\nMental Status: []
Criminal Status: []
", record1.fields["name"], record1.fields["id"], record1.fields["sex"], record1.fields["age"], record1.fields["rank"], record1.fields["p_stat"], record1.fields["m_stat"], record2.fields["criminal"]) -// P.name = text("Security Record ([])", record1.fields["name"]) -// else -// P.info += "General Record Lost!
" -// P.name = "Security Record" -// if (record2) -// P.info += text("
\n
Security Data

\nIncidents: [record2.fields["incident"]]
\n
\n
Comments/Log

") -// if(islist(record2.fields["comments"]) || length(record2.fields["comments"]) > 0) -// for(var/com_i in record2.fields["comments"]) -// var/comment = record2.fields["comments"][com_i] -// var/comment_markup = text("[] / [] ([])
", comment["created_at"], comment["created_by"]["name"], comment["created_by"]["rank"]) -// if (isnull(comment["deleted_by"])) -// comment_markup += comment["entry"] -// else -// comment_markup += text("Comment deleted by [] at []", comment["deleted_by"], comment["deleted_at"]) -// P.info += "[comment_markup]

" -// else -// P.info += text("No comments
") -// else -// P.info += "Security Record Lost!
" -// P.info += "" -// printing = null -// updateUsrDialog() - -// if ("Add Entry") -// if (!(istype(active2, /datum/data/record))) -// return -// var/a2 = active2 -// var/t1 = copytext(trim(strip_html(input("Your name and time will be added to this new comment.", "Add a comment", null, null) as message)),1,MAX_MESSAGE_LEN) -// if((!t1 || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isSilicon(usr))) || active2 != a2)) -// return -// var/created_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) -// var/new_comment = list("entry" = t1, "created_by" = list("name" = "", "rank" = ""), "deleted_by" = null, "deleted_at" = null, "created_at" = created_at) -// if(istype(usr,/mob/living/carbon/human)) -// var/mob/living/carbon/human/U = usr -// new_comment["created_by"] = list("name" = U.get_authentification_name(), "rank" = U.get_assignment()) -// if(!islist(active2.fields["comments"])) -// active2.fields["comments"] = list("1" = new_comment) -// else -// var/new_com_i = length(active2.fields["comments"]) + 1 -// active2.fields["comments"]["[new_com_i]"] = new_comment -// to_chat(usr, text("You have added a new comment to the Security Record of [].", active2.fields["name"])) - -// if ("Delete Entry") -// if(!islist(active2.fields["comments"])) -// return -// if(active2.fields["comments"][href_list["del_c"]]) -// var/updated_comments = active2.fields["comments"] -// var/deleter = "" -// if(istype(usr,/mob/living/carbon/human)) -// var/mob/living/carbon/human/U = usr -// deleter = "[U.get_authentification_name()] ([U.get_assignment()])" -// updated_comments[href_list["del_c"]]["deleted_by"] = deleter -// updated_comments[href_list["del_c"]]["deleted_at"] = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) -// active2.fields["comments"] = updated_comments -// to_chat(usr, text("You have deleted a comment from the Security Record of [].", active2.fields["name"])) - -// //FIELD FUNCTIONS -// if ("Edit Field") -// if (is_not_allowed(usr)) -// return -// var/a1 = active1 -// switch(href_list["field"]) -// if("name") -// if (istype(active1, /datum/data/record)) -// var/t1 = reject_bad_name(input(usr, "Please input name:", "Secure. records", active1.fields["name"]) as text|null) -// if (!t1 || active1 != a1) -// return -// message_admins("[key_name(usr)] has changed the record name of [active1.fields["name"]] to [t1]") -// active1.fields["name"] = t1 -// if("sex") -// if (istype(active1, /datum/data/record)) -// if (active1.fields["sex"] == "Male") -// active1.fields["sex"] = "Female" -// else -// active1.fields["sex"] = "Male" -// if("age") -// if (istype(active1, /datum/data/record)) -// var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num -// if (!t1 || active1 != a1) -// return -// active1.fields["age"] = t1 -// if("criminal") -// if (istype(active2, /datum/data/record)) -// temp = "
Criminal Status:
" -// temp += "" -// if("rank") -// //This was so silly before the change. Now it actually works without beating your head against the keyboard. /N -// if (istype(active1, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) -// temp = "
Occupation:
" -// temp += "
    " -// for(var/rank in GLOB.joblist) -// temp += "
  • [rank]
  • " -// temp += "
" -// else -// alert(usr, "You do not have the required rank to do this!") -// if("species") -// if (istype(active1, /datum/data/record)) -// var/t1 = copytext(trim(strip_html(input("Please enter race:", "General records", active1.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) -// if (!t1 || active1 != a1) -// return -// active1.fields["species"] = t1 - - -// //TEMPORARY MENU FUNCTIONS -// else//To properly clear as per clear screen. -// temp=null -// switch(href_list["choice"]) -// if ("Change Rank") -// if (active1) -// active1.fields["rank"] = href_list["rank"] -// if(href_list["rank"] in GLOB.joblist) -// active1.fields["real_rank"] = href_list["real_rank"] - -// if ("Change Criminal Status") -// if (active2) -// switch(href_list["criminal2"]) -// if("none") -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_NONE -// if("arrest") -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_ARREST -// if("incarcerated") -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_INCARCERATED -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_RELEASED -// if("suspect") -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_SUSPECT -// if("njp") -// active2.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_NJP - -// for(var/mob/living/carbon/human/H in GLOB.human_mob_list) -// H.sec_hud_set_security_status() - -// add_fingerprint(usr) -// updateUsrDialog() -// return - /obj/structure/machinery/computer/secure_data/proc/generate_fingerprint_menu() var/dat = "" @@ -621,11 +194,11 @@ if(3) R.fields[MOB_AGE] = rand(5, 85) if(4) - R.fields[MOB_CRIMINAL_STATUS] = pick(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARCERATED) + R.fields[MOB_CRIMINAL_STATUS] = pick(MOB_STAT_CRIME_STATUS_LIST) if(5) - R.fields[MOB_HEALTH_STATUS] = pick(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_ACTIVE, MOB_STAT_HEALTH_UNFIT) + R.fields[MOB_HEALTH_STATUS] = pick(MOB_STAT_HEALTH_LIST) if(6) - R.fields[MOB_MENTAL_STATUS] = pick(MOB_STAT_MENTAL_STATUS_UNSTABLE, MOB_STAT_MENTAL_STATUS_ON_WATCH, MOB_STAT_MENTAL_STATUS_STABLE) + R.fields[MOB_MENTAL_STATUS] = pick(MOB_STAT_MENTAL_STATUS_LIST) continue /obj/structure/machinery/computer/secure_data/detective_computer @@ -677,20 +250,26 @@ else user_id_card.forceMove(loc) user_id_card = null + target_mob = null return TRUE if("selectTarget") var/name = params["new_user"] if(name == target_mob) + target_mob = null // deselected the mob in tgui. return target_mob = name - retrieve_target_record(name) + if(!retrieve_target_record(name)) + target_mob = null + return + return TRUE if("updateStatRecord") - insert_record_stat(mob_name = target_mob, record_type = RECORD_TYPE_SECURITY, stat_type = params["stat"], new_stat = params["new_value"]) - retrieve_target_record(target_mob) // let's update after we change any information. + if(!insert_record_stat(mob_name = target_mob, record_type = RECORD_TYPE_SECURITY, stat_type = params["stat"], new_stat = params["new_value"])) + visible_message("[SPAN_BOLD("[src]")] states, \"DATACORE FAILURE: Unable to update relevant database logs.\"") + return + retrieve_target_record(target_mob) return TRUE - /obj/structure/machinery/computer/secure_data/ui_static_data(mob/user) var/list/data = list() data["mob_names"] = human_mob_names @@ -700,10 +279,11 @@ var/list/data = list() data["human_mob_list"] = GLOB.human_mob_list - data["selected_target_name"] = target_mob ? target_mob : "None"// is there a selected target. - data["security_record"] = target_security_record + data["selected_target_name"] = target_mob ? target_mob : FALSE + data["crime_stat"] = crime_stat + data["incident"] = incident + data["notes"] = notes data["general_record"] = target_general_record - data["has_id"] = !!user_id_card data["id_name"] = user_id_card ? user_id_card?.name : "-----" data["authenticated"] = authenticated diff --git a/code/game/machinery/computer/sentencing.dm b/code/game/machinery/computer/sentencing.dm index 3aa9b5a032a8..478cd3a7f7b8 100644 --- a/code/game/machinery/computer/sentencing.dm +++ b/code/game/machinery/computer/sentencing.dm @@ -198,15 +198,9 @@ // Update criminal record. if (incident.criminal_gid) - for (var/datum/data/record/R in GLOB.data_core.security) - if (R.fields["id"] == incident.criminal_gid) - var/datum/data/record/found_record = R + var/datum/data/record/target_sec_record = retrieve_record(mob_name = incident.criminal_name, record_type = RECORD_TYPE_SECURITY) + target_sec_record.fields[MOB_INCIDENTS] += "Crime: [incident.charges_to_string()] Notes: [incident.notes] " - found_record.fields["incident"] += "
\ - Crime: [incident.charges_to_string()].
\ - Notes: [incident.notes].
" - - break var/obj/item/paper/incident/paper = new /obj/item/paper/incident(loc) paper.incident = incident diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 1793b87c72ae..e78e0cf4266e 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -353,20 +353,11 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li //Handle job slot/tater cleanup. GLOB.RoleAuthority.free_role(GET_MAPPED_ROLE(occupant.job), TRUE) - var/occupant_ref = WEAKREF(occupant) - //Delete them from datacore. - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if((R.fields["ref"] == occupant_ref)) - GLOB.data_core.medical -= R - qdel(R) - for(var/datum/data/record/T in GLOB.data_core.security) - if((T.fields["ref"] == occupant_ref)) - GLOB.data_core.security -= T - qdel(T) - for(var/datum/data/record/G in GLOB.data_core.general) - if((G.fields["ref"] == occupant_ref)) - GLOB.data_core.general -= G - qdel(G) + var/mob/living/carbon/human/cryo_pod = occupant + if(cryo_pod.record_id_ref) + qdel(GLOB.data_core.medical[cryo_pod.record_id_ref]) + qdel(GLOB.data_core.general[cryo_pod.record_id_ref]) + qdel(GLOB.data_core.security[cryo_pod.record_id_ref]) icon_state = "body_scanner_open" set_light(0) diff --git a/code/game/machinery/medical_pod/autodoc.dm b/code/game/machinery/medical_pod/autodoc.dm index 610ca5512273..ee617bc4b97b 100644 --- a/code/game/machinery/medical_pod/autodoc.dm +++ b/code/game/machinery/medical_pod/autodoc.dm @@ -273,7 +273,7 @@ surgery_list += create_autodoc_surgery(null,EXTERNAL_SURGERY,"blood") return surgery_list -/obj/structure/machinery/medical_pod/autodoc/proc/surgery_op(mob/living/carbon/M) +/obj/structure/machinery/medical_pod/autodoc/proc/surgery_op(mob/living/carbon/human/M) set background = 1 if(M.stat == DEAD||!ishuman(M)) @@ -284,9 +284,8 @@ var/mob/living/carbon/human/H = M var/datum/data/record/N = null var/human_ref = WEAKREF(H) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == human_ref) - N = R + //fix + N = retrieve_record(record_id_ref = H.record_id_ref, mob_ref = human_ref, record_type = RECORD_TYPE_MEDICAL) if(isnull(N)) visible_message("\The [src] buzzes: No records found for occupant.") src.go_out() //kick them out too. @@ -666,14 +665,12 @@ var/list/surgeryqueue = list() var/datum/data/record/N = null var/occupant_ref = WEAKREF(connected.occupant) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == occupant_ref) - N = R - // if(isnull(N)) + N = retrieve_record(record_id_ref = connected.occupant.record_id_ref, mob_ref = occupant_ref, record_type = RECORD_TYPE_MEDICAL) + if(isnull(N)) N = create_medical_record(connected.occupant) - if(!isnull(N.fields["autodoc_manual"])) - for(var/datum/autodoc_surgery/A in N.fields["autodoc_manual"]) + if(!isnull(N.fields[MOB_AUTODOC_MANUAL])) + for(var/datum/autodoc_surgery/A in N.fields[MOB_AUTODOC_MANUAL]) switch(A.type_of_surgery) if(EXTERNAL_SURGERY) switch(A.surgery_procedure) @@ -759,30 +756,28 @@ // manual surgery handling var/datum/data/record/N = null var/occupant_ref = WEAKREF(connected.occupant) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == occupant_ref) - N = R + N = retrieve_record(record_id_ref = connected.occupant.record_id_ref, mob_ref = occupant_ref, record_type = RECORD_TYPE_MEDICAL) if(isnull(N)) N = create_medical_record(connected.occupant) var/needed = 0 // this is to stop someone just choosing everything if(href_list["brute"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"brute") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"brute") updateUsrDialog() if(href_list["burn"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"burn") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"burn") updateUsrDialog() if(href_list["toxin"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"toxin") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"toxin") updateUsrDialog() if(href_list["dialysis"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"dialysis") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"dialysis") updateUsrDialog() if(href_list["blood"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"blood") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,EXTERNAL_SURGERY,"blood") updateUsrDialog() if(href_list["eyes"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,ORGAN_SURGERY,"eyes",0,connected.occupant.internal_organs_by_name["eyes"]) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,ORGAN_SURGERY,"eyes",0,connected.occupant.internal_organs_by_name["eyes"]) updateUsrDialog() if(href_list["organdamage"]) for(var/obj/limb/L in connected.occupant.limbs) @@ -792,10 +787,10 @@ // we can't deal with these continue if(I.damage > 0) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,ORGAN_SURGERY,"damage",0,I) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,ORGAN_SURGERY,"damage",0,I) needed++ if(!needed) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,ORGAN_SURGERY,"damage",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,ORGAN_SURGERY,"damage",1) updateUsrDialog() if(href_list["internal"]) @@ -803,21 +798,21 @@ if(L) for(var/datum/wound/W in L.wounds) if(W.internal) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"internal") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"internal") needed++ break if(!needed) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,LIMB_SURGERY,"internal",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,LIMB_SURGERY,"internal",1) updateUsrDialog() if(href_list["broken"]) for(var/obj/limb/L in connected.occupant.limbs) if(L) if(L.status & LIMB_BROKEN) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"broken") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"broken") needed++ if(!needed) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,LIMB_SURGERY,"broken",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,LIMB_SURGERY,"broken",1) updateUsrDialog() if(href_list["missing"]) @@ -825,10 +820,10 @@ if(L) if(L.status & LIMB_DESTROYED) if(!(L.parent.status & LIMB_DESTROYED) && L.name != "head") - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"missing") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"missing") needed++ if(!needed) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,LIMB_SURGERY,"missing",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,LIMB_SURGERY,"missing",1) updateUsrDialog() if(href_list["shrapnel"]) @@ -838,10 +833,10 @@ if(L.implants.len) for(var/I in L.implants) if(!is_type_in_list(I,known_implants)) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"shrapnel") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"shrapnel") needed++ if(!needed) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,LIMB_SURGERY,"shrapnel",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,LIMB_SURGERY,"shrapnel",1) updateUsrDialog() if(href_list["facial"]) @@ -850,9 +845,9 @@ if(istype(L,/obj/limb/head)) var/obj/limb/head/J = L if(J.disfigured) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"facial") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"facial") else - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"facial",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"facial",1) updateUsrDialog() break @@ -860,15 +855,15 @@ for(var/obj/limb/L in connected.occupant.limbs) if(L) if(connected.occupant.incision_depths[L.name] != SURGERY_DEPTH_SURFACE) - N.fields["autodoc_manual"] += create_autodoc_surgery(L,LIMB_SURGERY,"open") + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(L,LIMB_SURGERY,"open") needed++ if(href_list["open"]) - N.fields["autodoc_manual"] += create_autodoc_surgery(null,LIMB_SURGERY,"open",1) + N.fields[MOB_AUTODOC_MANUAL] += create_autodoc_surgery(null,LIMB_SURGERY,"open",1) updateUsrDialog() // The rest if(href_list["clear"]) - N.fields["autodoc_manual"] = list() + N.fields[MOB_AUTODOC_MANUAL] = list() updateUsrDialog() if(href_list["refresh"]) updateUsrDialog() diff --git a/code/game/machinery/medical_pod/bodyscanner.dm b/code/game/machinery/medical_pod/bodyscanner.dm index 732ff1ba97b9..61d1071f4946 100644 --- a/code/game/machinery/medical_pod/bodyscanner.dm +++ b/code/game/machinery/medical_pod/bodyscanner.dm @@ -160,21 +160,20 @@ var/mob/living/carbon/human/H = connected.occupant var/datum/data/record/N = null var/human_ref = WEAKREF(H) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == human_ref) - N = R + //fix + N = retrieve_record(record_id_ref = H.record_id_ref, mob_ref = human_ref, record_type = RECORD_TYPE_MEDICAL) if(isnull(N)) N = create_medical_record(H) var/list/od = connected.get_occupant_data() var/dat dat = format_occupant_data(od) - N.fields["last_scan_time"] = od["stationtime"] + N.fields[MOB_LAST_SCAN_TIME] = od["stationtime"] // I am sure you are wondering why this is still here. And indeed why the rest of the autodoc html shit is here. // The answer is : it is used in the medical records computer to print out the results of their last scan data // Do I want to make it so that data from a tgui static data proc can go into a piece of paper? no // Do I want to remove the feature from medical records computers? no // and so here we are. - N.fields["last_scan_result"] = dat + N.fields[MOB_LAST_SCAN_RESULT] = dat if (!last_health_display) last_health_display = new(H) @@ -182,7 +181,7 @@ last_health_display.target_mob = H N.fields["last_tgui_scan_result"] = last_health_display.ui_data(user, DETAIL_LEVEL_BODYSCAN) - N.fields["autodoc_data"] = generate_autodoc_surgery_list(H) + N.fields[MOB_AUTODOC_DATA] = generate_autodoc_surgery_list(H) visible_message(SPAN_NOTICE("\The [src] pings as it stores the scan report of [H.real_name]")) playsound(src.loc, 'sound/machines/screen_output1.ogg', 25) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 3b84d2433e88..49bf4156c6d6 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -308,13 +308,11 @@ if(ishuman(stasis_mob) && hasHUD(user,"medical")) var/mob/living/carbon/human/H = stasis_mob var/stasis_ref = WEAKREF(H) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == stasis_ref) - if(!(R.fields["last_scan_time"])) - . += "No scan report on record\n" - else - . += "Scan from [R.fields["last_scan_time"]]\n" - break + var/datum/data/record/medical_record = retrieve_record(record_id_ref = H.record_id_ref, mob_ref = stasis_ref, record_type = RECORD_TYPE_MEDICAL) + if(!medical_record.fields[MOB_LAST_SCAN_TIME]) + . += "No scan report on record\n" + else + . += "Scan from [medical_record.fields[MOB_LAST_SCAN_TIME]]\n" @@ -338,6 +336,7 @@ if(ishuman(stasis_mob)) var/mob/living/carbon/human/H = stasis_mob var/stasis_ref = WEAKREF(H) + //fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if (R.fields["ref"] == stasis_ref) if(R.fields["last_scan_time"] && R.fields["last_tgui_scan_result"]) @@ -356,6 +355,7 @@ if(ishuman(stasis_mob)) var/mob/living/carbon/human/H = stasis_mob var/stasis_ref = WEAKREF(H) + //fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["ref"] == stasis_ref) if(R.fields["last_tgui_scan_result"]) diff --git a/code/modules/admin/player_panel/actions/physical.dm b/code/modules/admin/player_panel/actions/physical.dm index 21e6fed4f825..c2b32f2edef8 100644 --- a/code/modules/admin/player_panel/actions/physical.dm +++ b/code/modules/admin/player_panel/actions/physical.dm @@ -102,20 +102,14 @@ //Handle job slot/tater cleanup. GLOB.RoleAuthority.free_role(GLOB.RoleAuthority.roles_for_mode[target.job], TRUE) - //Delete them from datacore. - var/target_ref = WEAKREF(target) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if((R.fields["ref"] == target_ref)) - GLOB.data_core.medical -= R - qdel(R) - for(var/datum/data/record/T in GLOB.data_core.security) - if((T.fields["ref"] == target_ref)) - GLOB.data_core.security -= T - qdel(T) - for(var/datum/data/record/G in GLOB.data_core.general) - if((G.fields["ref"] == target_ref)) - GLOB.data_core.general -= G - qdel(G) + var/mob/living/carbon/human/mob_cryo = null + if(ishuman(target)) + mob_cryo = target + + if(mob_cryo) + qdel(GLOB.data_core.general[mob_cryo.record_id_ref]) + qdel(GLOB.data_core.medical[mob_cryo.record_id_ref]) + qdel(GLOB.data_core.security[mob_cryo.record_id_ref]) if(target.key) target.ghostize(FALSE) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 4b669934d1c1..dd06d336f95d 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -2021,11 +2021,10 @@ GLOBAL_LIST_INIT(bgstate_options, list( if(job_title) find_assigned_slot(job_title, is_late_join) if(check_datacore && !(be_random_body && be_random_name)) - for(var/datum/data/record/record as anything in GLOB.data_core.locked) - if(record.fields["name"] == real_name) - be_random_body = TRUE - be_random_name = TRUE - break + var/datum/data/record/old_record = retrieve_record(record_id_ref = character.record_id_ref, record_type = RECORD_TYPE_STATIC) + if(old_record.fields[MOB_NAME] == real_name) + be_random_body = TRUE + be_random_name = TRUE if(be_random_name) real_name = random_name(gender) diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 500d575c053f..b5203dc6194d 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -229,10 +229,8 @@ fteam = " [marine_human.assigned_fireteam]" else //listed marine was deleted or gibbed, all we have is their name - for(var/datum/data/record/marine_record as anything in GLOB.data_core.general) - if(marine_record.fields["name"] == marine) - role = marine_record.fields["real_rank"] - break + var/datum/data/record/marine_record = retrieve_record(mob_name = marine, record_type = RECORD_TYPE_GENERAL) + role = marine_record[MOB_REAL_RANK] mob_state = "Dead" mob_name = marine @@ -661,25 +659,19 @@ return var/marine_ref = WEAKREF(wanted_marine) - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == marine_ref) - for(var/datum/data/record/R in GLOB.data_core.security) - if(R.fields["id"] == E.fields["id"]) - if(!findtext(R.fields["ma_crim"],"Insubordination.")) - R.fields["criminal"] = "*Arrest*" - if(R.fields["ma_crim"] == "None") - R.fields["ma_crim"] = "Insubordination." - else - R.fields["ma_crim"] += "Insubordination." - - var/insub = "[icon2html(src, usr)] [SPAN_BOLDNOTICE("[wanted_marine] has been reported for insubordination. Logging to enlistment file.")]" - if(isRemoteControlling(usr)) - usr << insub - else - visible_message(insub) - to_chat(wanted_marine, "[icon2html(src, wanted_marine)] Overwatch: You've been reported for insubordination by your overwatch officer.") - wanted_marine.sec_hud_set_security_status() - return + var/marked_insub = insert_record_stat(record_id_ref = wanted_marine.record_id_ref,mob_ref = marine_ref, record_type = RECORD_TYPE_SECURITY, stat_type = MOB_CRIMINAL_STATUS, new_stat = MOB_STAT_CRIME_ARREST) + if(!marked_insub) + visible_message("Unable to mark [wanted_marine] for insubordiantion at this time, please contact QM at your earliest availability") // records fucked + return + + var/insub = "[icon2html(src, usr)] [SPAN_BOLDNOTICE("[wanted_marine] has been reported for insubordination. Logging to enlistment file.")]" + if(isRemoteControlling(usr)) + usr << insub + else + visible_message(insub) + to_chat(wanted_marine, "[icon2html(src, wanted_marine)] Overwatch: You've been reported for insubordination by your overwatch officer.") + wanted_marine.sec_hud_set_security_status() + return /obj/structure/machinery/computer/overwatch/proc/transfer_squad() if(!usr) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index dcbab12c7291..55d385192cdc 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -455,11 +455,9 @@ if(perpref) var/criminal = "None" - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == perpref) - for (var/datum/data/record/R in GLOB.data_core.security) - if(R.fields["id"] == E.fields["id"]) - criminal = R.fields["criminal"] + //fix + var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) + criminal = security_record.fields[MOB_CRIMINAL_STATUS] msg += "Criminal status:" if(!observer) @@ -468,10 +466,7 @@ msg += "\[[criminal]\]\n" msg += "Security records: \[View\]" - if(!observer) - msg += " \[Add comment\]\n" - else - msg += "\n" + msg += "\n" if(hasHUD(user,"medical")) var/cardcolor = holo_card_color if(!cardcolor) cardcolor = "none" @@ -480,15 +475,13 @@ // scan reports var/datum/data/record/N = null var/me_ref = WEAKREF(src) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if (R.fields["ref"] == me_ref) - N = R - break + //fix + N = retrieve_record(mob_ref = me_ref, record_type = RECORD_TYPE_MEDICAL) if(!isnull(N)) - if(!(N.fields["last_scan_time"])) + if(!(N.fields[MOB_LAST_SCAN_TIME])) msg += "No scan report on record\n" else - msg += "Scan from [N.fields["last_scan_time"]]\n" + msg += "Scan from [N.fields[MOB_LAST_SCAN_TIME]]\n" if(hasHUD(user,"squadleader")) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 74d396cd897a..16c21461c81d 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -506,18 +506,14 @@ perpref = I.registered_ref if(perpref) - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == perpref) - for(var/datum/data/record/R in GLOB.data_core.security) - if(R.fields["id"] == E.fields["id"]) - - var/setcriminal = tgui_input_list(usr, "Specify a new criminal status for this person.", "Security HUD", list("None", "*Arrest*", "Incarcerated", "Released", "Suspect", "NJP", "Cancel")) - - if(hasHUD(usr, "security")) - if(setcriminal != "Cancel") - R.fields["criminal"] = setcriminal - modified = 1 - sec_hud_set_security_status() + var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) + var/setcriminal = tgui_input_list(usr, "Specify a new criminal status for this person.", "Security HUD", list(MOB_STAT_CRIME_NONE, MOB_STAT_CRIME_ARREST, MOB_STAT_CRIME_INCARCERATED, "Cancel")) + if(setcriminal == "Cancel") + return + if(hasHUD(usr, "security")) + security_record.fields[MOB_CRIMINAL_STATUS] = setcriminal + modified = TRUE + sec_hud_set_security_status() if(!modified) @@ -532,19 +528,17 @@ var/obj/item/card/id/ID = wear_id.GetID() if(istype(ID)) perpref = ID.registered_ref - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == perpref) - for(var/datum/data/record/R in GLOB.data_core.security) - if(R.fields["id"] == E.fields["id"]) - if(hasHUD(usr,"security") || isobserver(usr)) - to_chat(usr, "Name: [R.fields["name"]] Criminal Status: [R.fields["criminal"]]") - to_chat(usr, "Incidents: [R.fields["incident"]]") - to_chat(usr, "\[View Comment Log\]") - read = 1 + var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) + if(hasHUD(usr,"security") || isobserver(usr)) + to_chat(usr, "Name: [security_record.fields[MOB_NAME]] Criminal Status: [security_record.fields[MOB_CRIMINAL_STATUS]]") + to_chat(usr, "Incidents: [security_record.fields[MOB_INCIDENTS]]") + // to_chat(usr, "\[View Comment Log\]") + read = TRUE if(!read) to_chat(usr, SPAN_DANGER("Unable to locate a data core entry for this person.")) + /* removed for the time being. if(href_list["secrecordComment"] && (hasHUD(usr,"security") || isobserver(usr))) var/perpref = null if(wear_id) @@ -555,6 +549,7 @@ var/read = 0 if(perpref) + //fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] != perpref) continue @@ -576,9 +571,11 @@ to_chat(usr, comment_markup) if(!isobserver(usr)) to_chat(usr, "\[Add comment\]
") - if(!read) to_chat(usr, SPAN_DANGER("Unable to locate a data core entry for this person.")) + */ + + if(href_list["secrecordadd"] && hasHUD(usr,"security")) var/perpref = null @@ -588,6 +585,7 @@ perpref = ID.registered_ref if(perpref) + //fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] != perpref) continue @@ -621,26 +619,23 @@ var/modified = FALSE if(perpref) - for(var/datum/data/record/E in GLOB.data_core.general) - if(E.fields["ref"] == perpref) - for(var/datum/data/record/R in GLOB.data_core.general) - if(R.fields["id"] == E.fields["id"]) - - var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", R.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) - - if(hasHUD(usr,"medical")) - if(setmedical != "Cancel") - R.fields["p_stat"] = setmedical - modified = 1 - - spawn() - if(istype(usr,/mob/living/carbon/human)) - var/mob/living/carbon/human/U = usr - U.handle_regular_hud_updates() + // fix - fml. + var/datum/data/record/health_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_GENERAL) + var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", health_record.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) + + if(hasHUD(usr,"medical")) + if(setmedical != "Cancel") + health_record.fields[MOB_HEALTH_STATUS] = setmedical + modified = TRUE + spawn() + if(istype(usr,/mob/living/carbon/human)) + var/mob/living/carbon/human/U = usr + U.handle_regular_hud_updates() if(!modified) to_chat(usr, SPAN_DANGER("Unable to locate a data core entry for this person.")) +/* removed for now, will be modified in the future. if(href_list["medrecord"]) if(hasHUD(usr,"medical")) var/perpref = null @@ -652,6 +647,7 @@ var/read = FALSE if(perpref) + // fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) @@ -680,6 +676,7 @@ var/read = FALSE if(perpref) + // fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) @@ -707,6 +704,7 @@ if(perpref) for(var/datum/data/record/E in GLOB.data_core.general) + //fix if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["id"] == E.fields["id"]) @@ -720,6 +718,7 @@ if(istype(usr,/mob/living/carbon/human)) var/mob/living/carbon/human/U = usr R.fields[text("com_[counter]")] = text("Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]
[t1]") + */ if(href_list["medholocard"]) change_holo_card(usr) @@ -766,11 +765,10 @@ return var/me_ref = WEAKREF(src) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if(R.fields["ref"] == me_ref) - if(R.fields["last_scan_time"] && R.fields["last_scan_result"]) - tgui_interact(usr) - break + + var/datum/data/record/medical_record = retrieve_record(mob_ref = me_ref, record_type = RECORD_TYPE_MEDICAL) + if(medical_record.fields[MOB_LAST_SCAN_TIME] && medical_record.fields[MOB_LAST_SCAN_RESULT]) + tgui_interact(usr) ..() return @@ -817,6 +815,7 @@ /mob/living/carbon/human/ui_data(mob/user) var/me_ref = WEAKREF(src) + // fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["ref"] == me_ref) if(R.fields["last_tgui_scan_result"]) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 119c846a93a2..3f2e52d45270 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -104,10 +104,13 @@ /obj/structure/filingcabinet/security/proc/populate() if(virgin) - for(var/datum/data/record/G in GLOB.data_core.general) + // fix + for(var/record_name in GLOB.data_core.general) + var/datum/data/record/G = GLOB.data_core.general[record_name] // yeah I know single letter vars, but like plz. var/datum/data/record/S - for(var/datum/data/record/R in GLOB.data_core.security) - if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) + for(var/record_id in GLOB.data_core.security) + var/datum/data/record/R = GLOB.data_core.security[record_id] + if((R.fields["name"] == G.fields["name"])) S = R break if(S) @@ -136,17 +139,18 @@ /obj/structure/filingcabinet/medical/proc/populate() if(virgin) - for(var/datum/data/record/G in GLOB.data_core.general) + for(var/record in GLOB.data_core.general) + var/datum/data/record/G = GLOB.data_core.general[record] var/datum/data/record/M - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])) + for(var/record_name as anything in GLOB.data_core.medical) + var/datum/data/record/R = GLOB.data_core.medical[record_name] + if((R.fields[MOB_NAME] == G.fields[MOB_NAME])) M = R break if(M) var/obj/item/paper/P = new /obj/item/paper(src) P.info = "
Medical Record

" - P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" - + P.info += "Name: [G.fields[MOB_NAME]] ID: [G.fields["id"]]
\nSex: [G.fields["sex"]]
\nAge: [G.fields["age"]]
\nPhysical Status: [G.fields["p_stat"]]
\nMental Status: [G.fields["m_stat"]]
" P.info += "
\n
Medical Data

\nBlood Type: [M.fields["b_type"]]
\n
\nMinor Disabilities: [M.fields["mi_dis"]]
\nDetails: [M.fields["mi_dis_d"]]
\n
\nMajor Disabilities: [M.fields["ma_dis"]]
\nDetails: [M.fields["ma_dis_d"]]
\n
\nAllergies: [M.fields["alg"]]
\nDetails: [M.fields["alg_d"]]
\n
\nCurrent Diseases: [M.fields["cdi"]] (per disease info placed in log/comment section)
\nDetails: [M.fields["cdi_d"]]
\n
\nImportant Notes:
\n\t[M.fields["notes"]]
\n
\n
Comments/Log

" var/counter = 1 while(M.fields["com_[counter]"]) diff --git a/tgui/packages/tgui/interfaces/MedRec.jsx b/tgui/packages/tgui/interfaces/MedRec.jsx index 2a6cba76fbb1..4d1833bec941 100644 --- a/tgui/packages/tgui/interfaces/MedRec.jsx +++ b/tgui/packages/tgui/interfaces/MedRec.jsx @@ -1,47 +1,43 @@ -import { Fragment } from 'react'; -import { useBackend, useLocalState } from '../backend'; +import { Fragment, useState } from 'react'; +import { useBackend } from '../backend'; import { Box, Button, Stack, Input, Dropdown, Section, Tabs, Flex, Icon } from '../components'; import { Window } from '../layouts'; export const MedRec = (props) => { - const [tab2, setTab2] = useLocalState('tab2', 1); + const [selectedTab, setSelectedTab] = useState(1); return ( - setTab2(1)}> + setSelectedTab(1)}> Health Status - setTab2(2)}> + setSelectedTab(2)}> Medical Record - {tab2 === 1 && } - {tab2 === 2 && } + {selectedTab === 1 && } + {selectedTab === 2 && } ); }; + export const MedicalRecord = (props) => { const { act, data } = useBackend(); - const [tab, setTab] = useLocalState('tab', 1); - const { - authenticated, - has_id, - id_name, - medical_record, - health, - autopsy, - existingReport, - death, - } = data; + const [selectedTab, setSelectedTab] = useState(1); + const { authenticated, has_id } = data; return ( <>
act('print')} /> } @@ -49,129 +45,144 @@ export const MedicalRecord = (props) => { {!!has_id && !!authenticated && ( - setTab(1)}> + setSelectedTab(1)}> Medical Notes - setTab(2)}> + setSelectedTab(2)}> Autopsy Report - {tab === 1 && ( -
- - {medical_record.map((record, index) => ( - - {record.message} - - - act('updateStatRecord', { - stat_type: record.stat_type, - stat: record.stat, - new_value: value, - }) - } - /> - - - ))} - -
- )} - {tab === 2 && ( -
- - {health.value === 'Deceased' && !existingReport && ( + {selectedTab === 1 && } + {selectedTab === 2 && } + + )} + + ); +}; + +const MedicalNotes = (props) => { + const { act, data } = useBackend(); + const { medical_record } = data; + + return ( +
+ {medical_record.map((record, index) => ( + + + {record.message} + + + act('updateStatRecord', { + stat_type: record.stat_type, + stat: record.stat, + new_value: value, + }) + } + /> + + + + ))} +
+ ); +}; + +const AutopsyReport = (props) => { + const { act, data } = useBackend(); + const { health, autopsy, existingReport, death, id_name } = data; + + return ( +
+ + {health.value === 'Deceased' && !existingReport && ( + + + {autopsy.message} + + + act('updateStatRecord', { + stat_type: autopsy.stat_type, + stat: autopsy.stat, + new_value: value, + }) + } + /> + + + - - {autopsy.message} + + {death.message} - + act('updateStatRecord', { - stat_type: autopsy.stat_type, - stat: autopsy.stat, + stat_type: death.stat_type, + stat: death.stat, new_value: value, }) } + displayText={death.value ? death.value : 'NONE'} /> - - - - - {death.message} - - - act('updateStatRecord', { - stat_type: death.stat_type, - stat: death.stat, - new_value: value, - }) - } - displayText={ - death.value ? death.value : 'NONE' - } - /> - - - - -
- )} - - )} - + +
); }; -// HealthStatus component export const HealthStatus = (props) => { const { act, data } = useBackend(); const { authenticated, has_id, id_name, general_record, health } = data; @@ -236,7 +247,8 @@ export const HealthStatus = (props) => { ); }; -// ----- const-------- // + +// Constants const healthStatusOptions = ['Unfit', 'Deceased', 'Active']; const deathOptions = [ @@ -254,5 +266,3 @@ const colors = { 'Active': 'blue', 'Unfit': 'yellow', }; - -// ----- const -------- // diff --git a/tgui/packages/tgui/interfaces/SecRec.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx index bb0f8f4a52cd..c2c8df1e514e 100644 --- a/tgui/packages/tgui/interfaces/SecRec.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -1,214 +1,138 @@ -import { Fragment } from 'react'; -import { useBackend, useLocalState } from '../backend'; -import { Box, Button, Section, Tabs, Flex, Icon, Stack, Dropdown } from '../components'; +import React, { useState } from 'react'; +import { useBackend } from '../backend'; +import { Box, Button, Section, Tabs, Flex, Icon, Stack, Dropdown, Input } from '../components'; import { Window } from '../layouts'; -// just trying to get this to work, i'll fix it up later and implement your suggested changes paul. - export const SecRec = (props) => { - const [tab2, setTab2] = useLocalState('tab2', 1); + const { act, data } = useBackend(); + const { authenticated, selected_target_name } = data; + const [selectedTab, setSelectedTab] = useState(1); + const [searchQuery, setSearchQuery] = useState(''); + return ( - setTab2(1)}> + setSelectedTab(1)}> Crew Manifest - setTab2(2)}> - Criminal Status - - setTab2(2)}> - Criminal History - + {!!authenticated && !!selected_target_name && ( + <> + setSelectedTab(2)}> + Criminal Status + + setSelectedTab(3)}> + Criminal History + + + )} - {tab2 === 1 && } - {tab2 === 2 && } - {/* {tab2 === 3 && } */} + {selectedTab === 1 && ( + + )} + {selectedTab === 2 && !!authenticated && !!selected_target_name && ( + + )} + {selectedTab === 3 && !!authenticated && !!selected_target_name && ( + + )} ); }; - -// export const CrimeHist = (props) => { -// const { act, data } = useBackend(); -// const [tab, setTab] = useLocalState('tab', 1); -// const { authenticated, has_id, id_name, security_record, selected_target } = -// data; -// return ( -// <> -//
act('print')} /> -// } -// /> -// {!!has_id && !!authenticated && ( -// -// -// setTab(1)}> -// Medical Notes -// -// setTab(2)}> -// Autopsy Report -// -// -// {tab === 1 && ( -//
-// -// {medical_record.map((record, index) => ( -// -// {record[3]} -// -// -// act('updateStatRecord', { -// stat_type: record[0], -// stat: record[1], -// new_value: value, -// }) -// } -// /> -// -// -// ))} -// -//
-// )} -// {tab === 2 && ( // should I have used a table instead of stack hell? Probably. -//
-// -// {health[2] == 'Deceased' && !existingReport && ( -// -// -// {autopsy[3]} -// -// -// act('updateStatRecord', { -// stat_type: autopsy[0], -// stat: autopsy[1], -// new_value: value, -// }) -// } -// /> -// -// -// -// -// -// {death[3]} -// -// -// act('updateStatRecord', { -// stat_type: death[0], -// stat: death[1], -// new_value: value, -// }) -// } -// displayText={death[2] ? death[2] : 'NONE'} -// /> -// -// -// -// -//
-// )} -//
-// )} -// -// ); -// }; - -// TODO - IMPLEMENT SEARCH BAR. -export const CrewManifest = (props) => { +export const CrimeHist = (props) => { const { act, data } = useBackend(); - const { human_mob_list } = data; + const [selectedTab, setSelectedTab] = useState(1); + const { incident, notes } = data; return ( -
- act('PRG_print', { - mode: 0, - }) - } - /> - }> - - {human_mob_list.map((record, index) => ( - {record} - ))} - -
+ <> +
act('print')} /> + } + /> + + + setSelectedTab(1)}> + General Notes + + setSelectedTab(2)}> + Incident Report + + + {selectedTab === 1 && } + {selectedTab === 2 && } + + ); }; -export const CrimeStat = (props) => { +export const GeneralNotes = ({ act, notes }) => ( +
+ + {notes.message} + + {notes.value} + + + + New note entry: + + { + const value = e.target.value; + act('updateStatRecord', { + stat: notes.stat, + new_value: value, + }); + }} + /> + + + + +
+); + +export const IncidentReport = ({ incident }) => ( +
+ + Incident Reports: + {incident.value.map((report, index) => ( + + {report} + + ))} + +
+); + +export const CrewManifest = ({ searchQuery, setSearchQuery }) => { const { act, data } = useBackend(); - const { - authenticated, - has_id, - id_name, - general_record = [], - security_record = [], - selected_target_named, - } = data; + const { human_mob_list, selected_target_name, authenticated, id_name } = data; return ( <>
{ /> } /> - {!!has_id && - !!authenticated && - !!selected_target_named && - !!general_record.length && - !!security_record.length && ( -
- - - - - act('updateStatRecord', { - stat: security_record.stat, - new_value: value, - }) + {!!authenticated && ( +
+ setSearchQuery(e.target.value)} + /> + {human_mob_list + .filter((record) => + record.toLowerCase().includes(searchQuery.toLowerCase()) + ) + .map((record, index) => ( + + {record} + +
- )} + + + ))} +
+ )} ); }; -// ----- const -------- // +export const CrimeStat = (props) => { + const { act, data } = useBackend(); + const { general_record, crime_stat } = data; + + return ( +
+ + + + + act('updateStatRecord', { + stat: crime_stat.stat, + new_value: value, + }) + } + displayText={crime_stat.value} + /> + + + + {general_record.map(({ value, message }, index) => ( + + {message} {value} + + ))} + + + + + + + +
+ ); +}; + +// Constants const crimeStatusOptions = ['Arrest', 'None', 'Incarcerated']; const colors = { Arrest: 'red', None: 'blue', - Incarcerated: 'yellow', + Incarcerated: 'orange', }; From a610a622c93be66679c3fc74b2219727eb00bbd0 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 13:38:10 -0700 Subject: [PATCH 038/104] r --- code/datums/mob_hud.dm | 2 ++ code/defines/procs/records.dm | 14 +++++++------- code/modules/mob/living/carbon/human/human.dm | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index 5b1a4f4afb67..bbf78d4876d6 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -623,6 +623,8 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( return var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) + if(!security_record) + return switch(security_record.fields[MOB_CRIMINAL_STATUS]) if(MOB_STAT_CRIME_ARREST) holder.icon_state = "hudsec_wanted" diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 2bb9f88aee95..e12c3bf13ff4 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -1,6 +1,6 @@ // mob ref is a failsafe, ideally we just access through the id. -/proc/retrieve_record(record_id = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL) - if(!record_id && !mob_name && !mob_ref) +/proc/retrieve_record(record_id_ref = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL) + if(!record_id_ref && !mob_name && !mob_ref) return var/datum/datacore/database = GLOB.data_core @@ -21,8 +21,8 @@ selected_record_type = database.locked else return - if(record_id) - retrieved_record = selected_record_type[record_id] + if(record_id_ref) + retrieved_record = selected_record_type[record_id_ref] else for(var/record_id_query as anything in selected_record_type) var/datum/data/record/record = selected_record_type[record_id_query] @@ -32,11 +32,11 @@ return retrieved_record -/proc/insert_record_stat(record_id = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL, stat_type = null, new_stat = null) +/proc/insert_record_stat(record_id_ref = null, mob_name = null, mob_ref = null, record_type = RECORD_TYPE_GENERAL, stat_type = null, new_stat = null) if(!stat_type || !new_stat) return FALSE - var/datum/data/record/retrieved_record = retrieve_record(record_id, mob_name, mob_ref, record_type) + var/datum/data/record/retrieved_record = retrieve_record(record_id_ref, mob_name, mob_ref, record_type) if(!retrieved_record) return FALSE retrieved_record.fields[stat_type] = new_stat @@ -67,7 +67,7 @@ var/datum/data/record/security_record = new() security_record.fields[MOB_NAME] = person.name ? person.name : "Unknown" security_record.name = text("Security Record") - security_record.fields[MOB_CRIMINAL_STATUS] = "None" + security_record.fields[MOB_CRIMINAL_STATUS] = MOB_STAT_CRIME_NONE security_record.fields[MOB_INCIDENTS] = list() security_record.fields[MOB_WEAKREF] = WEAKREF(person) security_record.fields[MOB_SECURITY_NOTES] = person.sec_record && !jobban_isbanned(person, "Records") ? person.sec_record : "No notes found." diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 16c21461c81d..f54acba9cc55 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -529,9 +529,10 @@ if(istype(ID)) perpref = ID.registered_ref var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) - if(hasHUD(usr,"security") || isobserver(usr)) + if(hasHUD(usr,"security") || isobserver(usr) && security_record) to_chat(usr, "Name: [security_record.fields[MOB_NAME]] Criminal Status: [security_record.fields[MOB_CRIMINAL_STATUS]]") - to_chat(usr, "Incidents: [security_record.fields[MOB_INCIDENTS]]") + for(var/i in 1 to length(security_record.fields[MOB_INCIDENTS])) + to_chat(usr, "Incidents: [security_record.fields[MOB_INCIDENTS][i]]") // to_chat(usr, "\[View Comment Log\]") read = TRUE From 9ba0c028392d546c78a4979cad2b3a7dd920f08a Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 14:52:27 -0700 Subject: [PATCH 039/104] r --- tgui/packages/tgui/interfaces/SecRec.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tgui/packages/tgui/interfaces/SecRec.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx index c2c8df1e514e..9ae6045a7f18 100644 --- a/tgui/packages/tgui/interfaces/SecRec.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -57,12 +57,7 @@ export const CrimeHist = (props) => { return ( <> -
act('print')} /> - } - /> +
Date: Tue, 14 May 2024 15:15:45 -0700 Subject: [PATCH 040/104] e --- code/game/machinery/computer/security.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 7a6502447202..462a18d2a47c 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -111,7 +111,7 @@ list( value = target_gen_record?.fields[MOB_SEX], message ="Sex: " - ), + ) ) crime_stat = list( From d6bd20fb7e7d175713bca072c147a4405a6f3fe2 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:19:20 -0700 Subject: [PATCH 041/104] l --- code/game/machinery/computer/security.dm | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 462a18d2a47c..c16eec1f67d9 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -100,18 +100,9 @@ var/datum/data/record/target_sec_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_SECURITY) var/datum/data/record/target_gen_record = retrieve_record(mob_name = username, record_type = RECORD_TYPE_GENERAL) target_general_record = list( - list( - value = target_gen_record?.fields[MOB_NAME], - message = "Name: " - ), - list( - value = target_gen_record?.fields[MOB_AGE], - message ="Age: " - ), - list( - value = target_gen_record?.fields[MOB_SEX], - message ="Sex: " - ) + list(value = target_gen_record?.fields[MOB_NAME],message = "Name: "), + list(value = target_gen_record?.fields[MOB_AGE], message ="Age: "), + list(value = target_gen_record?.fields[MOB_SEX], message ="Sex: "), ) crime_stat = list( From f95dacfdd00cd4e9065fb15f7d6a7aee436eed9b Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:24:40 -0700 Subject: [PATCH 042/104] whoop --- code/datums/datacore.dm | 1 - code/datums/medal_awards.dm | 1 - code/game/machinery/computer/security.dm | 3 +++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 33cda40b1cad..bd9addcccb64 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -86,7 +86,6 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) var/dept_flags = NO_FLAGS //Is there anybody in the department?. var/list/squad_sublists = GLOB.ROLES_SQUAD_ALL.Copy() //Are there any marines in the squad? - // fix for(var/datum/data/record/record_entry in GLOB.data_core.general) if(record_entry.fields[MOB_REAL_FACTION] != FACTION_MARINE) //we process only USCM humans continue diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 5852e0849dc6..887f6e9c4879 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -164,7 +164,6 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME /proc/give_medal_award_prefilled(medal_location, mob/giving_mob, chosen_recipient, recipient_rank, recipient_ckey, reason, _medal_type) var/list/recipient_ranks = list() - //fix for(var/record_name in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields[MOB_NAME] diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index c16eec1f67d9..6bc0b584597e 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -279,3 +279,6 @@ data["authenticated"] = authenticated return data + +#undef SECURITY +#undef GENERAL From 84a7b63bb14aa2c175662d74fc5371766f115680 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:27:10 -0700 Subject: [PATCH 043/104] mk --- code/game/machinery/medical_pod/autodoc.dm | 1 - code/game/machinery/medical_pod/bodyscanner.dm | 1 - code/game/objects/items/bodybag.dm | 2 -- code/modules/mob/living/carbon/human/examine.dm | 2 -- code/modules/mob/living/carbon/human/human.dm | 3 --- 5 files changed, 9 deletions(-) diff --git a/code/game/machinery/medical_pod/autodoc.dm b/code/game/machinery/medical_pod/autodoc.dm index ee617bc4b97b..eeb7622997ff 100644 --- a/code/game/machinery/medical_pod/autodoc.dm +++ b/code/game/machinery/medical_pod/autodoc.dm @@ -284,7 +284,6 @@ var/mob/living/carbon/human/H = M var/datum/data/record/N = null var/human_ref = WEAKREF(H) - //fix N = retrieve_record(record_id_ref = H.record_id_ref, mob_ref = human_ref, record_type = RECORD_TYPE_MEDICAL) if(isnull(N)) visible_message("\The [src] buzzes: No records found for occupant.") diff --git a/code/game/machinery/medical_pod/bodyscanner.dm b/code/game/machinery/medical_pod/bodyscanner.dm index 61d1071f4946..8e9918977c5b 100644 --- a/code/game/machinery/medical_pod/bodyscanner.dm +++ b/code/game/machinery/medical_pod/bodyscanner.dm @@ -160,7 +160,6 @@ var/mob/living/carbon/human/H = connected.occupant var/datum/data/record/N = null var/human_ref = WEAKREF(H) - //fix N = retrieve_record(record_id_ref = H.record_id_ref, mob_ref = human_ref, record_type = RECORD_TYPE_MEDICAL) if(isnull(N)) N = create_medical_record(H) diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 49bf4156c6d6..afdbb6afd221 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -336,7 +336,6 @@ if(ishuman(stasis_mob)) var/mob/living/carbon/human/H = stasis_mob var/stasis_ref = WEAKREF(H) - //fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if (R.fields["ref"] == stasis_ref) if(R.fields["last_scan_time"] && R.fields["last_tgui_scan_result"]) @@ -355,7 +354,6 @@ if(ishuman(stasis_mob)) var/mob/living/carbon/human/H = stasis_mob var/stasis_ref = WEAKREF(H) - //fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["ref"] == stasis_ref) if(R.fields["last_tgui_scan_result"]) diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm index 55d385192cdc..284512868b40 100644 --- a/code/modules/mob/living/carbon/human/examine.dm +++ b/code/modules/mob/living/carbon/human/examine.dm @@ -455,7 +455,6 @@ if(perpref) var/criminal = "None" - //fix var/datum/data/record/security_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_SECURITY) criminal = security_record.fields[MOB_CRIMINAL_STATUS] @@ -475,7 +474,6 @@ // scan reports var/datum/data/record/N = null var/me_ref = WEAKREF(src) - //fix N = retrieve_record(mob_ref = me_ref, record_type = RECORD_TYPE_MEDICAL) if(!isnull(N)) if(!(N.fields[MOB_LAST_SCAN_TIME])) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f54acba9cc55..b0665da6ebe4 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -550,7 +550,6 @@ var/read = 0 if(perpref) - //fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] != perpref) continue @@ -586,7 +585,6 @@ perpref = ID.registered_ref if(perpref) - //fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] != perpref) continue @@ -705,7 +703,6 @@ if(perpref) for(var/datum/data/record/E in GLOB.data_core.general) - //fix if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["id"] == E.fields["id"]) From 42a9dfe54d0b6d25aa195a7c084462fdbad790c9 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:40:12 -0700 Subject: [PATCH 044/104] suggested change --- code/game/machinery/computer/medical.dm | 69 +++++++++++++------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 595670516851..3f43d7bba5e9 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -102,41 +102,9 @@ if(!COOLDOWN_FINISHED(src, print_cooldown)) visible_message("[SPAN_BOLD("[src]")] states, \"PRINT ERROR: system is still on cooldown.\"") return - COOLDOWN_START(src, print_cooldown, PRINT_COOLDOWN_TIME ) - playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) - var/contents = {"

Medical Report

- Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
- For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
-
-

General Information

- Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
- Sex: [target_record_general?.fields[MOB_SEX]]
- Age: [target_record_general?.fields[MOB_AGE]]
- Blood Type: [target_record_medical?.fields[MOB_BLOOD_TYPE]]
-
-

Medical Notes

- General Notes: [target_record_medical?.fields[MOB_MEDICAL_NOTES]]
- Psychiatric History: [target_record_general?.fields[MOB_MENTAL_STATUS]]
- Disease History: [target_record_medical?.fields[MOB_DISEASES]]
- Disability History: [target_record_medical?.fields[MOB_DISABILITIES]]
-
- "} - - // autopsy report gets shwacked ontop if it exists and the target stat is dead - if(target_record_general.fields[MOB_HEALTH_STATUS] == MOB_STAT_HEALTH_DECEASED && target_record_medical.fields[MOB_AUTOPSY_SUBMISSION]) - contents += {"

Autopsy Report

- Autopsy Notes: [target_record_medical.fields[MOB_AUTOPSY_NOTES]]
- Cause Of Death: [target_record_medical.fields[MOB_CAUSE_OF_DEATH]]
- "} + print_paper() - var/obj/item/paper/med_report = new (loc) - med_report.name = "Medical Report" - med_report.info += contents - med_report.update_icon() - - visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) - return TRUE if("eject") if(target_id_card) if(ishuman(user)) @@ -177,6 +145,41 @@ target_record_medical.fields[MOB_AUTOPSY_SUBMISSION] = TRUE return TRUE +/obj/structure/machinery/computer/double_id/med_data/print_paper() + playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) + var/contents = {"

Medical Report

+ Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
+ For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+
+

General Information

+ Name: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
+ Sex: [target_record_general?.fields[MOB_SEX]]
+ Age: [target_record_general?.fields[MOB_AGE]]
+ Blood Type: [target_record_medical?.fields[MOB_BLOOD_TYPE]]
+
+

Medical Notes

+ General Notes: [target_record_medical?.fields[MOB_MEDICAL_NOTES]]
+ Psychiatric History: [target_record_general?.fields[MOB_MENTAL_STATUS]]
+ Disease History: [target_record_medical?.fields[MOB_DISEASES]]
+ Disability History: [target_record_medical?.fields[MOB_DISABILITIES]]
+
+ "} + + // autopsy report gets shwacked ontop if it exists and the target stat is dead + if(target_record_general.fields[MOB_HEALTH_STATUS] == MOB_STAT_HEALTH_DECEASED && target_record_medical.fields[MOB_AUTOPSY_SUBMISSION]) + contents += {"

Autopsy Report

+ Autopsy Notes: [target_record_medical.fields[MOB_AUTOPSY_NOTES]]
+ Cause Of Death: [target_record_medical.fields[MOB_CAUSE_OF_DEATH]]
+ "} + + var/obj/item/paper/med_report = new (loc) + med_report.name = "Medical Report" + med_report.info += contents + med_report.update_icon() + + visible_message(SPAN_NOTICE("\The [src] prints out a paper.")) + return TRUE + /obj/structure/machinery/computer/double_id/med_data/ui_static_data(mob/user) var/list/data = list() data["general_record"] = list( From 35f5722fb4363fc62e115054b764888055d07b15 Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:45:18 -0700 Subject: [PATCH 045/104] l --- code/game/machinery/computer/medical.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 3f43d7bba5e9..dc5a95ea0f42 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -145,7 +145,7 @@ target_record_medical.fields[MOB_AUTOPSY_SUBMISSION] = TRUE return TRUE -/obj/structure/machinery/computer/double_id/med_data/print_paper() +/obj/structure/machinery/computer/double_id/med_data/proc/print_paper() playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) var/contents = {"

Medical Report

Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
From 27457dcc140f884f52d5b073dd834f1d1018116a Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:47:44 -0700 Subject: [PATCH 046/104] f --- code/modules/mob/living/carbon/human/human.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index b0665da6ebe4..e4c167642907 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -618,7 +618,6 @@ var/modified = FALSE if(perpref) - // fix - fml. var/datum/data/record/health_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_GENERAL) var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", health_record.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) From 73ad0f4a2d5d830e3d93d8a57b6eb87a5caef05c Mon Sep 17 00:00:00 2001 From: DOOM Date: Tue, 14 May 2024 15:49:32 -0700 Subject: [PATCH 047/104] more more --- code/modules/mob/living/carbon/human/human.dm | 3 --- code/modules/paperwork/filingcabinet.dm | 1 - 2 files changed, 4 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index e4c167642907..cf5a778ddb89 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -645,7 +645,6 @@ var/read = FALSE if(perpref) - // fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) @@ -674,7 +673,6 @@ var/read = FALSE if(perpref) - // fix for(var/datum/data/record/E in GLOB.data_core.general) if(E.fields["ref"] == perpref) for(var/datum/data/record/R as anything in GLOB.data_core.medical) @@ -812,7 +810,6 @@ /mob/living/carbon/human/ui_data(mob/user) var/me_ref = WEAKREF(src) - // fix for(var/datum/data/record/R as anything in GLOB.data_core.medical) if(R.fields["ref"] == me_ref) if(R.fields["last_tgui_scan_result"]) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 3f2e52d45270..0902957ed821 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -104,7 +104,6 @@ /obj/structure/filingcabinet/security/proc/populate() if(virgin) - // fix for(var/record_name in GLOB.data_core.general) var/datum/data/record/G = GLOB.data_core.general[record_name] // yeah I know single letter vars, but like plz. var/datum/data/record/S From 9ddcdd149ac4207e17719729428e85fca0ad063d Mon Sep 17 00:00:00 2001 From: Vero <73014819+vero5123@users.noreply.github.com> Date: Sat, 18 May 2024 12:42:12 -0400 Subject: [PATCH 048/104] Update code/game/machinery/computer/security.dm Co-authored-by: kiVts <48099872+kiVts@users.noreply.github.com> --- code/game/machinery/computer/security.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 6bc0b584597e..2e7aa29d3c79 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -211,7 +211,7 @@ return var/mob/user = ui.user - playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1) + playsound(src, "keyboard_alt", 5, 1) switch(action) if("authenticate") var/obj/item/id_card = user.get_active_hand() From 318d10788a7602704956c19281e11b32a5f97f83 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 18 May 2024 09:45:59 -0700 Subject: [PATCH 049/104] ? --- code/game/machinery/computer/security.dm | 3 ++- code/modules/cm_marines/marines_consoles.dm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 6bc0b584597e..68cec238f10e 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -64,7 +64,8 @@ set name = "Eject ID Card" set src in oview(1) - if(!usr || usr.is_mob_incapacitated()) return + if(!usr || usr.is_mob_incapacitated()) + return if(user_id_card) user_id_card.loc = get_turf(src) diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index edfd1e9601e8..5c1b84d18efb 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -63,7 +63,8 @@ set name = "Eject ID Card" set src in oview(1) - if(!usr || usr.is_mob_incapacitated()) return + if(!usr || usr.is_mob_incapacitated()) + return if(user_id_card) user_id_card.loc = get_turf(src) From a932814b1e9a273b1792c5bf5c00f6495d661372 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 18 May 2024 09:55:58 -0700 Subject: [PATCH 050/104] yeah yeah --- code/modules/mob/living/carbon/human/human.dm | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index cf5a778ddb89..10ae8adba3fc 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -608,30 +608,34 @@ to_chat(usr, "You have added a new comment to the Security Record of [R.fields["name"]]. \[View Comment Log\]") if(href_list["medical"]) - if(hasHUD(usr,"medical")) - var/perpref = null - if(wear_id) - var/obj/item/card/id/ID = wear_id.GetID() - if(istype(ID)) - perpref = ID.registered_ref + if(!hasHUD(usr,"medical")) + return + var/perpref = null + if(wear_id) + var/obj/item/card/id/ID = wear_id.GetID() + if(istype(ID)) + perpref = ID.registered_ref - var/modified = FALSE + var/modified = FALSE - if(perpref) - var/datum/data/record/health_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_GENERAL) - var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", health_record.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) - - if(hasHUD(usr,"medical")) - if(setmedical != "Cancel") - health_record.fields[MOB_HEALTH_STATUS] = setmedical - modified = TRUE - spawn() - if(istype(usr,/mob/living/carbon/human)) - var/mob/living/carbon/human/U = usr - U.handle_regular_hud_updates() + if(!perpref) + return - if(!modified) - to_chat(usr, SPAN_DANGER("Unable to locate a data core entry for this person.")) + var/datum/data/record/health_record = retrieve_record(mob_ref = perpref, record_type = RECORD_TYPE_GENERAL) + var/setmedical = tgui_input_list(usr, "Specify a new medical status for this person.", "Medical HUD", health_record.fields[MOB_HEALTH_STATUS], list(MOB_STAT_HEALTH_DECEASED, MOB_STAT_HEALTH_UNFIT, MOB_STAT_HEALTH_ACTIVE, "Cancel")) + + if(!hasHUD(usr,"medical") || setmedical == "Cancel") + return + + health_record.fields[MOB_HEALTH_STATUS] = setmedical + modified = TRUE + spawn() + if(istype(usr,/mob/living/carbon/human)) + var/mob/living/carbon/human/U = usr + U.handle_regular_hud_updates() + + if(!modified) + to_chat(usr, SPAN_DANGER("Unable to locate a data core entry for this person.")) /* removed for now, will be modified in the future. if(href_list["medrecord"]) From 229301f4e5cd8377ccf633c050968d6ab79f86d8 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 18 May 2024 10:11:51 -0700 Subject: [PATCH 051/104] tgui --- tgui/packages/tgui/interfaces/MedRec.jsx | 4 ++-- tgui/packages/tgui/interfaces/SecRec.jsx | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tgui/packages/tgui/interfaces/MedRec.jsx b/tgui/packages/tgui/interfaces/MedRec.jsx index 4d1833bec941..64c277fe4129 100644 --- a/tgui/packages/tgui/interfaces/MedRec.jsx +++ b/tgui/packages/tgui/interfaces/MedRec.jsx @@ -29,7 +29,7 @@ export const MedRec = (props) => { ); }; -export const MedicalRecord = (props) => { +const MedicalRecord = (props) => { const { act, data } = useBackend(); const [selectedTab, setSelectedTab] = useState(1); const { authenticated, has_id } = data; @@ -183,7 +183,7 @@ const AutopsyReport = (props) => { ); }; -export const HealthStatus = (props) => { +const HealthStatus = (props) => { const { act, data } = useBackend(); const { authenticated, has_id, id_name, general_record, health } = data; diff --git a/tgui/packages/tgui/interfaces/SecRec.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx index 9ae6045a7f18..5e16a2122ced 100644 --- a/tgui/packages/tgui/interfaces/SecRec.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -2,6 +2,7 @@ import React, { useState } from 'react'; import { useBackend } from '../backend'; import { Box, Button, Section, Tabs, Flex, Icon, Stack, Dropdown, Input } from '../components'; import { Window } from '../layouts'; + export const SecRec = (props) => { const { act, data } = useBackend(); const { authenticated, selected_target_name } = data; @@ -50,7 +51,7 @@ export const SecRec = (props) => { ); }; -export const CrimeHist = (props) => { +const CrimeHist = (props) => { const { act, data } = useBackend(); const [selectedTab, setSelectedTab] = useState(1); const { incident, notes } = data; @@ -78,7 +79,7 @@ export const CrimeHist = (props) => { ); }; -export const GeneralNotes = ({ act, notes }) => ( +const GeneralNotes = ({ act, notes }) => (
{notes.message} @@ -107,7 +108,7 @@ export const GeneralNotes = ({ act, notes }) => (
); -export const IncidentReport = ({ incident }) => ( +const IncidentReport = ({ incident }) => (
Incident Reports: @@ -120,7 +121,7 @@ export const IncidentReport = ({ incident }) => (
); -export const CrewManifest = ({ searchQuery, setSearchQuery }) => { +const CrewManifest = ({ searchQuery, setSearchQuery }) => { const { act, data } = useBackend(); const { human_mob_list, selected_target_name, authenticated, id_name } = data; @@ -182,7 +183,7 @@ export const CrewManifest = ({ searchQuery, setSearchQuery }) => { ); }; -export const CrimeStat = (props) => { +const CrimeStat = (props) => { const { act, data } = useBackend(); const { general_record, crime_stat } = data; From c85ea489644e66d7a9b1859d59224acd6ef86e04 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sat, 18 May 2024 10:14:41 -0700 Subject: [PATCH 052/104] as anything --- code/datums/medal_awards.dm | 6 +++--- code/modules/paperwork/filingcabinet.dm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 887f6e9c4879..ea85f145ec58 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -45,7 +45,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/record_name in GLOB.data_core.general) + for(var/record_name as anything in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields[MOB_NAME] recipient_ranks[recipient_name] = record.fields[MOB_REAL_RANK] @@ -164,7 +164,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME /proc/give_medal_award_prefilled(medal_location, mob/giving_mob, chosen_recipient, recipient_rank, recipient_ckey, reason, _medal_type) var/list/recipient_ranks = list() - for(var/record_name in GLOB.data_core.general) + for(var/record_name as anything in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields[MOB_NAME] recipient_ranks[recipient_name] = record.fields[MOB_SHOWN_RANK] @@ -475,7 +475,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/record_name in GLOB.data_core.general) + for(var/record_name as anything in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields["name"] if(recipient_name == recommendation_giver.real_name) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index 0902957ed821..f9b0e757db7a 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -104,7 +104,7 @@ /obj/structure/filingcabinet/security/proc/populate() if(virgin) - for(var/record_name in GLOB.data_core.general) + for(var/record_name as anything in GLOB.data_core.general) var/datum/data/record/G = GLOB.data_core.general[record_name] // yeah I know single letter vars, but like plz. var/datum/data/record/S for(var/record_id in GLOB.data_core.security) From 50625d8db9d599b3f92908bdb7e5936d7386f6e3 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 19 May 2024 09:06:33 -0700 Subject: [PATCH 053/104] we don't need to typecheck if something is just a var --- code/datums/medal_awards.dm | 6 +++--- code/modules/paperwork/filingcabinet.dm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index ea85f145ec58..887f6e9c4879 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -45,7 +45,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/record_name as anything in GLOB.data_core.general) + for(var/record_name in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields[MOB_NAME] recipient_ranks[recipient_name] = record.fields[MOB_REAL_RANK] @@ -164,7 +164,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME /proc/give_medal_award_prefilled(medal_location, mob/giving_mob, chosen_recipient, recipient_rank, recipient_ckey, reason, _medal_type) var/list/recipient_ranks = list() - for(var/record_name as anything in GLOB.data_core.general) + for(var/record_name in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields[MOB_NAME] recipient_ranks[recipient_name] = record.fields[MOB_SHOWN_RANK] @@ -475,7 +475,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Pick a marine var/list/possible_recipients = list() var/list/recipient_ranks = list() - for(var/record_name as anything in GLOB.data_core.general) + for(var/record_name in GLOB.data_core.general) var/datum/data/record/record = GLOB.data_core.general[record_name] var/recipient_name = record.fields["name"] if(recipient_name == recommendation_giver.real_name) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index f9b0e757db7a..313cf1f693ea 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -104,7 +104,7 @@ /obj/structure/filingcabinet/security/proc/populate() if(virgin) - for(var/record_name as anything in GLOB.data_core.general) + for(var/record_name in GLOB.data_core.general) var/datum/data/record/G = GLOB.data_core.general[record_name] // yeah I know single letter vars, but like plz. var/datum/data/record/S for(var/record_id in GLOB.data_core.security) @@ -141,7 +141,7 @@ for(var/record in GLOB.data_core.general) var/datum/data/record/G = GLOB.data_core.general[record] var/datum/data/record/M - for(var/record_name as anything in GLOB.data_core.medical) + for(var/record_name in GLOB.data_core.medical) var/datum/data/record/R = GLOB.data_core.medical[record_name] if((R.fields[MOB_NAME] == G.fields[MOB_NAME])) M = R From 451d482157d44bd2e82b08fdee829f3b24c1c0f1 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 19 May 2024 09:11:23 -0700 Subject: [PATCH 054/104] redundant --- code/defines/procs/records.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index e12c3bf13ff4..7157f4061253 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -24,7 +24,7 @@ if(record_id_ref) retrieved_record = selected_record_type[record_id_ref] else - for(var/record_id_query as anything in selected_record_type) + for(var/record_id_query in selected_record_type) var/datum/data/record/record = selected_record_type[record_id_query] if(record.fields[MOB_NAME] == mob_name || record.fields[MOB_WEAKREF] == mob_ref) retrieved_record = record From cb20f10425b1fa21c82bc41181693f7b29c16ca9 Mon Sep 17 00:00:00 2001 From: DOOM Date: Sun, 19 May 2024 09:14:04 -0700 Subject: [PATCH 055/104] again not necessary --- code/game/machinery/computer/security.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index d3f345e80387..e17023e4c198 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -86,7 +86,7 @@ var/list/mob_names // No, we can't use GLOB.human_mob_list since a mob is removed from that list when it gets deleted. - for(var/record as anything in GLOB.data_core.general) + for(var/record in GLOB.data_core.general) var/datum/data/record/new_record = GLOB.data_core.general[record] mob_names += new_record.fields[MOB_NAME] From 0587bd51226fa4596a49900c708e4442a5025cbf Mon Sep 17 00:00:00 2001 From: Vero <73014819+vero5123@users.noreply.github.com> Date: Sun, 19 May 2024 17:42:01 -0400 Subject: [PATCH 056/104] man. --- code/defines/procs/records.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 7157f4061253..124e6079918a 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -61,7 +61,7 @@ general_record.fields[MOB_RELIGION] = person.religion ? person.religion : "Unknown" general_record.fields[MOB_WEAKREF] = WEAKREF(person) general_record.fields[MOB_GENERAL_NOTES] = person.gen_record && !jobban_isbanned(person, "Records") ? person.gen_record : "No notes found." - GLOB.data_core.general[person.record_id_ref] += general_record + GLOB.data_core.general[person.record_id_ref] = general_record /proc/create_security_record(mob/living/carbon/human/person) var/datum/data/record/security_record = new() @@ -71,7 +71,7 @@ security_record.fields[MOB_INCIDENTS] = list() security_record.fields[MOB_WEAKREF] = WEAKREF(person) security_record.fields[MOB_SECURITY_NOTES] = person.sec_record && !jobban_isbanned(person, "Records") ? person.sec_record : "No notes found." - GLOB.data_core.security[person.record_id_ref] += security_record + GLOB.data_core.security[person.record_id_ref] = security_record /proc/create_medical_record(mob/living/carbon/human/person) var/datum/data/record/medical_record = new() @@ -89,7 +89,7 @@ medical_record.fields[MOB_AUTODOC_DATA] = list() medical_record.fields[MOB_AUTODOC_MANUAL] = list() medical_record.fields[MOB_WEAKREF] = WEAKREF(person) - GLOB.data_core.medical[person.record_id_ref] += medical_record + GLOB.data_core.medical[person.record_id_ref] = medical_record /proc/create_static_character_record(mob/living/carbon/human/person) var/datum/data/record/record_locked = new() @@ -106,4 +106,4 @@ record_locked.fields[MOB_RELIGION] = person.religion record_locked.fields[MOB_WEAKREF] = WEAKREF(person) record_locked.fields[MOB_EXPLOIT_RECORD] = !jobban_isbanned(person, "Records") ? person.exploit_record : "No additional information acquired" - GLOB.data_core.locked[person.record_id_ref] += record_locked + GLOB.data_core.locked[person.record_id_ref] = record_locked From 69db2112a4fae856262ad907056e1b947bbcc251 Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 24 May 2024 12:37:33 -0700 Subject: [PATCH 057/104] lin --- tgui/packages/tgui/interfaces/MedRec.jsx | 33 ++++++++++++++------ tgui/packages/tgui/interfaces/SecRec.jsx | 39 ++++++++++++++---------- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/tgui/packages/tgui/interfaces/MedRec.jsx b/tgui/packages/tgui/interfaces/MedRec.jsx index 64c277fe4129..52575a9ebb83 100644 --- a/tgui/packages/tgui/interfaces/MedRec.jsx +++ b/tgui/packages/tgui/interfaces/MedRec.jsx @@ -1,6 +1,16 @@ import { Fragment, useState } from 'react'; import { useBackend } from '../backend'; -import { Box, Button, Stack, Input, Dropdown, Section, Tabs, Flex, Icon } from '../components'; +import { + Box, + Button, + Stack, + Input, + Dropdown, + Section, + Tabs, + Flex, + Icon, +} from '../components'; import { Window } from '../layouts'; export const MedRec = (props) => { @@ -12,12 +22,14 @@ export const MedRec = (props) => { setSelectedTab(1)}> + onClick={() => setSelectedTab(1)} + > Health Status setSelectedTab(2)}> + onClick={() => setSelectedTab(2)} + > Medical Record @@ -47,12 +59,14 @@ const MedicalRecord = (props) => { setSelectedTab(1)}> + onClick={() => setSelectedTab(1)} + > Medical Notes setSelectedTab(2)}> + onClick={() => setSelectedTab(2)} + > Autopsy Report @@ -200,7 +214,8 @@ const HealthStatus = (props) => { act(authenticated ? 'logout' : 'authenticate'); }} /> - }> + } + >
); }; - -// Constants -const crimeStatusOptions = ['Arrest', 'None', 'Incarcerated']; - -const colors = { - Arrest: 'red', - None: 'blue', - Incarcerated: 'orange', -}; From 6d234fef4df406a7afc538541d79c9666ae464ba Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 24 May 2024 13:09:30 -0700 Subject: [PATCH 058/104] ye --- tgui/packages/tgui/interfaces/SecRec.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/SecRec.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx index 65d5ef40cfc3..79319af84d43 100644 --- a/tgui/packages/tgui/interfaces/SecRec.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -165,7 +165,7 @@ const CrewManifest = ({ searchQuery, setSearchQuery }) => { /> {human_mob_list .filter((record) => - record.toLowerCase().includes(searchQuery.toLowerCase()) + record.toLowerCase().includes(searchQuery.toLowerCase()), ) .map((record, index) => ( Date: Fri, 24 May 2024 13:12:38 -0700 Subject: [PATCH 059/104] whoop --- tgui/packages/tgui/interfaces/SecRec.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tgui/packages/tgui/interfaces/SecRec.jsx b/tgui/packages/tgui/interfaces/SecRec.jsx index 79319af84d43..5f29d09a7122 100644 --- a/tgui/packages/tgui/interfaces/SecRec.jsx +++ b/tgui/packages/tgui/interfaces/SecRec.jsx @@ -239,3 +239,12 @@ const CrimeStat = (props) => {
); }; + +// Constants +const crimeStatusOptions = ['Arrest', 'None', 'Incarcerated']; + +const colors = { + Arrest: 'red', + None: 'blue', + Incarcerated: 'orange', +}; From 431e61e2f7de74a11c1bbdb391065083cafebbe7 Mon Sep 17 00:00:00 2001 From: DOOM Date: Fri, 24 May 2024 13:17:57 -0700 Subject: [PATCH 060/104] prettier --write go fuck yourself --- tgui/packages/tgui/interfaces/SquadMod.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/SquadMod.jsx b/tgui/packages/tgui/interfaces/SquadMod.jsx index 3c73a5fc579d..e97d28752a64 100644 --- a/tgui/packages/tgui/interfaces/SquadMod.jsx +++ b/tgui/packages/tgui/interfaces/SquadMod.jsx @@ -19,7 +19,8 @@ export const SquadMod = (props) => { act(authenticated ? 'logout' : 'authenticate'); }} /> - }> + } + >