From c73aab425c5a64d6a73dc2b5cd3e4897a6959534 Mon Sep 17 00:00:00 2001 From: spookydonut Date: Thu, 23 Jan 2025 19:03:00 +0800 Subject: [PATCH 1/4] First pass on subsysteming datacore related updates --- code/__DEFINES/data_core.dm | 3 + code/__DEFINES/subsystems.dm | 1 + code/controllers/subsystem/data_core.dm | 31 +++++ code/datums/datacore.dm | 112 +++++++++++++++++- code/game/machinery/computer/medical.dm | 37 +----- code/game/machinery/computer/security.dm | 34 +----- code/game/machinery/computer/skills.dm | 43 +------ code/game/machinery/cryopod.dm | 15 +-- .../admin/player_panel/actions/physical.dm | 15 +-- colonialmarines.dme | 2 + 10 files changed, 158 insertions(+), 135 deletions(-) create mode 100644 code/__DEFINES/data_core.dm create mode 100644 code/controllers/subsystem/data_core.dm diff --git a/code/__DEFINES/data_core.dm b/code/__DEFINES/data_core.dm new file mode 100644 index 000000000000..83534337018b --- /dev/null +++ b/code/__DEFINES/data_core.dm @@ -0,0 +1,3 @@ +#define FLAG_DATA_CORE_MEDICAL_UPDATED (1>>0) +#define FLAG_DATA_CORE_SECURITY_UPDATED (1>>1) +#define FLAG_DATA_CORE_GENERAL_UPDATED (1>>2) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 9b709b9be3e5..715db60d27d7 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -173,6 +173,7 @@ #define SS_PRIORITY_HUMAN 148 #define SS_PRIORITY_STAMINA 126 #define SS_PRIORITY_COMPONENT 125 +#define SS_PRIORITY_DATA_CORE 121 #define SS_PRIORITY_NANOUI 120 #define SS_PRIORITY_TGUI 120 #define SS_PRIORITY_HIVE_STATUS 112 diff --git a/code/controllers/subsystem/data_core.dm b/code/controllers/subsystem/data_core.dm new file mode 100644 index 000000000000..a9b722da6fcf --- /dev/null +++ b/code/controllers/subsystem/data_core.dm @@ -0,0 +1,31 @@ +SUBSYSTEM_DEF(data_core) + name = "Data Core" + priority = SS_PRIORITY_DATA_CORE + flags = SS_NO_INIT + wait = 10 SECONDS + + var/list/datum/tgui_havers = list() + var/list/datum/currentrun = list() + +/datum/controller/subsystem/data_core/stat_entry(msg) + msg = "P:[length(tgui_havers)]" + return ..() + +/datum/controller/subsystem/data_core/fire(resumed = FALSE) + if (!resumed) + if(GLOB.data_core.update_flags == NONE) + return + GLOB.data_core.update_flags = NONE + currentrun = tgui_havers.Copy() + + while (length(currentrun)) + var/datum/tgui_haver = currentrun[length(currentrun)] + currentrun.len-- + + if (!tgui_haver || QDELETED(tgui_haver)) + continue + + tgui_haver.update_static_data_for_all_viewers() + + if (MC_TICK_CHECK) + return diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index cb80e3be2d82..f84a6cbaf1ad 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -8,6 +8,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) var/locked[] = list() var/leveled_riflemen = 0 var/leveled_riflemen_max = 7 + var/update_flags = NONE /datum/datacore/proc/manifest(nosleep = 0) spawn() @@ -25,7 +26,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) var/datum/data/record/foundrecord var/use_name = isnull(ref) - for(var/datum/data/record/record_entry in GLOB.data_core.general) + for(var/datum/data/record/record_entry in general) if(use_name) if(record_entry.fields["name"] == name) foundrecord = record_entry @@ -45,9 +46,115 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) if(!use_name) if(name) foundrecord.fields["name"] = name + update_flags |= FLAG_DATA_CORE_GENERAL_UPDATED return TRUE return FALSE +/datum/datacore/proc/manifest_delete_all_medical() + msg_admin_niche("[key_name_admin(usr)] deleted all medical records.") + QDEL_LIST(medical) + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED + +/datum/datacore/proc/manifest_medical_emp_act(severity) + for(var/datum/data/record/R as anything in medical) + if(prob(10/severity)) + switch(rand(1,6)) + if(1) + msg_admin_niche("The medical record name of [R.fields["name"]] was scrambled!") + 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") + msg_admin_niche("The medical record sex of [R.fields["name"]] was scrambled!") + if(3) + R.fields["age"] = rand(5, 85) + msg_admin_niche("The medical record age of [R.fields["name"]] was scrambled!") + if(4) + R.fields["b_type"] = pick("A-", "B-", "AB-", "O-", "A+", "B+", "AB+", "O+") + msg_admin_niche("The medical record blood type of [R.fields["name"]] was scrambled!") + if(5) + R.fields["p_stat"] = pick("*SSD*", "Active", "Physically Unfit", "Disabled") + msg_admin_niche("The medical record physical state of [R.fields["name"]] was scrambled!") + if(6) + R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") + msg_admin_niche("The medical record mental state of [R.fields["name"]] was scrambled!") + continue + + else if(prob(1)) + msg_admin_niche("The medical record of [R.fields["name"]] was lost!") + medical -= R + qdel(R) + continue + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED + +/datum/datacore/proc/manifest_delete_all_security() + msg_admin_niche("[key_name_admin(usr)] deleted all security records.") + QDEL_LIST(security) + + update_flags |= FLAG_DATA_CORE_SECURITY_UPDATED + +/datum/datacore/proc/manifest_security_emp_act(severity) + for(var/datum/data/record/R in security) + if(prob(10/severity)) + switch(rand(1,6)) + if(1) + msg_admin_niche("The employment record name of [R.fields["name"]] was scrambled!") + 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") + msg_admin_niche("The employment record sex of [R.fields["name"]] was scrambled!") + if(3) + R.fields["age"] = rand(5, 85) + msg_admin_niche("The employment record age of [R.fields["name"]] was scrambled!") + if(4) + R.fields["criminal"] = pick("None", "*Arrest*", "Incarcerated", "Released") + msg_admin_niche("The employment record criminal status of [R.fields["name"]] was scrambled!") + if(5) + R.fields["p_stat"] = pick("*Unconscious*", "Active", "Physically Unfit") + msg_admin_niche("The employment record physical state of [R.fields["name"]] was scrambled!") + if(6) + R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") + msg_admin_niche("The employment record mental state of [R.fields["name"]] was scrambled!") + continue + + else if(prob(1)) + msg_admin_niche("The employment record of [R.fields["name"]] was lost!") + security -= R + qdel(R) + continue + update_flags |= FLAG_DATA_CORE_SECURITY_UPDATED + +/datum/datacore/proc/manifest_delete_medical_record(datum/data/record/target) + if(!istype(target, /datum/data/record)) + return + for(var/datum/data/record/R as anything in medical) + if ((R.fields["name"] == target.fields["name"] || R.fields["id"] == target.fields["id"])) + medical -= R + qdel(R) + msg_admin_niche("[key_name_admin(usr)] deleted all employment records for [target.fields["name"]] ([target.fields["id"]]).") + QDEL_NULL(target) + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED + +/datum/datacore/proc/manifest_inject_medical_record(datum/data/record/record) + medical += record + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED + +/datum/datacore/proc/manifest_delete(mob/living/carbon/human/target) + //Delete them from datacore. + var/target_ref = WEAKREF(target) + for(var/datum/data/record/R as anything in medical) + if((R.fields["ref"] == target_ref)) + medical -= R + qdel(R) + for(var/datum/data/record/T in security) + if((T.fields["ref"] == target_ref)) + security -= T + qdel(T) + for(var/datum/data/record/G in general) + if((G.fields["ref"] == target_ref)) + general -= G + qdel(G) + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED|FLAG_DATA_CORE_SECURITY_UPDATED|FLAG_DATA_CORE_GENERAL_UPDATED + /datum/datacore/proc/manifest_inject(mob/living/carbon/human/target) var/assignment if(target.job) @@ -110,7 +217,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) record_medical.fields["notes"] = target.med_record else record_medical.fields["notes"] = "No notes found." - medical += record_medical + manifest_inject_medical_record(record_medical) //Security Record var/datum/data/record/record_security = new() @@ -148,6 +255,7 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) else record_locked.fields["exploit_record"] = "No additional information acquired." locked += record_locked + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED|FLAG_DATA_CORE_SECURITY_UPDATED|FLAG_DATA_CORE_GENERAL_UPDATED /proc/get_id_photo(mob/living/carbon/human/H) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 9d6c76ca40a6..fc22c50d2c53 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -209,12 +209,8 @@ 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) + GLOB.data_core.manifest_delete_all_medical() temp = "All records deleted." - msg_admin_niche("[key_name_admin(usr)] deleted all medical records.") if (href_list["field"]) var/a1 = active1 @@ -394,7 +390,7 @@ 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 + GLOB.data_core.manifest_inject_medical_record(R) src.active2 = R src.screen = 4 @@ -499,34 +495,7 @@ 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) - msg_admin_niche("The medical record name of [R.fields["name"]] was scrambled!") - 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") - msg_admin_niche("The medical record sex of [R.fields["name"]] was scrambled!") - if(3) - R.fields["age"] = rand(5, 85) - msg_admin_niche("The medical record age of [R.fields["name"]] was scrambled!") - if(4) - R.fields["b_type"] = pick("A-", "B-", "AB-", "O-", "A+", "B+", "AB+", "O+") - msg_admin_niche("The medical record blood type of [R.fields["name"]] was scrambled!") - if(5) - R.fields["p_stat"] = pick("*SSD*", "Active", "Physically Unfit", "Disabled") - msg_admin_niche("The medical record physical state of [R.fields["name"]] was scrambled!") - if(6) - R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") - msg_admin_niche("The medical record mental state of [R.fields["name"]] was scrambled!") - continue - - else if(prob(1)) - msg_admin_niche("The medical record of [R.fields["name"]] was lost!") - GLOB.data_core.medical -= R - qdel(R) - continue + GLOB.data_core.manifest_medical_emp_act(severity) /obj/structure/machinery/computer/med_data/laptop diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 2e849a4f8843..64a5b62a26d0 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -351,11 +351,8 @@ What a mess.*/ temp += "No" if ("Purge All Records") - for(var/datum/data/record/R in GLOB.data_core.security) - GLOB.data_core.security -= R - qdel(R) + GLOB.data_core.manifest_delete_all_security() temp = "All Security records deleted." - msg_admin_niche("[key_name_admin(usr)] deleted all security records.") if ("Add Entry") if (!(istype(active2, /datum/data/record))) @@ -532,34 +529,7 @@ What a mess.*/ if(inoperable()) return - for(var/datum/data/record/R in GLOB.data_core.security) - if(prob(10/severity)) - switch(rand(1,6)) - if(1) - msg_admin_niche("The security record name of [R.fields["name"]] was scrambled!") - 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") - msg_admin_niche("The security record sex of [R.fields["name"]] was scrambled!") - if(3) - R.fields["age"] = rand(5, 85) - msg_admin_niche("The security record age of [R.fields["name"]] was scrambled!") - if(4) - R.fields["criminal"] = pick("None", "*Arrest*", "Incarcerated", "Released", "Suspect", "NJP") - msg_admin_niche("The security record criminal status of [R.fields["name"]] was scrambled!") - if(5) - R.fields["p_stat"] = pick("*Unconscious*", "Active", "Physically Unfit") - msg_admin_niche("The security record physical state of [R.fields["name"]] was scrambled!") - if(6) - R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") - msg_admin_niche("The security record mental state of [R.fields["name"]] was scrambled!") - continue - - else if(prob(1)) - msg_admin_niche("The security record of [R.fields["name"]] was lost!") - GLOB.data_core.security -= R - qdel(R) - continue + GLOB.data_core.manifest_security_emp_act(severity) /obj/structure/machinery/computer/secure_data/detective_computer icon = 'icons/obj/structures/machinery/computer.dmi' diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index 8770f3b00a57..4e7e701e0796 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -255,11 +255,8 @@ What a mess.*/ temp += "No" if ("Purge All Records") - for(var/datum/data/record/R in GLOB.data_core.security) - GLOB.data_core.security -= R - qdel(R) + GLOB.data_core.manifest_delete_all_security() temp = "All Employment records deleted." - msg_admin_niche("[key_name_admin(usr)] deleted all employment records.") if ("Delete Record (ALL)") if(istype(active1, /datum/data/record)) @@ -339,13 +336,8 @@ What a mess.*/ message_admins("[key_name_admin(usr)] changed the employment record rank for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") if ("Delete Record (ALL) Execute") - if(istype(active1, /datum/data/record)) - for(var/datum/data/record/R as anything in GLOB.data_core.medical) - if ((R.fields["name"] == active1.fields["name"] || R.fields["id"] == active1.fields["id"])) - GLOB.data_core.medical -= R - qdel(R) - msg_admin_niche("[key_name_admin(usr)] deleted all employment records for [active1.fields["name"]] ([active1.fields["id"]]).") - QDEL_NULL(active1) + GLOB.data_core.manifest_delete_medical_record(active1) + active1 = null else temp = "This function does not appear to be working at the moment. Our apologies." @@ -358,32 +350,5 @@ What a mess.*/ if(inoperable()) return - for(var/datum/data/record/R in GLOB.data_core.security) - if(prob(10/severity)) - switch(rand(1,6)) - if(1) - msg_admin_niche("The employment record name of [R.fields["name"]] was scrambled!") - 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") - msg_admin_niche("The employment record sex of [R.fields["name"]] was scrambled!") - if(3) - R.fields["age"] = rand(5, 85) - msg_admin_niche("The employment record age of [R.fields["name"]] was scrambled!") - if(4) - R.fields["criminal"] = pick("None", "*Arrest*", "Incarcerated", "Released") - msg_admin_niche("The employment record criminal status of [R.fields["name"]] was scrambled!") - if(5) - R.fields["p_stat"] = pick("*Unconscious*", "Active", "Physically Unfit") - msg_admin_niche("The employment record physical state of [R.fields["name"]] was scrambled!") - if(6) - R.fields["m_stat"] = pick("*Insane*", "*Unstable*", "*Watch*", "Stable") - msg_admin_niche("The employment record mental state of [R.fields["name"]] was scrambled!") - continue - - else if(prob(1)) - msg_admin_niche("The employment record of [R.fields["name"]] was lost!") - GLOB.data_core.security -= R - qdel(R) - continue + GLOB.data_core.manifest_security_emp_act(severity) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 8a5655138535..5b2ceb065797 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -356,20 +356,7 @@ 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) + GLOB.data_core.manifest_delete(occupant) icon_state = "body_scanner_open" set_light(0) diff --git a/code/modules/admin/player_panel/actions/physical.dm b/code/modules/admin/player_panel/actions/physical.dm index 21f5504455d2..f5ad984104c0 100644 --- a/code/modules/admin/player_panel/actions/physical.dm +++ b/code/modules/admin/player_panel/actions/physical.dm @@ -85,20 +85,7 @@ //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) + GLOB.data_core.manifest_delete(target) if(target.key) target.ghostize(FALSE) diff --git a/colonialmarines.dme b/colonialmarines.dme index b49e016f633e..5b0dd73145a1 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -52,6 +52,7 @@ #include "code\__DEFINES\configuration.dm" #include "code\__DEFINES\conflict.dm" #include "code\__DEFINES\cooldowns.dm" +#include "code\__DEFINES\data_core.dm" #include "code\__DEFINES\db_defs.dm" #include "code\__DEFINES\defenses.dm" #include "code\__DEFINES\dropships.dm" @@ -264,6 +265,7 @@ #include "code\controllers\subsystem\cellauto.dm" #include "code\controllers\subsystem\chat.dm" #include "code\controllers\subsystem\communications.dm" +#include "code\controllers\subsystem\data_core.dm" #include "code\controllers\subsystem\dcs.dm" #include "code\controllers\subsystem\decorator.dm" #include "code\controllers\subsystem\disease.dm" From 1d91733873c1691cabed4c4b61e8f8c63c6fc4d4 Mon Sep 17 00:00:00 2001 From: spookydonut Date: Thu, 23 Jan 2025 19:57:14 +0800 Subject: [PATCH 2/4] This should now account for all changes made to data_core --- code/datums/datacore.dm | 23 +- code/defines/procs/records.dm | 6 +- code/game/jobs/role_authority.dm | 5 +- code/game/machinery/computer/medical.dm | 294 +++++++++--------- code/game/machinery/computer/security.dm | 183 ++++++----- code/game/machinery/computer/sentencing.dm | 2 +- code/game/machinery/computer/skills.dm | 116 +++---- .../game/machinery/medical_pod/bodyscanner.dm | 17 +- code/modules/mob/living/carbon/human/human.dm | 7 +- 9 files changed, 354 insertions(+), 299 deletions(-) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index f84a6cbaf1ad..eee9d362c43e 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -22,7 +22,7 @@ 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) +/datum/datacore/proc/manifest_modify(name, ref, assignment, rank, p_stat, squad_name) var/datum/data/record/foundrecord var/use_name = isnull(ref) @@ -43,6 +43,8 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) foundrecord.fields["real_rank"] = rank if(p_stat) foundrecord.fields["p_stat"] = p_stat + if(squad_name) + foundrecord.fields["squad"] = squad_name if(!use_name) if(name) foundrecord.fields["name"] = name @@ -134,10 +136,29 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) QDEL_NULL(target) update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED +// Used for ensuring injected records flag for updates /datum/datacore/proc/manifest_inject_medical_record(datum/data/record/record) medical += record update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED +/datum/datacore/proc/manifest_inject_general_record(datum/data/record/record) + general += record + update_flags |= FLAG_DATA_CORE_GENERAL_UPDATED + +/datum/datacore/proc/manifest_inject_security_record(datum/data/record/record) + security += record + update_flags |= FLAG_DATA_CORE_SECURITY_UPDATED + +// Currently do nothing except flag, could do something in future +/datum/datacore/proc/manifest_updated_medical_record(datum/data/record/record) + update_flags |= FLAG_DATA_CORE_MEDICAL_UPDATED + +/datum/datacore/proc/manifest_updated_general_record(datum/data/record/record) + update_flags |= FLAG_DATA_CORE_GENERAL_UPDATED + +/datum/datacore/proc/manifest_updated_security_record(datum/data/record/record) + update_flags |= FLAG_DATA_CORE_SECURITY_UPDATED + /datum/datacore/proc/manifest_delete(mob/living/carbon/human/target) //Delete them from datacore. var/target_ref = WEAKREF(target) diff --git a/code/defines/procs/records.dm b/code/defines/procs/records.dm index 33a11e98cfaf..c0151ad6eb3e 100644 --- a/code/defines/procs/records.dm +++ b/code/defines/procs/records.dm @@ -15,7 +15,7 @@ general_record.fields["faction"] = "Unknown" general_record.fields["mob_faction"] = "Unknown" general_record.fields["religion"] = "Unknown" - GLOB.data_core.general += general_record + GLOB.data_core.manifest_inject_general_record(general_record) return general_record /proc/CreateSecurityRecord(name as text, id as text) @@ -24,7 +24,7 @@ security_record.fields["id"] = id security_record.name = text("Security Record #[id]") security_record.fields["incidents"] = "None" - GLOB.data_core.security += security_record + GLOB.data_core.manifest_inject_security_record(security_record) return security_record /proc/create_medical_record(mob/living/carbon/human/person) @@ -46,5 +46,5 @@ medical_record.fields["autodoc_data"] = list() medical_record.fields["autodoc_manual"] = list() medical_record.fields["ref"] = WEAKREF(person) - GLOB.data_core.medical += medical_record + GLOB.data_core.manifest_inject_medical_record(medical_record) return medical_record diff --git a/code/game/jobs/role_authority.dm b/code/game/jobs/role_authority.dm index 99a08e18365c..f87424dccf12 100644 --- a/code/game/jobs/role_authority.dm +++ b/code/game/jobs/role_authority.dm @@ -655,10 +655,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 + GLOB.data_core.manifest_modify(ref=marine_ref, squad_name=new_squad.name) transfer_marine.hud_set_squad() diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index fc22c50d2c53..e2afdf8a6256 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -13,8 +13,8 @@ var/authenticated = null var/rank = null var/screen = null - var/datum/data/record/active1 = null - var/datum/data/record/active2 = null + var/datum/data/record/selected_general = null + var/datum/data/record/selected_medical = null var/a_id = null var/temp = null var/printing = null @@ -79,26 +79,26 @@ 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))) + if ((istype(selected_general, /datum/data/record) && GLOB.data_core.general.Find(selected_general))) 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"]]
\ + dat += "
Name: [selected_general.fields["name"]] \ + ID: [selected_general.fields["id"]]
\n \ + Sex: [selected_general.fields["sex"]]
\n \ + Age: [selected_general.fields["age"]]
\n \ + Physical Status: [selected_general.fields["p_stat"]]
\n \ + Mental Status: [selected_general.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

" + if ((istype(src.selected_medical, /datum/data/record) && GLOB.data_core.medical.Find(src.selected_medical))) + dat += "
\n
Medical Data

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

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

", active2.fields[current_index], src, counter) + if(findtext(selected_medical.fields[current_index], "
")) + dat += text("[]
Delete Entry

", selected_medical.fields[current_index], src, counter) else - dat += text("[]

", active2.fields[current_index]) + dat += text("[]

", selected_medical.fields[current_index]) counter++ dat += text("Add Entry

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

", src) @@ -137,11 +137,11 @@ if(..()) return - if (!( GLOB.data_core.general.Find(src.active1) )) - src.active1 = null + if (!( GLOB.data_core.general.Find(src.selected_general) )) + src.selected_general = null - if (!( GLOB.data_core.medical.Find(src.active2) )) - src.active2 = null + if (!( GLOB.data_core.medical.Find(src.selected_medical) )) + src.selected_medical = null if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (isRemoteControlling(usr))) usr.set_interaction(src) @@ -174,21 +174,21 @@ else if (href_list["logout"]) src.authenticated = null src.screen = null - src.active1 = null - src.active2 = null + src.selected_general = null + src.selected_medical = null else if (href_list["login"]) if (isRemoteControlling(usr)) - src.active1 = null - src.active2 = null + src.selected_general = null + src.selected_medical = 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 + src.selected_general = null + src.selected_medical = null if (src.check_access(src.scan)) src.authenticated = src.scan.registered_name @@ -202,8 +202,8 @@ if(src.screen < 1) src.screen = 1 - src.active1 = null - src.active2 = null + src.selected_general = null + src.selected_medical = null if (href_list["del_all"]) src.temp = text("Are you sure you wish to delete all records?
\n\tYes
\n\tNo
", src, src) @@ -213,153 +213,167 @@ temp = "All records deleted." if (href_list["field"]) - var/a1 = active1 - var/a2 = active2 + var/a1 = selected_general + var/a2 = selected_medical switch(href_list["field"]) if("sex") - if (istype(active1, /datum/data/record)) + if (istype(selected_general, /datum/data/record)) var/new_value = "Male" - if (active1.fields["sex"] == "Male") + if (selected_general.fields["sex"] == "Male") new_value = "Female" - active1.fields["sex"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record sex for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["sex"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] set the medical record sex for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("age") - if (istype(active1, /datum/data/record)) - var/new_value = input("Please input age:", "Med. records", active1.fields["age"], null) as num - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active1 != a1)) + if (istype(selected_general, /datum/data/record)) + var/new_value = input("Please input age:", "Med. records", selected_general.fields["age"], null) as num + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_general != a1)) return - active1.fields["age"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record age for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["age"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] set the medical record age for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("mi_dis") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please input minor disabilities list:", "Med. records", active2.fields["mi_dis"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please input minor disabilities list:", "Med. records", selected_medical.fields["mi_dis"], null) as text)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["mi_dis"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record minor disabilities list for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["mi_dis"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record minor disabilities list for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("mi_dis_d") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please summarize minor dis.:", "Med. records", active2.fields["mi_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please summarize minor dis.:", "Med. records", selected_medical.fields["mi_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["mi_dis_d"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record minor disabilities desc for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["mi_dis_d"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record minor disabilities desc for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("ma_dis") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please input major diabilities list:", "Med. records", active2.fields["ma_dis"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please input major diabilities list:", "Med. records", selected_medical.fields["ma_dis"], null) as text)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["ma_dis"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record major disabilities list for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["ma_dis"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record major disabilities list for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("ma_dis_d") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please summarize major dis.:", "Med. records", active2.fields["ma_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please summarize major dis.:", "Med. records", selected_medical.fields["ma_dis_d"], null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["ma_dis_d"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record major disabilities desc for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["ma_dis_d"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record major disabilities desc for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("alg") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please state allergies:", "Med. records", active2.fields["alg"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please state allergies:", "Med. records", selected_medical.fields["alg"], null) as text)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["alg"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record allergies list for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["alg"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record allergies list for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("alg_d") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please summarize allergies:", "Med. records", active2.fields["alg_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please summarize allergies:", "Med. records", selected_medical.fields["alg_d"], null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["alg_d"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record allergies desc for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["alg_d"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record allergies desc for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("cdi") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please state diseases:", "Med. records", active2.fields["cdi"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please state diseases:", "Med. records", selected_medical.fields["cdi"], null) as text)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["cdi"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record disabilities list for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["cdi"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record disabilities list for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("cdi_d") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please summarize diseases:", "Med. records", active2.fields["cdi_d"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please summarize diseases:", "Med. records", selected_medical.fields["cdi_d"], null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["cdi_d"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record disabilities desc for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["cdi_d"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record disabilities desc for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("notes") - if (istype(active2, /datum/data/record)) - var/new_value = copytext(html_encode(trim(input("Please summarize notes:", "Med. records", html_decode(active2.fields["notes"]), null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if (istype(selected_medical, /datum/data/record)) + var/new_value = copytext(html_encode(trim(input("Please summarize notes:", "Med. records", html_decode(selected_medical.fields["notes"]), null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return - active2.fields["notes"] = new_value - msg_admin_niche("[key_name_admin(usr)] set the medical record notes for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_medical.fields["notes"] = new_value + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record notes for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("p_stat") - if (istype(active1, /datum/data/record)) + if (istype(selected_general, /datum/data/record)) 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(active1, /datum/data/record)) + if (istype(selected_general, /datum/data/record)) temp = text("Mental Condition:
\n\t*Insane*
\n\t*Unstable*
\n\t*Watch*
\n\tStable
", src, src, src, src) if("b_type") - if (istype(active2, /datum/data/record)) + if (istype(selected_medical, /datum/data/record)) 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(istype(active1, /datum/data/record)) + if(istype(selected_general, /datum/data/record)) switch(href_list["p_stat"]) if("deceased") - active1.fields["p_stat"] = "*Deceased*" + selected_general.fields["p_stat"] = "*Deceased*" if("ssd") - active1.fields["p_stat"] = "*SSD*" + selected_general.fields["p_stat"] = "*SSD*" if("active") - active1.fields["p_stat"] = "Active" + selected_general.fields["p_stat"] = "Active" if("unfit") - active1.fields["p_stat"] = "Physically Unfit" + selected_general.fields["p_stat"] = "Physically Unfit" if("disabled") - active1.fields["p_stat"] = "Disabled" - msg_admin_niche("[key_name_admin(usr)] set the medical record physical state for [active1.fields["name"]] ([active1.fields["id"]]) to [href_list["p_stat"]].") + selected_general.fields["p_stat"] = "Disabled" + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] set the medical record physical state for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [href_list["p_stat"]].") if (href_list["m_stat"]) - if(istype(active1, /datum/data/record)) + if(istype(selected_general, /datum/data/record)) switch(href_list["m_stat"]) if("insane") - active1.fields["m_stat"] = "*Insane*" + selected_general.fields["m_stat"] = "*Insane*" if("unstable") - active1.fields["m_stat"] = "*Unstable*" + selected_general.fields["m_stat"] = "*Unstable*" if("watch") - active1.fields["m_stat"] = "*Watch*" + selected_general.fields["m_stat"] = "*Watch*" if("stable") - active1.fields["m_stat"] = "Stable" - msg_admin_niche("[key_name_admin(usr)] set the medical record mental state for [active1.fields["name"]] ([active1.fields["id"]]) to [href_list["m_stat"]].") + selected_general.fields["m_stat"] = "Stable" + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] set the medical record mental state for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [href_list["m_stat"]].") if (href_list["b_type"]) - if(istype(active2, /datum/data/record)) + if(istype(selected_medical, /datum/data/record)) switch(href_list["b_type"]) if("an") - active2.fields["b_type"] = "A-" + selected_medical.fields["b_type"] = "A-" if("bn") - active2.fields["b_type"] = "B-" + selected_medical.fields["b_type"] = "B-" if("abn") - active2.fields["b_type"] = "AB-" + selected_medical.fields["b_type"] = "AB-" if("on") - active2.fields["b_type"] = "O-" + selected_medical.fields["b_type"] = "O-" if("ap") - active2.fields["b_type"] = "A+" + selected_medical.fields["b_type"] = "A+" if("bp") - active2.fields["b_type"] = "B+" + selected_medical.fields["b_type"] = "B+" if("abp") - active2.fields["b_type"] = "AB+" + selected_medical.fields["b_type"] = "AB+" if("op") - active2.fields["b_type"] = "O+" - msg_admin_niche("[key_name_admin(usr)] set the medical record blood type for [active1.fields["name"]] ([active1.fields["id"]]) to [active2.fields["b_type"]].") + selected_medical.fields["b_type"] = "O+" + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] set the medical record blood type for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [selected_medical.fields["b_type"]].") if (href_list["del_r"]) - if(istype(active2, /datum/data/record)) + if(istype(selected_medical, /datum/data/record)) 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"]) - msg_admin_niche("[key_name_admin(usr)] deleted the medical record for [active1.fields["name"]] ([active1.fields["id"]]).") - QDEL_NULL(active2) + msg_admin_niche("[key_name_admin(usr)] deleted the medical record for [selected_general.fields["name"]] ([selected_general.fields["id"]]).") + QDEL_NULL(selected_medical) if (href_list["d_rec"]) var/datum/data/record/R = locate(href_list["d_rec"]) @@ -370,15 +384,15 @@ 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.selected_general = R + src.selected_medical = M src.screen = 4 if (href_list["new"]) - if ((istype(src.active1, /datum/data/record) && !( istype(src.active2, /datum/data/record) ))) + if ((istype(src.selected_general, /datum/data/record) && !( istype(src.selected_medical, /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.fields["name"] = src.selected_general.fields["name"] + R.fields["id"] = src.selected_general.fields["id"] R.name = text("Medical Record #[]", R.fields["id"]) R.fields["b_type"] = "Unknown" R.fields["mi_dis"] = "None" @@ -391,43 +405,45 @@ R.fields["cdi_d"] = "No diseases have been diagnosed at the moment." R.fields["notes"] = "No notes." GLOB.data_core.manifest_inject_medical_record(R) - src.active2 = R + src.selected_medical = R src.screen = 4 if (href_list["add_c"]) - if (!( istype(active2, /datum/data/record) )) + if (!( istype(selected_medical, /datum/data/record) )) return - var/a2 = active2 + var/a2 = selected_medical var/new_value = copytext(trim(strip_html(input("Add Comment:", "Med. records", null, null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active2 != a2)) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_medical != a2)) return var/counter = 1 - while(active2.fields[text("com_[]", counter)]) + while(selected_medical.fields[text("com_[]", counter)]) counter++ - active2.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]
[new_value]") - msg_admin_niche("[key_name_admin(usr)] added a medical comment for [active1.fields["name"]] ([active1.fields["id"]]): [new_value].") + selected_medical.fields[text("com_[counter]")] = text("Made by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]
[new_value]") + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] added a medical comment for [selected_general.fields["name"]] ([selected_general.fields["id"]]): [new_value].") if (href_list["del_c"]) - if ((istype(active2, /datum/data/record) && active2.fields[text("com_[]", href_list["del_c"])])) - msg_admin_niche("[key_name_admin(usr)] deleted a medical comment for [active1.fields["name"]] ([active1.fields["id"]]): [active2.fields[text("com_[]", href_list["del_c"])]].") - active2.fields[text("com_[]", href_list["del_c"])] = text("Deleted entry by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]") + if ((istype(selected_medical, /datum/data/record) && selected_medical.fields[text("com_[]", href_list["del_c"])])) + selected_medical.fields[text("com_[]", href_list["del_c"])] = text("Deleted entry by [authenticated] ([rank]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]") + GLOB.data_core.manifest_updated_medical_record(selected_medical) + msg_admin_niche("[key_name_admin(usr)] deleted a medical comment for [selected_general.fields["name"]] ([selected_general.fields["id"]]): [selected_medical.fields[text("com_[]", href_list["del_c"])]].") 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 + src.selected_general = null + src.selected_medical = 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) + src.selected_medical = R + if (!selected_medical) temp = "Could not locate record [t1]." 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 + if ((E.fields["name"] == src.selected_medical.fields["name"] || E.fields["id"] == src.selected_medical.fields["id"])) + src.selected_general = E src.screen = 4 if (href_list["print_p"]) @@ -435,10 +451,10 @@ 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 + if ((istype(src.selected_general, /datum/data/record) && GLOB.data_core.general.Find(src.selected_general))) + record1 = selected_general + if ((istype(src.selected_medical, /datum/data/record) && GLOB.data_core.medical.Find(src.selected_medical))) + record2 = selected_medical playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) sleep(40) var/obj/item/paper/P = new /obj/item/paper( src.loc ) @@ -465,8 +481,8 @@ 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 ((istype(src.selected_general, /datum/data/record) && GLOB.data_core.general.Find(src.selected_general))) + record = selected_general if(!record) return playsound(src.loc, 'sound/machines/fax.ogg', 15, 1) sleep(40) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index 64a5b62a26d0..63539797dc6f 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -10,8 +10,8 @@ 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/datum/data/record/selected_general = null + var/datum/data/record/selected_security = null var/a_id = null var/temp = null var/printing = null @@ -114,31 +114,31 @@ dat += "
Delete All Records

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

" - if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) + if ((istype(selected_general, /datum/data/record) && GLOB.data_core.general.Find(selected_general))) dat += text(" \ + Name: [selected_general.fields["name"]]
\ + ID: [selected_general.fields["id"]]
\n \ + Sex: [selected_general.fields["sex"]]
\n \ + Age: [selected_general.fields["age"]]
\n \ + Rank: [selected_general.fields["rank"]]
\n \ + Physical Status: [selected_general.fields["p_stat"]]
\n \ + Mental Status: [selected_general.fields["m_stat"]]
\
\ - 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))) + if ((istype(selected_security, /datum/data/record) && GLOB.data_core.security.Find(selected_security))) dat += text("
\n
Security Data

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

", \ - src, active2.fields["criminal"]) - if(islist(active2.fields["comments"])) + src, selected_security.fields["criminal"]) + if(islist(selected_security.fields["comments"])) var/counter = 1 - for(var/com_i in active2.fields["comments"]) - var/comment = active2.fields["comments"][com_i] + for(var/com_i in selected_security.fields["comments"]) + var/comment = selected_security.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) @@ -213,10 +213,10 @@ 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 (!( GLOB.data_core.general.Find(selected_general) )) + selected_general = null + if (!( GLOB.data_core.security.Find(selected_security) )) + selected_security = null if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (isSilicon(usr))) usr.set_interaction(src) switch(href_list["choice"]) @@ -238,8 +238,8 @@ What a mess.*/ if ("Return") screen = 1 - active1 = null - active2 = null + selected_general = null + selected_security = null if("read_fingerprint") screen = 5 @@ -290,8 +290,8 @@ What a mess.*/ if("Record Maintenance") screen = 2 - active1 = null - active2 = null + selected_general = null + selected_security = null if ("Browse Record") var/datum/data/record/R = locate(href_list["d_rec"]) @@ -302,8 +302,8 @@ What a mess.*/ 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 + selected_general = R + selected_security = S screen = 3 @@ -312,10 +312,10 @@ What a mess.*/ 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 + if ((istype(selected_general, /datum/data/record) && GLOB.data_core.general.Find(selected_general))) + record1 = selected_general + if ((istype(selected_security, /datum/data/record) && GLOB.data_core.security.Find(selected_security))) + record2 = selected_security sleep(50) var/obj/item/paper/P = new /obj/item/paper( loc ) P.info = "
Security Record

" @@ -355,80 +355,83 @@ What a mess.*/ temp = "All Security records deleted." if ("Add Entry") - if (!(istype(active2, /datum/data/record))) + if (!(istype(selected_security, /datum/data/record))) return - var/a2 = active2 + var/a2 = selected_security var/new_value = 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((!new_value || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isSilicon(usr))) || active2 != a2)) + if((!new_value || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isSilicon(usr))) || selected_security != a2)) return var/created_at = text("[]  []  []", time2text(world.realtime, "MMM DD"), time2text(world.time, "[worldtime2text()]:ss"), GLOB.game_year) var/new_comment = list("entry" = new_value, "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) + if(!islist(selected_security.fields["comments"])) + selected_security.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"])) - msg_admin_niche("[key_name_admin(usr)] added a security comment for [active1.fields["name"]] ([active1.fields["id"]]): [new_value].") + var/new_com_i = length(selected_security.fields["comments"]) + 1 + selected_security.fields["comments"]["[new_com_i]"] = new_comment + to_chat(usr, text("You have added a new comment to the Security Record of [].", selected_security.fields["name"])) + msg_admin_niche("[key_name_admin(usr)] added a security comment for [selected_general.fields["name"]] ([selected_general.fields["id"]]): [new_value].") if ("Delete Entry") - if(!islist(active2.fields["comments"])) + if(!islist(selected_security.fields["comments"])) return - if(active2.fields["comments"][href_list["del_c"]]) - var/updated_comments = active2.fields["comments"] + if(selected_security.fields["comments"][href_list["del_c"]]) + var/updated_comments = selected_security.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"])) + selected_security.fields["comments"] = updated_comments + to_chat(usr, text("You have deleted a comment from the Security Record of [].", selected_security.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"]) + if ((istype(selected_general, /datum/data/record) && !( istype(selected_security, /datum/data/record) ))) + selected_security = CreateSecurityRecord(selected_general.fields["name"], selected_general.fields["id"]) screen = 3 if ("New Record (General)") - active1 = CreateGeneralRecord() - active2 = null + selected_general = CreateGeneralRecord() + selected_security = null //FIELD FUNCTIONS if ("Edit Field") if (is_not_allowed(usr)) return - var/a1 = active1 + var/a1 = selected_general switch(href_list["field"]) if("name") - if (istype(active1, /datum/data/record)) - var/new_value = reject_bad_name(input(usr, "Please input name:", "Secure. records", active1.fields["name"]) as text|null) - if (!new_value || active1 != a1) + if (istype(selected_general, /datum/data/record)) + var/new_value = reject_bad_name(input(usr, "Please input name:", "Secure. records", selected_general.fields["name"]) as text|null) + if (!new_value || selected_general != a1) return - message_admins("[key_name(usr)] changed the security record name of [active1.fields["name"]] to [new_value]") - active1.fields["name"] = new_value + selected_general.fields["name"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + message_admins("[key_name(usr)] changed the security record name of [selected_general.fields["name"]] to [new_value]") if("sex") - if (istype(active1, /datum/data/record)) + if (istype(selected_general, /datum/data/record)) var/new_value = "Male" - if (active1.fields["sex"] == "Male") + if (selected_general.fields["sex"] == "Male") new_value = "Female" - active1.fields["sex"] = new_value - msg_admin_niche("[key_name(usr)] changed the security record sex of [active1.fields["name"]] to [new_value]") + selected_general.fields["sex"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name(usr)] changed the security record sex of [selected_general.fields["name"]] to [new_value]") if("age") - if (istype(active1, /datum/data/record)) - var/new_value = input("Please input age:", "Secure. records", active1.fields["age"], null) as num - if (!new_value || active1 != a1) + if (istype(selected_general, /datum/data/record)) + var/new_value = input("Please input age:", "Secure. records", selected_general.fields["age"], null) as num + if (!new_value || selected_general != a1) return - active1.fields["age"] = new_value - msg_admin_niche("[key_name(usr)] changed the security record age of [active1.fields["name"]] to [new_value]") + selected_general.fields["age"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name(usr)] changed the security record age of [selected_general.fields["name"]] to [new_value]") if("criminal") - if (istype(active2, /datum/data/record)) + if (istype(selected_security, /datum/data/record)) temp = "
Criminal Status:
" temp += "
    " temp += "
  • None
  • " @@ -441,7 +444,7 @@ What a mess.*/ 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)) + if (istype(selected_general, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) temp = "
    Occupation:
    " temp += "
      " for(var/rank in GLOB.joblist) @@ -451,12 +454,13 @@ What a mess.*/ alert(usr, "You do not have the required rank to do this!") if("species") - if (istype(active1, /datum/data/record)) - var/new_value = copytext(trim(strip_html(input("Please enter race:", "General records", active1.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) - if (!new_value || active1 != a1) + if (istype(selected_general, /datum/data/record)) + var/new_value = copytext(trim(strip_html(input("Please enter race:", "General records", selected_general.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) + if (!new_value || selected_general != a1) return - active1.fields["species"] = new_value - msg_admin_niche("[key_name(usr)] changed the security record species of [active1.fields["name"]] to [new_value]") + selected_general.fields["species"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name(usr)] changed the security record species of [selected_general.fields["name"]] to [new_value]") //TEMPORARY MENU FUNCTIONS @@ -464,34 +468,41 @@ What a mess.*/ temp=null switch(href_list["choice"]) if ("Change Rank") - if(istype(active1, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) + if(istype(selected_general, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) var/new_value = href_list["rank"] - active1.fields["rank"] = new_value + selected_general.fields["rank"] = new_value if(new_value in GLOB.joblist) - active1.fields["real_rank"] = new_value - message_admins("[key_name(usr)] changed the security record sex of [active1.fields["name"]] to [new_value]") + selected_general.fields["real_rank"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + message_admins("[key_name(usr)] changed the security record sex of [selected_general.fields["name"]] to [new_value]") if ("Change Criminal Status") - if(istype(active2, /datum/data/record)) + if(istype(selected_security, /datum/data/record)) var/new_value = href_list["criminal2"] switch(new_value) if("none") - active2.fields["criminal"] = "None" + selected_security.fields["criminal"] = "None" if("arrest") - active2.fields["criminal"] = "*Arrest*" + selected_security.fields["criminal"] = "*Arrest*" if("incarcerated") - active2.fields["criminal"] = "Incarcerated" + selected_security.fields["criminal"] = "Incarcerated" if("released") - active2.fields["criminal"] = "Released" + selected_security.fields["criminal"] = "Released" if("suspect") - active2.fields["criminal"] = "Suspect" + selected_security.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() - - message_admins("[key_name(usr)] changed the security record criminal status of [active1.fields["name"]] to [new_value]") + selected_security.fields["criminal"] = "NJP" + + // try and avoid looping over every single human mob just for a sec status update + var/datum/weakref/criminal_ref = selected_security["ref"] + var/mob/living/carbon/human/criminal = criminal_ref.resolve() + if(criminal) + criminal.sec_hud_set_security_status() + else // safety fallback + for(var/mob/living/carbon/human/H in GLOB.human_mob_list) + H.sec_hud_set_security_status() + GLOB.data_core.manifest_updated_security_record(selected_security) + message_admins("[key_name(usr)] changed the security record criminal status of [selected_general.fields["name"]] to [new_value]") add_fingerprint(usr) updateUsrDialog() diff --git a/code/game/machinery/computer/sentencing.dm b/code/game/machinery/computer/sentencing.dm index a3ef1ccd73d4..1babcf37ee00 100644 --- a/code/game/machinery/computer/sentencing.dm +++ b/code/game/machinery/computer/sentencing.dm @@ -205,7 +205,7 @@ found_record.fields["incident"] += "
      \ Crime: [incident.charges_to_string()].
      \ Notes: [incident.notes].
      " - + GLOB.data_core.manifest_updated_security_record(found_record) break var/obj/item/paper/incident/paper = new /obj/item/paper/incident(loc) diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index 4e7e701e0796..cb3e495b00aa 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -10,7 +10,7 @@ var/authenticated = null var/rank = null var/screen = null - var/datum/data/record/active1 = null + var/datum/data/record/selected_general = null var/a_id = null var/temp = null var/printing = null @@ -81,16 +81,16 @@ dat += "
      Delete All Records

      Back" if(3.0) dat += "
      Employment Record

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

      \n \ + Employment/skills summary:
      [decode(selected_general.fields["notes"])]
      \
      \ - 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"]]

      \n \ - Employment/skills summary:
      [decode(active1.fields["notes"])]
      Photo:
      \
      " else @@ -138,8 +138,8 @@ What a mess.*/ /obj/structure/machinery/computer/skills/Topic(href, href_list) if(..()) return - if (!( GLOB.data_core.general.Find(active1) )) - active1 = null + if (!( GLOB.data_core.general.Find(selected_general) )) + selected_general = null if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (isRemoteControlling(usr))) usr.set_interaction(src) switch(href_list["choice"]) @@ -161,7 +161,7 @@ What a mess.*/ if ("Return") screen = 1 - active1 = null + selected_general = null if("Confirm Identity") if (scan) @@ -180,16 +180,16 @@ What a mess.*/ if("Log Out") authenticated = null screen = null - active1 = null + selected_general = null if("Log In") if (isRemoteControlling(usr)) - src.active1 = null + src.selected_general = null src.authenticated = usr.name src.rank = "AI" src.screen = 1 else if (istype(scan, /obj/item/card/id)) - active1 = null + selected_general = null if(check_access(scan)) authenticated = scan.registered_name rank = scan.paygrade @@ -221,7 +221,7 @@ What a mess.*/ if("Record Maintenance") screen = 2 - active1 = null + selected_general = null if ("Browse Record") var/datum/data/record/R = locate(href_list["d_rec"]) @@ -229,7 +229,7 @@ What a mess.*/ temp = "Record Not Found!" else for(var/datum/data/record/E in GLOB.data_core.security) - active1 = R + selected_general = R screen = 3 if ("Print Record") @@ -238,9 +238,9 @@ What a mess.*/ sleep(50) var/obj/item/paper/P = new /obj/item/paper( loc ) P.info = "
      Employment Record

      " - if ((istype(active1, /datum/data/record) && GLOB.data_core.general.Find(active1))) - P.info += "Name: [active1.fields["name"]] ID: [active1.fields["id"]]
      \nSex: [active1.fields["sex"]]
      \nAge: [active1.fields["age"]]
      \nPhysical Status: [active1.fields["p_stat"]]
      \nMental Status: [active1.fields["m_stat"]]
      \nEmployment/Skills Summary:
      \n[decode(active1.fields["notes"])]
      " - P.name = "Employment Record ([active1.fields["name"]])" + if ((istype(selected_general, /datum/data/record) && GLOB.data_core.general.Find(selected_general))) + P.info += "Name: [selected_general.fields["name"]] ID: [selected_general.fields["id"]]
      \nSex: [selected_general.fields["sex"]]
      \nAge: [selected_general.fields["age"]]
      \nPhysical Status: [selected_general.fields["p_stat"]]
      \nMental Status: [selected_general.fields["m_stat"]]
      \nEmployment/Skills Summary:
      \n[decode(selected_general.fields["notes"])]
      " + P.name = "Employment Record ([selected_general.fields["name"]])" else P.info += "General Record Lost!
      " P.name = "Employment Record (???)" @@ -259,52 +259,56 @@ What a mess.*/ temp = "All Employment records deleted." if ("Delete Record (ALL)") - if(istype(active1, /datum/data/record)) + if(istype(selected_general, /datum/data/record)) temp = "
      Are you sure you wish to delete the record (ALL)?
      " temp += "Yes
      " temp += "No" //RECORD CREATE if ("New Record (General)") - active1 = CreateGeneralRecord() + selected_general = CreateGeneralRecord() //FIELD FUNCTIONS if ("Edit Field") - var/a1 = active1 + var/a1 = selected_general switch(href_list["field"]) if("name") - if (istype(active1, /datum/data/record)) - var/new_value = reject_bad_name(input("Please input name:", "Secure. records", active1.fields["name"], null) as text) - if ((!( new_value ) || !length(trim(new_value)) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr)))) || active1 != a1) + if (istype(selected_general, /datum/data/record)) + var/new_value = reject_bad_name(input("Please input name:", "Secure. records", selected_general.fields["name"], null) as text) + if ((!( new_value ) || !length(trim(new_value)) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr)))) || selected_general != a1) return - message_admins("[key_name(usr)] changed the employment record name of [active1.fields["name"]] to [new_value]") - active1.fields["name"] = new_value + selected_general.fields["name"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + message_admins("[key_name(usr)] changed the employment record name of [selected_general.fields["name"]] to [new_value]") if("id") - if (istype(active1, /datum/data/record)) - var/new_value = copytext(trim(sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active1 != a1)) + if (istype(selected_general, /datum/data/record)) + var/new_value = copytext(trim(sanitize(input("Please input id:", "Secure. records", selected_general.fields["id"], null) as text)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_general != a1)) return - msg_admin_niche("[key_name_admin(usr)] changed the employment record id for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") - active1.fields["id"] = new_value + selected_general.fields["id"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] changed the employment record id for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("sex") - if (istype(active1, /datum/data/record)) + if (istype(selected_general, /datum/data/record)) var/new_value = "Male" - if (active1.fields["sex"] == "Male") + if (selected_general.fields["sex"] == "Male") new_value = "Female" - active1.fields["sex"] = new_value - msg_admin_niche("[key_name_admin(usr)] changed the employment record sex for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["sex"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] changed the employment record sex for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("age") - if (istype(active1, /datum/data/record)) - var/new_value = input("Please input age:", "Secure. records", active1.fields["age"], null) as num - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active1 != a1)) + if (istype(selected_general, /datum/data/record)) + var/new_value = input("Please input age:", "Secure. records", selected_general.fields["age"], null) as num + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_general != a1)) return - active1.fields["age"] = new_value - msg_admin_niche("[key_name_admin(usr)] changed the employment record age for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["age"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] changed the employment record age for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if("rank") - if(istype(active1, /datum/data/record)) + if(istype(selected_general, /datum/data/record)) //This was so silly before the change. Now it actually works without beating your head against the keyboard. /N if(GLOB.uscm_highcom_paygrades.Find(rank)) temp = "
      Occupation:
      " @@ -316,28 +320,30 @@ What a mess.*/ alert(usr, "You do not have the required rank to do this!") if("species") - if (istype(active1, /datum/data/record)) - var/new_value = copytext(trim(sanitize(input("Please enter race:", "General records", active1.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) - if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || active1 != a1)) + if (istype(selected_general, /datum/data/record)) + var/new_value = copytext(trim(sanitize(input("Please enter race:", "General records", selected_general.fields["species"], null) as message)),1,MAX_MESSAGE_LEN) + if ((!( new_value ) || !( authenticated ) || usr.stat || usr.is_mob_restrained() || (!in_range(src, usr) && (!isRemoteControlling(usr))) || selected_general != a1)) return - active1.fields["species"] = new_value - msg_admin_niche("[key_name_admin(usr)] changed the employment record species for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["species"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + msg_admin_niche("[key_name_admin(usr)] changed the employment record species for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") //TEMPORARY MENU FUNCTIONS else//To properly clear as per clear screen. temp=null switch(href_list["choice"]) if ("Change Rank") - if(istype(active1, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) + if(istype(selected_general, /datum/data/record) && GLOB.uscm_highcom_paygrades.Find(rank)) var/new_value = href_list["rank"] - active1.fields["rank"] = new_value + selected_general.fields["rank"] = new_value if(new_value in GLOB.joblist) - active1.fields["real_rank"] = new_value - message_admins("[key_name_admin(usr)] changed the employment record rank for [active1.fields["name"]] ([active1.fields["id"]]) to [new_value].") + selected_general.fields["real_rank"] = new_value + GLOB.data_core.manifest_updated_general_record(selected_general) + message_admins("[key_name_admin(usr)] changed the employment record rank for [selected_general.fields["name"]] ([selected_general.fields["id"]]) to [new_value].") if ("Delete Record (ALL) Execute") - GLOB.data_core.manifest_delete_medical_record(active1) - active1 = null + GLOB.data_core.manifest_delete_medical_record(selected_general) + selected_general = null else temp = "This function does not appear to be working at the moment. Our apologies." diff --git a/code/game/machinery/medical_pod/bodyscanner.dm b/code/game/machinery/medical_pod/bodyscanner.dm index cede827c9dfa..19ba8e5c56bc 100644 --- a/code/game/machinery/medical_pod/bodyscanner.dm +++ b/code/game/machinery/medical_pod/bodyscanner.dm @@ -158,36 +158,37 @@ return var/mob/living/carbon/human/H = connected.occupant - var/datum/data/record/N = null + var/datum/data/record/occupant_medical_record = 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 - if(isnull(N)) - N = create_medical_record(H) + occupant_medical_record = R + if(isnull(occupant_medical_record)) + occupant_medical_record = 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"] + occupant_medical_record.fields["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 + occupant_medical_record.fields["last_scan_result"] = dat if (!last_health_display) last_health_display = new(H) else 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) + occupant_medical_record.fields["last_tgui_scan_result"] = last_health_display.ui_data(user, DETAIL_LEVEL_BODYSCAN) + occupant_medical_record.fields["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) last_health_display.look_at(user, DETAIL_LEVEL_BODYSCAN, bypass_checks = TRUE) + GLOB.data_core.manifest_updated_medical_record(occupant_medical_record) return /obj/structure/machinery/medical_pod/bodyscanner/proc/get_occupant_data() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7235e03c26cb..86ead85d6465 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -521,6 +521,7 @@ R.fields["criminal"] = setcriminal modified = 1 sec_hud_set_security_status() + GLOB.data_core.manifest_updated_security_record(R) if(!modified) @@ -611,6 +612,7 @@ else var/new_com_i = length(R.fields["comments"]) + 1 R.fields["comments"]["[new_com_i]"] = new_comment + GLOB.data_core.manifest_updated_security_record(R) to_chat(usr, "You have added a new comment to the Security Record of [R.fields["name"]]. \[View Comment Log\]") if(href_list["medical"]) @@ -626,7 +628,7 @@ 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) + for(var/datum/data/record/R in GLOB.data_core.general) //should this be medical??? 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")) @@ -635,7 +637,7 @@ if(setmedical != "Cancel") R.fields["p_stat"] = setmedical modified = 1 - + GLOB.data_core.manifest_updated_general_record(R) spawn() if(istype(usr,/mob/living/carbon/human)) var/mob/living/carbon/human/U = usr @@ -723,6 +725,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]") + GLOB.data_core.manifest_updated_medical_record(R) if(href_list["medholocard"]) change_holo_card(usr) From 25408aa5da9cba7ea6323a1e79f6f11d02895592 Mon Sep 17 00:00:00 2001 From: spookydonut Date: Thu, 23 Jan 2025 20:07:38 +0800 Subject: [PATCH 3/4] fields --- 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 63539797dc6f..43d16df58e58 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -494,7 +494,7 @@ What a mess.*/ selected_security.fields["criminal"] = "NJP" // try and avoid looping over every single human mob just for a sec status update - var/datum/weakref/criminal_ref = selected_security["ref"] + var/datum/weakref/criminal_ref = selected_security.fields["ref"] var/mob/living/carbon/human/criminal = criminal_ref.resolve() if(criminal) criminal.sec_hud_set_security_status() From 735cec114e72e4f2eb5c9635cba9c5ffa2b7dde2 Mon Sep 17 00:00:00 2001 From: spookydonut Date: Sat, 25 Jan 2025 16:06:17 +0800 Subject: [PATCH 4/4] No this is correct --- code/modules/mob/living/carbon/human/human.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 86ead85d6465..3b578be020f6 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -628,7 +628,7 @@ 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) //should this be medical??? + 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"))