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.
This commit is contained in:
Rykka
2020-08-15 03:08:48 -04:00
parent 05b3c899d1
commit 35784fbdb5
7 changed files with 83 additions and 78 deletions

View File

@@ -97,6 +97,7 @@
active_br = new /datum/transhuman/body_record(brDisk.stored) // Loads a COPY!
to_chat(user, "<span class='notice'>\The [src] loads the body record from \the [W] before ejecting it.</span>")
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

View File

@@ -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,

View File

@@ -29,6 +29,7 @@ export const Section = props => {
'Section',
'Section--level--' + level,
fill && 'Section--fill',
scrollable && 'Section--scrollable',
flexGrow && 'Section--flex',
className,
...computeBoxClassName(rest),

View File

@@ -24,7 +24,13 @@ const viewMindRecordModalBodyOverride = (modal, context) => {
level={2}
m="-1rem"
pb="1rem"
title={"Mind Record (" + realname + ")"}>
title={"Mind Record (" + realname + ")"}
buttons={
<Button
icon="times"
color="red"
onClick={() => act('modal_close')} />
}>
<LabeledList>
<LabeledList.Item label="Name">
{realname}
@@ -52,7 +58,9 @@ const viewMindRecordModalBodyOverride = (modal, context) => {
/>
</LabeledList.Item>
<LabeledList.Item label="OOC Notes">
{oocnotes}
<Section style={{ 'word-break': 'break-all', 'height': '100px' }} scrollable>
{oocnotes}
</Section>
</LabeledList.Item>
</LabeledList>
</Section>
@@ -76,7 +84,13 @@ const viewBodyRecordModalBodyOverride = (modal, context) => {
level={2}
m="-1rem"
pb="1rem"
title={"Body Record (" + realname + ")"}>
title={"Body Record (" + realname + ")"}
buttons={
<Button
icon="times"
color="red"
onClick={() => act('modal_close')} />
}>
<LabeledList>
<LabeledList.Item label="Name">
{realname}
@@ -94,7 +108,9 @@ const viewBodyRecordModalBodyOverride = (modal, context) => {
{synthetic ? "Yes" : "No"}
</LabeledList.Item>
<LabeledList.Item label="OOC Notes">
{oocnotes}
<Section style={{ 'word-break': 'break-all', 'height': '100px' }} scrollable>
{oocnotes}
</Section>
</LabeledList.Item>
<LabeledList.Item label="Actions">
<Button
@@ -371,29 +387,6 @@ const ResleevingConsolePodSleevers = (props, context) => {
if (sleevers && sleevers.length) {
return sleevers.map((pod, i) => {
let podAction;
if (!pod.occupied) {
podAction = (
<Box
mt={(spods && spods.length) ? "2rem" : "0.5rem"}
color="bad">
Sleever Empty.
</Box>
);
} else {
podAction = (
<Button
selected={selected_sleever === pod.sleever}
icon={selected_sleever === pod.sleever && "check"}
content="Select"
mt={(spods && spods.length) ? "3rem" : "1.5rem"}
onClick={() => act('selectsleever', {
ref: pod.sleever,
})}
/>
);
}
return (
<Box
key={i}
@@ -408,10 +401,18 @@ const ResleevingConsolePodSleevers = (props, context) => {
"-ms-interpolation-mode": "nearest-neighbor",
}}
/>
<Box color="label">
<Box color={pod.occupied ? "label" : "bad"}>
{pod.name}
</Box>
{podAction}
<Button
selected={selected_sleever === pod.sleever}
icon={selected_sleever === pod.sleever && "check"}
content="Select"
mt={(spods && spods.length) ? "3rem" : "1.5rem"}
onClick={() => act('selectsleever', {
ref: pod.sleever,
})}
/>
</Box>
);
});
@@ -519,7 +520,7 @@ const ResleevingConsoleRecords = (props, context) => {
} = props;
if (!records.length) {
return (
<Flex height="100%">
<Flex height="100%" mt="0.5rem">
<Flex.Item
grow="1"
align="center"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -66,6 +66,12 @@ $color-separator: colors.$primary !default;
height: 100%;
}
.Section--scrollable .Section__content {
overflow-y: auto;
height: 100%;
overflow-x: hidden;
}
.Section--fill .Section__content {
flex-grow: 1;
}