mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 11:38:12 +01:00
Allow multiple SStranscore databases (#10450)
* Allow multiple SStranscore databases * Add key to backup implanter too * Key passing tweak * Fix issue Leshana spotted * Add optimization Leshana spotted * Fixxy more multitranscore bugs
This commit is contained in:
@@ -32,12 +32,8 @@ var/global/list/prevent_respawns = list()
|
||||
qdel(O)
|
||||
|
||||
//Resleeving cleanup
|
||||
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)
|
||||
if(mind)
|
||||
SStranscore.leave_round(src)
|
||||
|
||||
//Job slot cleanup
|
||||
var/job = src.mind.assigned_role
|
||||
|
||||
@@ -62,18 +62,22 @@
|
||||
set name = "Notify Transcore"
|
||||
set desc = "If your past-due backup notification was missed or ignored, you can use this to send a new one."
|
||||
|
||||
if(src.mind && (src.mind.name in SStranscore.backed_up))
|
||||
var/datum/transhuman/mind_record/record = SStranscore.backed_up[src.mind.name]
|
||||
if(!mind)
|
||||
to_chat(src,"<span class='warning'>Your ghost is missing game values that allow this functionality, sorry.</span>")
|
||||
return
|
||||
var/datum/transcore_db/db = SStranscore.db_by_mind_name(mind.name)
|
||||
if(db)
|
||||
var/datum/transhuman/mind_record/record = db.backed_up[src.mind.name]
|
||||
if(!(record.dead_state == MR_DEAD))
|
||||
to_chat(src, "<span class='warning'>Your backup is not past-due yet.</span>")
|
||||
else if((world.time - record.last_notification) < 10 MINUTES)
|
||||
to_chat(src, "<span class='warning'>Too little time has passed since your last notification.</span>")
|
||||
else
|
||||
SStranscore.notify(record.mindname, TRUE)
|
||||
db.notify(record.mindname, TRUE)
|
||||
record.last_notification = world.time
|
||||
to_chat(src, "<span class='notice'>New notification has been sent.</span>")
|
||||
else
|
||||
to_chat(src, "<span class='warning'>No mind record found!</span>")
|
||||
to_chat(src,"<span class='warning'>No backup record could be found, sorry.</span>")
|
||||
|
||||
/mob/observer/dead/verb/findghostpod() //Moves the ghost instead of just changing the ghosts's eye -Nodrak
|
||||
set category = "Ghost"
|
||||
|
||||
@@ -38,14 +38,14 @@
|
||||
|
||||
for(var/obj/item/organ/external/E in organs)
|
||||
for(var/obj/item/weapon/implant/I in E.implants)
|
||||
if(I.implanted)
|
||||
if(istype(I,/obj/item/weapon/implant/backup))
|
||||
if(!mind)
|
||||
holder.icon_state = "hud_backup_nomind"
|
||||
else if(!(mind.name in SStranscore.body_scans))
|
||||
holder.icon_state = "hud_backup_nobody"
|
||||
else
|
||||
holder.icon_state = "hud_backup_norm"
|
||||
if(I.implanted && istype(I,/obj/item/weapon/implant/backup))
|
||||
var/obj/item/weapon/implant/backup/B = I
|
||||
if(!mind)
|
||||
holder.icon_state = "hud_backup_nomind"
|
||||
else if(!(mind.name in B.our_db.body_scans))
|
||||
holder.icon_state = "hud_backup_nobody"
|
||||
else
|
||||
holder.icon_state = "hud_backup_norm"
|
||||
|
||||
apply_hud(BACKUP_HUD, holder)
|
||||
|
||||
|
||||
@@ -25,11 +25,17 @@
|
||||
var/obj/machinery/transhuman/synthprinter/selected_printer
|
||||
var/obj/machinery/transhuman/resleever/selected_sleever
|
||||
|
||||
// Resleeving database this machine interacts with. Blank for default database
|
||||
// Needs a matching /datum/transcore_db with key defined in code
|
||||
var/db_key
|
||||
var/datum/transcore_db/our_db // These persist all round and are never destroyed, just keep a hard ref
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/Initialize()
|
||||
. = ..()
|
||||
pods = list()
|
||||
spods = list()
|
||||
sleevers = list()
|
||||
our_db = SStranscore.db_by_key(db_key)
|
||||
updatemodules()
|
||||
|
||||
/obj/machinery/computer/transhuman/resleeving/Destroy()
|
||||
@@ -82,7 +88,7 @@
|
||||
P.connected = src
|
||||
P.name = "[initial(P.name)] #[pods.len]"
|
||||
to_chat(user, "<span class='notice'>You connect [P] to [src].</span>")
|
||||
else if(istype(W, /obj/item/weapon/disk/transcore) && SStranscore && !SStranscore.core_dumped)
|
||||
else if(istype(W, /obj/item/weapon/disk/transcore) && !our_db.core_dumped)
|
||||
user.unEquip(W)
|
||||
disk = W
|
||||
disk.forceMove(src)
|
||||
@@ -172,7 +178,7 @@
|
||||
data["sleevers"] = temppods.Copy()
|
||||
temppods.Cut()
|
||||
|
||||
data["coredumped"] = SStranscore.core_dumped
|
||||
data["coredumped"] = our_db.core_dumped
|
||||
data["emergency"] = disk
|
||||
data["temp"] = temp
|
||||
data["selected_pod"] = "\ref[selected_pod]"
|
||||
@@ -180,14 +186,14 @@
|
||||
data["selected_sleever"] = "\ref[selected_sleever]"
|
||||
|
||||
var/bodyrecords_list_ui[0]
|
||||
for(var/N in SStranscore.body_scans)
|
||||
var/datum/transhuman/body_record/BR = SStranscore.body_scans[N]
|
||||
for(var/N in our_db.body_scans)
|
||||
var/datum/transhuman/body_record/BR = our_db.body_scans[N]
|
||||
bodyrecords_list_ui[++bodyrecords_list_ui.len] = list("name" = N, "recref" = "\ref[BR]")
|
||||
data["bodyrecords"] = bodyrecords_list_ui
|
||||
|
||||
var/mindrecords_list_ui[0]
|
||||
for(var/N in SStranscore.backed_up)
|
||||
var/datum/transhuman/mind_record/MR = SStranscore.backed_up[N]
|
||||
for(var/N in our_db.backed_up)
|
||||
var/datum/transhuman/mind_record/MR = our_db.backed_up[N]
|
||||
mindrecords_list_ui[++mindrecords_list_ui.len] = list("name" = N, "recref" = "\ref[MR]")
|
||||
data["mindrecords"] = mindrecords_list_ui
|
||||
|
||||
@@ -251,7 +257,7 @@
|
||||
set_temp("Error: Record missing.", "danger")
|
||||
if("coredump")
|
||||
if(disk)
|
||||
SStranscore.core_dump(disk)
|
||||
our_db.core_dump(disk)
|
||||
sleep(5)
|
||||
visible_message("<span class='warning'>\The [src] spits out \the [disk].</span>")
|
||||
disk.forceMove(get_turf(src))
|
||||
@@ -407,7 +413,7 @@
|
||||
return TRUE
|
||||
|
||||
//They were dead, or otherwise available.
|
||||
sleever.putmind(active_mr,mode,override)
|
||||
sleever.putmind(active_mr,mode,override,db_key = db_key)
|
||||
set_temp("Initiating resleeving...")
|
||||
tgui_modal_clear(src)
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
var/mob/living/carbon/human/dummy/mannequin/mannequin = null
|
||||
var/obj/item/weapon/disk/body_record/disk = null
|
||||
|
||||
// Resleeving database this machine interacts with. Blank for default database
|
||||
// Needs a matching /datum/transcore_db with key defined in code
|
||||
var/db_key
|
||||
var/datum/transcore_db/our_db // These persist all round and are never destroyed, just keep a hard ref
|
||||
|
||||
/obj/machinery/computer/transhuman/designer/Initialize()
|
||||
. = ..()
|
||||
map_name = "transhuman_designer_[REF(src)]_map"
|
||||
@@ -51,6 +56,8 @@
|
||||
west_preview.del_on_map_removal = FALSE
|
||||
west_preview.screen_loc = "[map_name]:0,1"
|
||||
|
||||
our_db = SStranscore.db_by_key(db_key)
|
||||
|
||||
/obj/machinery/computer/transhuman/designer/Destroy()
|
||||
active_br = null
|
||||
mannequin = null
|
||||
@@ -100,8 +107,8 @@
|
||||
|
||||
if(menu == MENU_BODYRECORDS)
|
||||
var/bodyrecords_list_ui[0]
|
||||
for(var/N in SStranscore.body_scans)
|
||||
var/datum/transhuman/body_record/BR = SStranscore.body_scans[N]
|
||||
for(var/N in our_db.body_scans)
|
||||
var/datum/transhuman/body_record/BR = our_db.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
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
icon_state = "backup_implant"
|
||||
known_implant = TRUE
|
||||
|
||||
// Resleeving database this machine interacts with. Blank for default database
|
||||
// Needs a matching /datum/transcore_db with key defined in code
|
||||
var/db_key
|
||||
var/datum/transcore_db/our_db // These persist all round and are never destroyed, just keep a hard ref
|
||||
|
||||
/obj/item/weapon/implant/backup/get_data()
|
||||
var/dat = {"
|
||||
<b>Implant Specifications:</b><BR>
|
||||
@@ -26,14 +31,22 @@
|
||||
<b>Integrity:</b> Generally very survivable. Susceptible to being destroyed by acid."}
|
||||
return dat
|
||||
|
||||
/obj/item/weapon/implant/backup/New(newloc, db_key)
|
||||
. = ..()
|
||||
src.db_key = db_key
|
||||
|
||||
/obj/item/weapon/implant/backup/Initialize()
|
||||
. = ..()
|
||||
our_db = SStranscore.db_by_key(db_key)
|
||||
|
||||
/obj/item/weapon/implant/backup/Destroy()
|
||||
SStranscore.implants -= src
|
||||
our_db.implants -= src
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/implant/backup/post_implant(var/mob/living/carbon/human/H)
|
||||
if(istype(H))
|
||||
BITSET(H.hud_updateflag, BACKUP_HUD)
|
||||
SStranscore.implants |= src
|
||||
our_db.implants |= src
|
||||
|
||||
return 1
|
||||
|
||||
@@ -53,10 +66,12 @@
|
||||
var/list/obj/item/weapon/implant/backup/imps = list()
|
||||
var/max_implants = 4 //Iconstates need to exist due to the update proc!
|
||||
|
||||
var/db_key // To give to the baby implants
|
||||
|
||||
/obj/item/weapon/backup_implanter/New()
|
||||
..()
|
||||
for(var/i = 1 to max_implants)
|
||||
var/obj/item/weapon/implant/backup/imp = new(src)
|
||||
var/obj/item/weapon/implant/backup/imp = new(src, db_key)
|
||||
imps |= imp
|
||||
imp.germ_level = 0
|
||||
update()
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
var/one_time = FALSE
|
||||
|
||||
/datum/transhuman/mind_record/New(var/datum/mind/mind, var/mob/living/carbon/human/M, var/add_to_db = TRUE, var/one_time = FALSE)
|
||||
/datum/transhuman/mind_record/New(var/datum/mind/mind, var/mob/living/carbon/human/M, var/add_to_db = TRUE, var/one_time = FALSE, var/database_key)
|
||||
ASSERT(mind)
|
||||
|
||||
src.one_time = one_time
|
||||
@@ -62,7 +62,7 @@
|
||||
last_update = world.time
|
||||
|
||||
if(add_to_db)
|
||||
SStranscore.add_backup(src)
|
||||
SStranscore.add_backup(src, database_key = database_key)
|
||||
|
||||
/////// Body Record ///////
|
||||
/datum/transhuman/body_record
|
||||
@@ -100,7 +100,7 @@
|
||||
organ_data.Cut()
|
||||
return QDEL_HINT_HARDDEL // For now at least there is no easy way to clear references to this in machines etc.
|
||||
|
||||
/datum/transhuman/body_record/proc/init_from_mob(var/mob/living/carbon/human/M, var/add_to_db = 0, var/ckeylock = 0)
|
||||
/datum/transhuman/body_record/proc/init_from_mob(var/mob/living/carbon/human/M, var/add_to_db = 0, var/ckeylock = 0, var/database_key)
|
||||
ASSERT(!QDELETED(M))
|
||||
ASSERT(istype(M))
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
genetic_modifiers.Add(mod.type)
|
||||
|
||||
if(add_to_db)
|
||||
SStranscore.add_body(src)
|
||||
SStranscore.add_body(src, database_key = database_key)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,6 +58,7 @@ var/list/infomorph_emotions = list(
|
||||
|
||||
var/obj/item/weapon/pai_cable/cable // The cable we produce and use when door or camera jacking
|
||||
var/silence_time // Timestamp when we were silenced (normally via EMP burst), set to null after silence has faded
|
||||
var/db_key
|
||||
|
||||
// Various software-specific vars
|
||||
|
||||
@@ -83,7 +84,7 @@ var/list/infomorph_emotions = list(
|
||||
var/datum/data/record/securityActive1 // Could probably just combine all these into one
|
||||
var/datum/data/record/securityActive2
|
||||
|
||||
/mob/living/silicon/infomorph/New(var/obj/item/device/sleevecard/SC, var/name = "Unknown")
|
||||
/mob/living/silicon/infomorph/New(var/obj/item/device/sleevecard/SC, var/name = "Unknown", var/db_key)
|
||||
ASSERT(SC)
|
||||
name = "[initial(name)] ([name])"
|
||||
src.forceMove(SC)
|
||||
@@ -95,6 +96,8 @@ var/list/infomorph_emotions = list(
|
||||
card.radio = new (card)
|
||||
radio = card.radio
|
||||
|
||||
src.db_key = db_key
|
||||
|
||||
//Default languages without universal translator software
|
||||
add_language(LANGUAGE_EAL, 1)
|
||||
add_language(LANGUAGE_SIGN, 0)
|
||||
@@ -406,9 +409,7 @@ var/list/infomorph_emotions = list(
|
||||
close_up()
|
||||
|
||||
//Resleeving 'cryo'
|
||||
if(mind && (mind.name in SStranscore.backed_up))
|
||||
var/datum/transhuman/mind_record/MR = SStranscore.backed_up[mind.name]
|
||||
SStranscore.stop_backup(MR)
|
||||
SStranscore.leave_round(src)
|
||||
|
||||
card.removePersonality()
|
||||
clear_client()
|
||||
@@ -588,7 +589,7 @@ var/global/list/default_infomorph_software = list()
|
||||
|
||||
//Only every so often
|
||||
if(air_master.current_cycle%30 == 1)
|
||||
SStranscore.m_backup(mind)
|
||||
SStranscore.m_backup(mind, database_key = db_key)
|
||||
|
||||
if(health <= 0)
|
||||
death(null,"gives one shrill beep before falling lifeless.")
|
||||
|
||||
@@ -536,13 +536,13 @@
|
||||
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/machinery/transhuman/resleever/proc/putmind(var/datum/transhuman/mind_record/MR, mode = 1, var/mob/living/carbon/human/override = null)
|
||||
/obj/machinery/transhuman/resleever/proc/putmind(var/datum/transhuman/mind_record/MR, mode = 1, var/mob/living/carbon/human/override = null, var/db_key)
|
||||
if((!occupant || !istype(occupant) || occupant.stat >= DEAD) && mode == 1)
|
||||
return 0
|
||||
|
||||
if(mode == 2 && sleevecards) //Card sleeving
|
||||
var/obj/item/device/sleevecard/card = new /obj/item/device/sleevecard(get_turf(src))
|
||||
card.sleeveInto(MR)
|
||||
card.sleeveInto(MR, db_key = db_key)
|
||||
sleevecards--
|
||||
return 1
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
to_chat(user,"<span class='notice'>\The [src] displays the name '[infomorph]'.</span>")
|
||||
|
||||
//This is a 'hard' proc, it does no permission checking, do that on the computer
|
||||
/obj/item/device/sleevecard/proc/sleeveInto(var/datum/transhuman/mind_record/MR)
|
||||
infomorph = new(src,MR.mindname)
|
||||
/obj/item/device/sleevecard/proc/sleeveInto(var/datum/transhuman/mind_record/MR, var/db_key)
|
||||
infomorph = new(src,MR.mindname,db_key=db_key)
|
||||
|
||||
for(var/datum/language/L in MR.languages)
|
||||
infomorph.add_language(L.name)
|
||||
|
||||
Reference in New Issue
Block a user