From 4f138abfcc9a9692cf6a6c0f1590e8a24460ab28 Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 11 Jun 2017 18:19:00 -0400 Subject: [PATCH] Converts Resleeving Transcore to be a subsystem * Since the transcore has a ticker process, it really should be a subsystem. Converted it over. However, because its ticker is so fast, I did not bother implementing MC_TICK_CHECK into it. Therefore it has the SS_NO_TICK_CHECK flag. * Because its a subsystem, the global variable is now SStranscore instead of transcore. * Because subsystems are so easy to debug, I removed the "TC" debugging variable from the machines that used it. * Organized a few files. The transcore subsystem is in the subsystems folder. Defines had to be moved to defines folder so they are included first. --- code/__defines/misc_vr.dm | 5 + code/controllers/subsystems/transcore.dm | 133 ++++++++++++++++++ code/controllers/subsystems/transcore_vr.dm | 133 ++++++++++++++++++ code/game/machinery/cryopod.dm | 12 +- .../game/objects/items/devices/scanners_vr.dm | 4 +- code/modules/mob/dead/observer/free_vr.dm | 12 +- .../mob/living/carbon/human/life_vr.dm | 2 +- .../nifsoft/software/13_soulcatcher.dm | 6 +- code/modules/resleeving/_defines.dm | 3 - code/modules/resleeving/computers.dm | 16 +-- code/modules/resleeving/designer.dm | 6 +- code/modules/resleeving/implant.dm | 4 +- .../{infocore.dm => infocore_records.dm} | 113 +-------------- code/modules/resleeving/infomorph.dm | 8 +- vorestation.dme | 4 +- 15 files changed, 308 insertions(+), 153 deletions(-) create mode 100644 code/controllers/subsystems/transcore.dm create mode 100644 code/controllers/subsystems/transcore_vr.dm delete mode 100644 code/modules/resleeving/_defines.dm rename code/modules/resleeving/{infocore.dm => infocore_records.dm} (60%) diff --git a/code/__defines/misc_vr.dm b/code/__defines/misc_vr.dm index a3c4cf72d2..e47a6492eb 100644 --- a/code/__defines/misc_vr.dm +++ b/code/__defines/misc_vr.dm @@ -19,3 +19,8 @@ //For custom species #define STARTING_SPECIES_POINTS 1 #define MAX_SPECIES_TRAITS 5 + +// Resleeving Mind Record Status +#define MR_NORMAL 0 +#define MR_UNSURE 1 +#define MR_DEAD 2 diff --git a/code/controllers/subsystems/transcore.dm b/code/controllers/subsystems/transcore.dm new file mode 100644 index 0000000000..4663406485 --- /dev/null +++ b/code/controllers/subsystems/transcore.dm @@ -0,0 +1,133 @@ +//////////////////////////////// +//// Mind/body data storage system +//// for the resleeving tech +//////////////////////////////// + +SUBSYSTEM_DEF(transcore) + name = "Transcore" + priority = 20 + wait = 1 MINUTE + flags = SS_BACKGROUND|SS_NO_TICK_CHECK|SS_NO_INIT + runlevels = RUNLEVEL_GAME + + // THINGS + var/overdue_time = 15 MINUTES + var/core_dumped = FALSE // Core has been dumped! Also set can_fire = 0 when you set this. + + var/datum/transhuman/mind_record/list/backed_up = list() // All known mind records, indexed by MR.mindname/mind.name + var/datum/transhuman/mind_record/list/has_left = list() // Why do we even have this? + var/datum/transhuman/body_record/list/body_scans = list() // All known body records, indexed by BR.mydna.name + +/datum/controller/subsystem/transcore/fire() + for(var/N in backed_up) + var/datum/transhuman/mind_record/curr_MR = backed_up[N] + if(!curr_MR) + log_debug("Tried to process [N] in transcore w/o a record!") + continue + if(curr_MR.one_time) + continue + var/since_backup = world.time - curr_MR.last_update + if(since_backup < overdue_time) + curr_MR.dead_state = MR_NORMAL + else + if(curr_MR.dead_state != MR_DEAD) //First time switching to dead + notify(N) + curr_MR.dead_state = MR_DEAD + +/datum/controller/subsystem/transcore/stat_entry(msg) + if(core_dumped) + msg += "CORE DUMPED | " + msg += "MR: [backed_up.len] | BR: [body_scans.len]" + ..(msg) + +/datum/controller/subsystem/transcore/Recover() + if (istype(SStranscore.body_scans)) + for(var/N in SStranscore.body_scans[N]) + if(N) body_scans[N] = SStranscore.body_scans[N] + if(SStranscore.core_dumped) + core_dumped = TRUE + can_fire = FALSE + else if (istype(SStranscore.backed_up)) + for(var/N in SStranscore.backed_up[N]) + if(N) backed_up[N] = SStranscore.backed_up[N] + +/datum/controller/subsystem/transcore/proc/m_backup(var/datum/mind/mind, var/obj/item/device/nif/nif, var/one_time = FALSE) + ASSERT(mind) + if(!mind.name || core_dumped) + return 0 + + var/datum/transhuman/mind_record/MR + + if(mind.name in backed_up) + MR = backed_up[mind.name] + MR.last_update = world.time + MR.one_time = one_time + + //Pass a 0 to not change NIF status (because the elseif is checking for null) + if(nif) + MR.nif_path = nif.type + MR.nif_durability = nif.durability + var/list/nifsofts = list() + for(var/N in nif.nifsofts) + if(N) + var/datum/nifsoft/nifsoft = N + nifsofts += nifsoft.type + MR.nif_software = nifsofts + else if(isnull(nif)) //Didn't pass anything, so no NIF + MR.nif_path = null + MR.nif_durability = null + MR.nif_software = null + + else + MR = new(mind, mind.current, add_to_db = TRUE, one_time = one_time) + + return 1 + +// Send a past-due notification to the medical radio channel. +/datum/controller/subsystem/transcore/proc/notify(var/name) + ASSERT(name) + var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) + a.autosay("[name] is past-due for a mind backup. This will be the only notification.", "TransCore Oversight", "Medical") + qdel(a) + +// Called from mind_record to add itself to the transcore. +/datum/controller/subsystem/transcore/proc/add_backup(var/datum/transhuman/mind_record/MR) + ASSERT(MR) + backed_up[MR.mindname] = MR + backed_up = sortAssoc(backed_up) + log_debug("Added [MR.mindname] to transcore DB.") + +// Remove a mind_record from the backup-checking list. Keeps track of it in has_left // Why do we do that? ~Leshana +/datum/controller/subsystem/transcore/proc/stop_backup(var/datum/transhuman/mind_record/MR) + ASSERT(MR) + has_left[MR.mindname] = MR + backed_up.Remove("[MR.mindname]") + MR.cryo_at = world.time + log_debug("Put [MR.mindname] in transcore suspended DB.") + +// Called from body_record to add itself to the transcore. +/datum/controller/subsystem/transcore/proc/add_body(var/datum/transhuman/body_record/BR) + ASSERT(BR) + body_scans[BR.mydna.name] = BR + body_scans = sortAssoc(body_scans) + log_debug("Added [BR.mydna.name] to transcore body DB.") + +// Remove a body record from the database (Usually done when someone cryos) // Why? ~Leshana +/datum/controller/subsystem/transcore/proc/remove_body(var/datum/transhuman/body_record/BR) + ASSERT(BR) + body_scans.Remove("[BR.mydna.name]") + log_debug("Removed [BR.mydna.name] from transcore body DB.") + +// Moves all mind records from the databaes into the disk and shuts down all backup canary processing. +/datum/controller/subsystem/transcore/proc/core_dump(var/obj/item/weapon/disk/transcore/disk) + ASSERT(disk) + var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) + a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Command") + a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Medical") + qdel(a) + + disk.stored += backed_up + backed_up.Cut() + core_dumped = TRUE + can_fire = FALSE + return disk.stored.len diff --git a/code/controllers/subsystems/transcore_vr.dm b/code/controllers/subsystems/transcore_vr.dm new file mode 100644 index 0000000000..0de8a26d07 --- /dev/null +++ b/code/controllers/subsystems/transcore_vr.dm @@ -0,0 +1,133 @@ +//////////////////////////////// +//// Mind/body data storage system +//// for the resleeving tech +//////////////////////////////// + +SUBSYSTEM_DEF(transcore) + name = "Transcore" + priority = 20 + wait = 1 MINUTE + flags = SS_BACKGROUND|SS_NO_TICK_CHECK|SS_NO_INIT +// runlevels = RUNLEVEL_GAME + + // THINGS + var/overdue_time = 15 MINUTES + var/core_dumped = FALSE // Core has been dumped! Also set can_fire = 0 when you set this. + + var/datum/transhuman/mind_record/list/backed_up = list() // All known mind records, indexed by MR.mindname/mind.name + var/datum/transhuman/mind_record/list/has_left = list() // Why do we even have this? + var/datum/transhuman/body_record/list/body_scans = list() // All known body records, indexed by BR.mydna.name + +/datum/controller/subsystem/transcore/fire() + for(var/N in backed_up) + var/datum/transhuman/mind_record/curr_MR = backed_up[N] + if(!curr_MR) + log_debug("Tried to process [N] in transcore w/o a record!") + continue + if(curr_MR.one_time) + continue + var/since_backup = world.time - curr_MR.last_update + if(since_backup < overdue_time) + curr_MR.dead_state = MR_NORMAL + else + if(curr_MR.dead_state != MR_DEAD) //First time switching to dead + notify(N) + curr_MR.dead_state = MR_DEAD + +/datum/controller/subsystem/transcore/stat_entry(msg) + if(core_dumped) + msg += "CORE DUMPED | " + msg += "MR: [backed_up.len] | BR: [body_scans.len]" + ..(msg) + +/datum/controller/subsystem/transcore/Recover() + if (istype(SStranscore.body_scans)) + for(var/N in SStranscore.body_scans[N]) + if(N) body_scans[N] = SStranscore.body_scans[N] + if(SStranscore.core_dumped) + core_dumped = TRUE + can_fire = FALSE + else if (istype(SStranscore.backed_up)) + for(var/N in SStranscore.backed_up[N]) + if(N) backed_up[N] = SStranscore.backed_up[N] + +/datum/controller/subsystem/transcore/proc/m_backup(var/datum/mind/mind, var/obj/item/device/nif/nif, var/one_time = FALSE) + ASSERT(mind) + if(!mind.name || core_dumped) + return 0 + + var/datum/transhuman/mind_record/MR + + if(mind.name in backed_up) + MR = backed_up[mind.name] + MR.last_update = world.time + MR.one_time = one_time + + //Pass a 0 to not change NIF status (because the elseif is checking for null) + if(nif) + MR.nif_path = nif.type + MR.nif_durability = nif.durability + var/list/nifsofts = list() + for(var/N in nif.nifsofts) + if(N) + var/datum/nifsoft/nifsoft = N + nifsofts += nifsoft.type + MR.nif_software = nifsofts + else if(isnull(nif)) //Didn't pass anything, so no NIF + MR.nif_path = null + MR.nif_durability = null + MR.nif_software = null + + else + MR = new(mind, mind.current, add_to_db = TRUE, one_time = one_time) + + return 1 + +// Send a past-due notification to the medical radio channel. +/datum/controller/subsystem/transcore/proc/notify(var/name) + ASSERT(name) + var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) + a.autosay("[name] is past-due for a mind backup. This will be the only notification.", "TransCore Oversight", "Medical") + qdel(a) + +// Called from mind_record to add itself to the transcore. +/datum/controller/subsystem/transcore/proc/add_backup(var/datum/transhuman/mind_record/MR) + ASSERT(MR) + backed_up[MR.mindname] = MR + backed_up = sortAssoc(backed_up) + log_debug("Added [MR.mindname] to transcore DB.") + +// Remove a mind_record from the backup-checking list. Keeps track of it in has_left // Why do we do that? ~Leshana +/datum/controller/subsystem/transcore/proc/stop_backup(var/datum/transhuman/mind_record/MR) + ASSERT(MR) + has_left[MR.mindname] = MR + backed_up.Remove("[MR.mindname]") + MR.cryo_at = world.time + log_debug("Put [MR.mindname] in transcore suspended DB.") + +// Called from body_record to add itself to the transcore. +/datum/controller/subsystem/transcore/proc/add_body(var/datum/transhuman/body_record/BR) + ASSERT(BR) + body_scans[BR.mydna.name] = BR + body_scans = sortAssoc(body_scans) + log_debug("Added [BR.mydna.name] to transcore body DB.") + +// Remove a body record from the database (Usually done when someone cryos) // Why? ~Leshana +/datum/controller/subsystem/transcore/proc/remove_body(var/datum/transhuman/body_record/BR) + ASSERT(BR) + body_scans.Remove("[BR.mydna.name]") + log_debug("Removed [BR.mydna.name] from transcore body DB.") + +// Moves all mind records from the databaes into the disk and shuts down all backup canary processing. +/datum/controller/subsystem/transcore/proc/core_dump(var/obj/item/weapon/disk/transcore/disk) + ASSERT(disk) + var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) + a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Command") + a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Medical") + qdel(a) + + disk.stored += backed_up + backed_up.Cut() + core_dumped = TRUE + can_fire = FALSE + return disk.stored.len diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 6f9c37ef66..a47caf59d2 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -447,12 +447,12 @@ //VOREStation Edit - Resleeving. if(to_despawn.mind) - if(to_despawn.mind.name in transcore.backed_up) - var/datum/transhuman/mind_record/MR = transcore.backed_up[to_despawn.mind.name] - transcore.stop_backup(MR) - if(to_despawn.mind.name in transcore.body_scans) //This uses mind names to avoid people cryo'ing a printed body to delete body scans. - var/datum/transhuman/body_record/BR = transcore.body_scans[to_despawn.mind.name] - transcore.remove_body(BR) + if(to_despawn.mind.name in SStranscore.backed_up) + var/datum/transhuman/mind_record/MR = SStranscore.backed_up[to_despawn.mind.name] + SStranscore.stop_backup(MR) + if(to_despawn.mind.name in SStranscore.body_scans) //This uses mind names to avoid people cryo'ing a printed body to delete body scans. + var/datum/transhuman/body_record/BR = SStranscore.body_scans[to_despawn.mind.name] + SStranscore.remove_body(BR) //VOREStation Edit End - Resleeving. //Handle job slot/tater cleanup. diff --git a/code/game/objects/items/devices/scanners_vr.dm b/code/game/objects/items/devices/scanners_vr.dm index c0bd1391bc..4d43debe3b 100644 --- a/code/game/objects/items/devices/scanners_vr.dm +++ b/code/game/objects/items/devices/scanners_vr.dm @@ -39,7 +39,7 @@ var/global/mob/living/carbon/human/dummy/mannequin/sleevemate_mob update_icon() if("Backup") to_chat(user,"Internal copy of [stored_mind.name] backed up to database.") - transcore.m_backup(stored_mind,null,one_time = TRUE) + SStranscore.m_backup(stored_mind,null,one_time = TRUE) if("Cancel") return @@ -136,7 +136,7 @@ var/global/mob/living/carbon/human/dummy/mannequin/sleevemate_mob usr.visible_message("[usr] begins scanning [target]'s mind.","You begin scanning [target]'s mind.") if(do_after(usr,8 SECONDS,target)) - transcore.m_backup(target.mind,nif,one_time = TRUE) + SStranscore.m_backup(target.mind,nif,one_time = TRUE) to_chat(usr,"Mind backed up!") else to_chat(usr,"You must remain close to your target!") diff --git a/code/modules/mob/dead/observer/free_vr.dm b/code/modules/mob/dead/observer/free_vr.dm index 6b38abfff5..c10101f8be 100644 --- a/code/modules/mob/dead/observer/free_vr.dm +++ b/code/modules/mob/dead/observer/free_vr.dm @@ -32,12 +32,12 @@ var/global/list/prevent_respawns = list() qdel(O) //Resleeving cleanup - if(src.mind.name in transcore.backed_up) - var/datum/transhuman/mind_record/MR = transcore.backed_up[src.mind.name] - transcore.stop_backup(MR) - if(src.mind.name in transcore.body_scans) //This uses mind names to avoid people cryo'ing a printed body to delete body scans. - var/datum/transhuman/body_record/BR = transcore.body_scans[src.mind.name] - transcore.remove_body(BR) + if(src.mind.name in SStranscore.backed_up) + var/datum/transhuman/mind_record/MR = SStranscore.backed_up[src.mind.name] + SStranscore.stop_backup(MR) + if(src.mind.name in SStranscore.body_scans) //This uses mind names to avoid people cryo'ing a printed body to delete body scans. + var/datum/transhuman/body_record/BR = SStranscore.body_scans[src.mind.name] + SStranscore.remove_body(BR) //Job slot cleanup var/job = src.mind.assigned_role diff --git a/code/modules/mob/living/carbon/human/life_vr.dm b/code/modules/mob/living/carbon/human/life_vr.dm index 0a3d2fcb3f..d573e5568c 100644 --- a/code/modules/mob/living/carbon/human/life_vr.dm +++ b/code/modules/mob/living/carbon/human/life_vr.dm @@ -31,7 +31,7 @@ if(istype(I,/obj/item/weapon/implant/backup)) if(!mind) holder.icon_state = "hud_backup_nomind" - else if(!(mind.name in transcore.body_scans)) + else if(!(mind.name in SStranscore.body_scans)) holder.icon_state = "hud_backup_nobody" else holder.icon_state = "hud_backup_norm" diff --git a/code/modules/nifsoft/software/13_soulcatcher.dm b/code/modules/nifsoft/software/13_soulcatcher.dm index d1627ac461..eeea9fd130 100644 --- a/code/modules/nifsoft/software/13_soulcatcher.dm +++ b/code/modules/nifsoft/software/13_soulcatcher.dm @@ -199,7 +199,7 @@ brainmob.ext_deaf = FALSE brainmob.ext_blind = FALSE brainmob.parent_mob = TRUE - transcore.m_backup(H.mind,H) //ONE backup. Won't be called in life due to avoidance of parent_mob backups. + SStranscore.m_backup(H.mind,H) //ONE backup. Won't be called in life due to avoidance of parent_mob backups. //Set some basics on the mob. brainmob.dna = H.dna @@ -209,7 +209,7 @@ //Put the mind and player into the mob H.mind.transfer_to(brainmob) brainmob.name = brainmob.mind.name - transcore.m_backup(brainmob.mind,0) //It does ONE, so medical will hear about it. + SStranscore.m_backup(brainmob.mind,0) //It does ONE, so medical will hear about it. //Give them a flavortext message var/message = "Your vision fades in a haze of static, before returning.\n\ @@ -257,7 +257,7 @@ . = ..() if(!parent_mob && (life_tick % 150 == 0) && soulcatcher.setting_flags & NIF_SC_BACKUPS) - transcore.m_backup(mind,0) //Passed 0 means "Don't touch the nif fields on the mind record" + SStranscore.m_backup(mind,0) //Passed 0 means "Don't touch the nif fields on the mind record" life_tick++ diff --git a/code/modules/resleeving/_defines.dm b/code/modules/resleeving/_defines.dm deleted file mode 100644 index a3cf1fc665..0000000000 --- a/code/modules/resleeving/_defines.dm +++ /dev/null @@ -1,3 +0,0 @@ -#define MR_NORMAL 0 -#define MR_UNSURE 1 -#define MR_DEAD 2 \ No newline at end of file diff --git a/code/modules/resleeving/computers.dm b/code/modules/resleeving/computers.dm index 114ef049e1..6fcef5739a 100644 --- a/code/modules/resleeving/computers.dm +++ b/code/modules/resleeving/computers.dm @@ -12,7 +12,6 @@ var/menu = 1 //Which menu screen to display var/datum/transhuman/body_record/active_br = null var/datum/transhuman/mind_record/active_mr = null - var/datum/transhuman/infocore/TC //Easy debugging access var/organic_capable = 1 var/synthetic_capable = 1 var/obj/item/weapon/disk/transcore/disk @@ -20,7 +19,6 @@ /obj/machinery/computer/transhuman/resleeving/initialize() ..() updatemodules() - TC = transcore /obj/machinery/computer/transhuman/resleeving/Destroy() releasepods() @@ -72,7 +70,7 @@ P.connected = src P.name = "[initial(P.name)] #[pods.len]" user << "You connect [P] to [src]." - else if(istype(W, /obj/item/weapon/disk/transcore) && TC && !TC.core_dumped) + else if(istype(W, /obj/item/weapon/disk/transcore) && SStranscore && !SStranscore.core_dumped) user.unEquip(W) disk = W disk.forceMove(src) @@ -112,13 +110,13 @@ var/data[0] var/bodyrecords_list_ui[0] - for(var/N in TC.body_scans) - var/datum/transhuman/body_record/BR = TC.body_scans[N] + for(var/N in SStranscore.body_scans) + var/datum/transhuman/body_record/BR = SStranscore.body_scans[N] bodyrecords_list_ui[++bodyrecords_list_ui.len] = list("name" = N, "recref" = "\ref[BR]") var/mindrecords_list_ui[0] - for(var/N in TC.backed_up) - var/datum/transhuman/mind_record/MR = TC.backed_up[N] + for(var/N in SStranscore.backed_up) + var/datum/transhuman/mind_record/MR = SStranscore.backed_up[N] mindrecords_list_ui[++mindrecords_list_ui.len] = list("name" = N, "recref" = "\ref[MR]") var/pods_list_ui[0] @@ -197,7 +195,7 @@ data["spodsLen"] = spods.len data["sleeversLen"] = sleevers.len data["temp"] = temp - data["coredumped"] = transcore.core_dumped + data["coredumped"] = SStranscore.core_dumped data["emergency"] = disk ? 1 : 0 ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) @@ -238,7 +236,7 @@ else if (href_list["coredump"]) if(disk) - transcore.core_dump(disk) + SStranscore.core_dump(disk) sleep(5) visible_message("\The [src] spits out \the [disk].") disk.forceMove(get_turf(src)) diff --git a/code/modules/resleeving/designer.dm b/code/modules/resleeving/designer.dm index c64e7e3d21..c05668b9f9 100644 --- a/code/modules/resleeving/designer.dm +++ b/code/modules/resleeving/designer.dm @@ -15,12 +15,10 @@ var/icon/preview_icon = null // Mannequins are somewhat expensive to create, so cache it var/mob/living/carbon/human/dummy/mannequin/mannequin = null - var/datum/transhuman/infocore/TC //Easy debugging access var/obj/item/weapon/disk/body_record/disk = null /obj/machinery/computer/transhuman/designer/initialize() ..() - TC = transcore /obj/machinery/computer/transhuman/designer/Destroy() active_br = null @@ -63,8 +61,8 @@ if(menu == "2") var/bodyrecords_list_ui[0] - for(var/N in TC.body_scans) - var/datum/transhuman/body_record/BR = TC.body_scans[N] + for(var/N in SStranscore.body_scans) + var/datum/transhuman/body_record/BR = SStranscore.body_scans[N] bodyrecords_list_ui[++bodyrecords_list_ui.len] = list("name" = N, "recref" = "\ref[BR]") if(bodyrecords_list_ui.len) data["bodyrecords"] = bodyrecords_list_ui diff --git a/code/modules/resleeving/implant.dm b/code/modules/resleeving/implant.dm index 6a3628a3cf..389673cfa5 100644 --- a/code/modules/resleeving/implant.dm +++ b/code/modules/resleeving/implant.dm @@ -33,7 +33,7 @@ qdel(other_imp) //implant fight if(H.mind && H.stat < DEAD) //One right now, on implanting. - transcore.m_backup(H.mind) + SStranscore.m_backup(H.mind) last_attempt = world.time backup() @@ -49,7 +49,7 @@ BITSET(H.hud_updateflag, BACKUP_HUD) //Okay we've got a mind at least if(H == imp_in && H.mind && H.stat < DEAD) - transcore.m_backup(H.mind,H.nif) + SStranscore.m_backup(H.mind,H.nif) persist_nif_data(H) spawn(attempt_delay) diff --git a/code/modules/resleeving/infocore.dm b/code/modules/resleeving/infocore_records.dm similarity index 60% rename from code/modules/resleeving/infocore.dm rename to code/modules/resleeving/infocore_records.dm index c85e5eaa14..b4b0ed36d2 100644 --- a/code/modules/resleeving/infocore.dm +++ b/code/modules/resleeving/infocore_records.dm @@ -6,115 +6,6 @@ /mob/living/carbon/human/var/resleeve_lock /mob/living/carbon/human/var/original_player -var/datum/transhuman/infocore/transcore = new/datum/transhuman/infocore - -//Mind-backup database -/datum/transhuman/infocore - var/overdue_time = 15 MINUTES - var/process_time = 1 MINUTE - var/core_dumped = 0 - - var/datum/transhuman/mind_record/list/backed_up = list() - var/datum/transhuman/mind_record/list/has_left = list() - var/datum/transhuman/body_record/list/body_scans = list() - -/datum/transhuman/infocore/New() - process() - -/datum/transhuman/infocore/proc/process() - if(core_dumped) return - for(var/N in backed_up) - var/datum/transhuman/mind_record/curr_MR = backed_up[N] - if(!curr_MR) - log_debug("Tried to process [N] in transcore w/o a record!") - continue - if(curr_MR.one_time) - continue - var/since_backup = world.time - curr_MR.last_update - if(since_backup < overdue_time) - curr_MR.dead_state = MR_NORMAL - else - if(curr_MR.dead_state != MR_DEAD) //First time switching to dead - notify(N) - curr_MR.dead_state = MR_DEAD - - spawn(process_time) - process() - -/datum/transhuman/infocore/proc/m_backup(var/datum/mind/mind,var/obj/item/device/nif/nif,var/one_time = FALSE) - ASSERT(mind) - if(!mind.name || core_dumped) - return 0 - - var/datum/transhuman/mind_record/MR - - if(mind.name in backed_up) - MR = backed_up[mind.name] - MR.last_update = world.time - MR.one_time = one_time - - //Pass a 0 to not change NIF status (because the elseif is checking for null) - if(nif) - MR.nif_path = nif.type - MR.nif_durability = nif.durability - var/list/nifsofts = list() - for(var/N in nif.nifsofts) - if(N) - var/datum/nifsoft/nifsoft = N - nifsofts += nifsoft.type - MR.nif_software = nifsofts - else if(isnull(nif)) //Didn't pass anything, so no NIF - MR.nif_path = null - MR.nif_durability = null - MR.nif_software = null - - else - MR = new(mind, mind.current, add_to_db = TRUE, one_time = one_time) - - return 1 - -/datum/transhuman/infocore/proc/notify(var/name) - ASSERT(name) - var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) - a.autosay("[name] is past-due for a mind backup. This will be the only notification.", "TransCore Oversight", "Medical") - qdel(a) - -/datum/transhuman/infocore/proc/add_backup(var/datum/transhuman/mind_record/MR) - ASSERT(MR) - backed_up[MR.mindname] = MR - backed_up = sortAssoc(backed_up) - log_debug("Added [MR.mindname] to transcore DB.") - -/datum/transhuman/infocore/proc/stop_backup(var/datum/transhuman/mind_record/MR) - ASSERT(MR) - has_left[MR.mindname] = MR - backed_up.Remove("[MR.mindname]") - MR.cryo_at = world.time - log_debug("Put [MR.mindname] in transcore suspended DB.") - -/datum/transhuman/infocore/proc/add_body(var/datum/transhuman/body_record/BR) - ASSERT(BR) - body_scans[BR.mydna.name] = BR - body_scans = sortAssoc(body_scans) - log_debug("Added [BR.mydna.name] to transcore body DB.") - -/datum/transhuman/infocore/proc/remove_body(var/datum/transhuman/body_record/BR) - ASSERT(BR) - body_scans.Remove("[BR.mydna.name]") - log_debug("Removed [BR.mydna.name] from transcore body DB.") - -/datum/transhuman/infocore/proc/core_dump(var/obj/item/weapon/disk/transcore/disk) - ASSERT(disk) - var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/heads/captain(null) - a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Command") - a.autosay("An emergency core dump has been initiated!", "TransCore Oversight", "Medical") - qdel(a) - - disk.stored += backed_up - backed_up.Cut() - core_dumped = 1 - return disk.stored.len - /////// Mind-backup record /////// /datum/transhuman/mind_record //User visible @@ -159,7 +50,7 @@ var/datum/transhuman/infocore/transcore = new/datum/transhuman/infocore last_update = world.time if(add_to_db) - transcore.add_backup(src) + SStranscore.add_backup(src) /////// Body Record /////// /datum/transhuman/body_record @@ -273,7 +164,7 @@ var/datum/transhuman/infocore/transcore = new/datum/transhuman/infocore organ_data[org] = I.robotic if(add_to_db) - transcore.add_body(src) + SStranscore.add_body(src) /** diff --git a/code/modules/resleeving/infomorph.dm b/code/modules/resleeving/infomorph.dm index 4378468ff7..182e05768f 100644 --- a/code/modules/resleeving/infomorph.dm +++ b/code/modules/resleeving/infomorph.dm @@ -403,9 +403,9 @@ var/list/infomorph_emotions = list( close_up() //Resleeving 'cryo' - if(mind && (mind.name in transcore.backed_up)) - var/datum/transhuman/mind_record/MR = transcore.backed_up[mind.name] - transcore.stop_backup(MR) + if(mind && (mind.name in SStranscore.backed_up)) + var/datum/transhuman/mind_record/MR = SStranscore.backed_up[mind.name] + SStranscore.stop_backup(MR) card.removePersonality() clear_client() @@ -603,7 +603,7 @@ var/global/list/default_infomorph_software = list() //Only every so often if(air_master.current_cycle%30 == 1) - transcore.m_backup(mind) + SStranscore.m_backup(mind) if(health <= 0) death(null,"gives one shrill beep before falling lifeless.") diff --git a/vorestation.dme b/vorestation.dme index e5f8a7b681..ec0b53caa5 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -188,6 +188,7 @@ #include "code\controllers\ProcessScheduler\core\process.dm" #include "code\controllers\ProcessScheduler\core\processScheduler.dm" #include "code\controllers\subsystems\garbage.dm" +#include "code\controllers\subsystems\transcore_vr.dm" #include "code\datums\ai_law_sets.dm" #include "code\datums\ai_laws.dm" #include "code\datums\browser.dm" @@ -2233,13 +2234,12 @@ #include "code\modules\research\rdmachines.dm" #include "code\modules\research\research.dm" #include "code\modules\research\server.dm" -#include "code\modules\resleeving\_defines.dm" #include "code\modules\resleeving\circuitboards.dm" #include "code\modules\resleeving\computers.dm" #include "code\modules\resleeving\designer.dm" #include "code\modules\resleeving\documents.dm" #include "code\modules\resleeving\implant.dm" -#include "code\modules\resleeving\infocore.dm" +#include "code\modules\resleeving\infocore_records.dm" #include "code\modules\resleeving\infomorph.dm" #include "code\modules\resleeving\infomorph_software.dm" #include "code\modules\resleeving\machines.dm"