From 35784fbdb5267e6d1c34475c32981a4c25af23e5 Mon Sep 17 00:00:00 2001 From: Rykka Date: Sat, 15 Aug 2020 03:08:48 -0400 Subject: [PATCH] Earlyport Resleeving Fixes Earlyport of https://github.com/VOREStation/VOREStation/pull/8643 with a minor change increasing the linter from 80 -> 120, the rest of the backend tweaks/fixes will make their way downstream afterwards. --- code/modules/resleeving/computers.dm | 75 +++++++++---------- tgui/.eslintrc.yml | 2 +- tgui/packages/tgui/components/Section.js | 1 + .../tgui/interfaces/ResleevingConsole.js | 61 +++++++-------- tgui/packages/tgui/public/tgui.bundle.css | 2 +- tgui/packages/tgui/public/tgui.bundle.js | 14 ++-- .../tgui/styles/components/Section.scss | 6 ++ 7 files changed, 83 insertions(+), 78 deletions(-) diff --git a/code/modules/resleeving/computers.dm b/code/modules/resleeving/computers.dm index f6e11c5318..b108f021b3 100644 --- a/code/modules/resleeving/computers.dm +++ b/code/modules/resleeving/computers.dm @@ -97,6 +97,7 @@ active_br = new /datum/transhuman/body_record(brDisk.stored) // Loads a COPY! to_chat(user, "\The [src] loads the body record from \the [W] before ejecting it.") attack_hand(user) + view_b_rec("view_b_rec", list("ref" = "\ref[active_br]")) else ..() return @@ -216,42 +217,7 @@ switch(action) if("view_b_rec") - var/ref = params["ref"] - if(!length(ref)) - return - active_br = locate(ref) - if(istype(active_br)) - if(isnull(active_br.ckey)) - qdel(active_br) - set_temp("Error: Record corrupt.", "danger") - else - var/can_grow_active = 1 - if(!synthetic_capable && active_br.synthetic) //Disqualified due to being synthetic in an organic only. - can_grow_active = 0 - set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of synthfabs.", "danger") - else if(!organic_capable && !active_br.synthetic) //Disqualified for the opposite. - can_grow_active = 0 - set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of cloners.", "danger") - else if(!synthetic_capable && !organic_capable) //What have you done?? - can_grow_active = 0 - set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of synthfabs and cloners.", "danger") - else if(active_br.toocomplex) - can_grow_active = 0 - set_temp("Error: Cannot grow [active_br.mydna.name] due to species complexity.", "danger") - var/list/payload = list( - activerecord = "\ref[active_br]", - realname = sanitize(active_br.mydna.name), - species = active_br.speciesname ? active_br.speciesname : active_br.mydna.dna.species, - sex = active_br.bodygender, - mind_compat = active_br.locked ? "Low" : "High", - synthetic = active_br.synthetic, - oocnotes = active_br.body_oocnotes ? active_br.body_oocnotes : "None", - can_grow_active = can_grow_active, - ) - tgui_modal_message(src, action, "", null, payload) - else - active_br = null - set_temp("Error: Record missing.", "danger") + view_b_rec(action, params) if("view_m_rec") var/ref = params["ref"] if(!length(ref)) @@ -266,15 +232,12 @@ if(!LAZYLEN(sleevers)) can_sleeve_active = 0 set_temp("Error: Cannot sleeve due to no sleevers.", "danger") - return if(!selected_sleever) can_sleeve_active = 0 set_temp("Error: Cannot sleeve due to no selected sleever.", "danger") - return if(selected_sleever && !selected_sleever.occupant) can_sleeve_active = 0 set_temp("Error: Cannot sleeve due to lack of sleever occupant.", "danger") - return var/list/payload = list( activerecord = "\ref[active_mr]", realname = sanitize(active_mr.mindname), @@ -519,6 +482,40 @@ temp = list(text = text, style = style) if(update_now) SStgui.update_uis(src) + +/obj/machinery/computer/transhuman/resleeving/proc/view_b_rec(action, params) + var/ref = params["ref"] + if(!length(ref)) + return + active_br = locate(ref) + if(istype(active_br)) + var/can_grow_active = 1 + if(!synthetic_capable && active_br.synthetic) //Disqualified due to being synthetic in an organic only. + can_grow_active = 0 + set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of synthfabs.", "danger") + else if(!organic_capable && !active_br.synthetic) //Disqualified for the opposite. + can_grow_active = 0 + set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of cloners.", "danger") + else if(!synthetic_capable && !organic_capable) //What have you done?? + can_grow_active = 0 + set_temp("Error: Cannot grow [active_br.mydna.name] due to lack of synthfabs and cloners.", "danger") + else if(active_br.toocomplex) + can_grow_active = 0 + set_temp("Error: Cannot grow [active_br.mydna.name] due to species complexity.", "danger") + var/list/payload = list( + activerecord = "\ref[active_br]", + realname = sanitize(active_br.mydna.name), + species = active_br.speciesname ? active_br.speciesname : active_br.mydna.dna.species, + sex = active_br.bodygender, + mind_compat = active_br.locked ? "Low" : "High", + synthetic = active_br.synthetic, + oocnotes = active_br.body_oocnotes ? active_br.body_oocnotes : "None", + can_grow_active = can_grow_active, + ) + tgui_modal_message(src, action, "", null, payload) + else + active_br = null + set_temp("Error: Record missing.", "danger") #undef MENU_MAIN #undef MENU_BODY diff --git a/tgui/.eslintrc.yml b/tgui/.eslintrc.yml index 9fd4db9fd2..fe11b8a34c 100644 --- a/tgui/.eslintrc.yml +++ b/tgui/.eslintrc.yml @@ -369,7 +369,7 @@ rules: # max-depth: error ## Enforce a maximum line length max-len: [error, { - code: 80, + code: 120, # Bump to 140 if this is still too in the way ## Ignore imports ignorePattern: '^(import\s.+\sfrom\s|.*require\()', ignoreUrls: true, diff --git a/tgui/packages/tgui/components/Section.js b/tgui/packages/tgui/components/Section.js index fb090fa81e..c5df9f6b5d 100644 --- a/tgui/packages/tgui/components/Section.js +++ b/tgui/packages/tgui/components/Section.js @@ -29,6 +29,7 @@ export const Section = props => { 'Section', 'Section--level--' + level, fill && 'Section--fill', + scrollable && 'Section--scrollable', flexGrow && 'Section--flex', className, ...computeBoxClassName(rest), diff --git a/tgui/packages/tgui/interfaces/ResleevingConsole.js b/tgui/packages/tgui/interfaces/ResleevingConsole.js index a044443cb2..749a6fb261 100644 --- a/tgui/packages/tgui/interfaces/ResleevingConsole.js +++ b/tgui/packages/tgui/interfaces/ResleevingConsole.js @@ -24,7 +24,13 @@ const viewMindRecordModalBodyOverride = (modal, context) => { level={2} m="-1rem" pb="1rem" - title={"Mind Record (" + realname + ")"}> + title={"Mind Record (" + realname + ")"} + buttons={ +