mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Fix Medical Records Virology
This commit is contained in:
@@ -255,13 +255,13 @@ SUBSYSTEM_DEF(tgui)
|
||||
*
|
||||
* return int The number of UIs closed.
|
||||
**/
|
||||
/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object)
|
||||
/datum/controller/subsystem/tgui/proc/close_user_uis(mob/user, datum/src_object, logout = FALSE)
|
||||
var/count = 0
|
||||
if(length(user?.tgui_open_uis) == 0)
|
||||
return count
|
||||
for(var/datum/tgui/ui in user.tgui_open_uis)
|
||||
if(isnull(src_object) || ui.src_object == src_object)
|
||||
ui.close()
|
||||
ui.close(logout = logout)
|
||||
count++
|
||||
return count
|
||||
|
||||
@@ -315,7 +315,7 @@ SUBSYSTEM_DEF(tgui)
|
||||
* return int The number of UIs closed.
|
||||
**/
|
||||
/datum/controller/subsystem/tgui/proc/on_logout(mob/user)
|
||||
return close_user_uis(user)
|
||||
return close_user_uis(user, logout = TRUE)
|
||||
|
||||
/**
|
||||
* private
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
data["virus"] = list()
|
||||
for(var/ID in virusDB)
|
||||
var/datum/data/record/v = virusDB[ID]
|
||||
data["virus"] += list(list("name" = v.fields["name"], "D" = v))
|
||||
data["virus"] += list(list("name" = v.fields["name"], "D" = "\ref[v]"))
|
||||
if(MED_DATA_MEDBOT)
|
||||
data["medbots"] = list()
|
||||
for(var/mob/living/bot/medbot/M in mob_list)
|
||||
@@ -266,16 +266,9 @@
|
||||
active2 = null
|
||||
if("vir")
|
||||
var/datum/data/record/v = locate(params["vir"])
|
||||
var/list/payload = list(
|
||||
id = v.fields["id"],
|
||||
name = v.fields["name"],
|
||||
max_stages = "Unknown",
|
||||
spread_text = v.fields["spread type"],
|
||||
cure = v.fields["antigen"],
|
||||
desc = v.fields["description"],
|
||||
severity = "Unknown"
|
||||
);
|
||||
tgui_modal_message(src, "virus", "", null, payload)
|
||||
if(!istype(v))
|
||||
return FALSE
|
||||
tgui_modal_message(src, "virus", "", null, v.fields["tgui_description"])
|
||||
if("del_all")
|
||||
for(var/datum/data/record/R in data_core.medical)
|
||||
qdel(R)
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
*
|
||||
* Close the UI, and all its children.
|
||||
*/
|
||||
/datum/tgui/proc/close(can_be_suspended = TRUE)
|
||||
/datum/tgui/proc/close(can_be_suspended = TRUE, logout = FALSE)
|
||||
if(closing)
|
||||
return
|
||||
closing = TRUE
|
||||
@@ -122,7 +122,7 @@
|
||||
// and we want to keep them around, to allow user to read
|
||||
// the error message properly.
|
||||
window.release_lock()
|
||||
window.close(can_be_suspended)
|
||||
window.close(can_be_suspended, logout)
|
||||
src_object.tgui_close(user)
|
||||
SStgui.on_close(src)
|
||||
state = null
|
||||
|
||||
@@ -133,14 +133,19 @@
|
||||
*
|
||||
* optional can_be_suspended bool
|
||||
*/
|
||||
/datum/tgui_window/proc/close(can_be_suspended = TRUE)
|
||||
/datum/tgui_window/proc/close(can_be_suspended = TRUE, logout = FALSE)
|
||||
if(!client)
|
||||
return
|
||||
if(can_be_suspended && can_be_suspended())
|
||||
log_tgui(client, "[id]/close: suspending")
|
||||
status = TGUI_WINDOW_READY
|
||||
send_message("suspend")
|
||||
winset(client, null, "mapwindow.map.focus=true")
|
||||
// You would think that BYOND would null out client or make it stop passing istypes or, y'know, ANYTHING during
|
||||
// logout, but nope! It appears to be perfectly valid to call winset by every means we can measure in Logout,
|
||||
// and yet it causes a bad client runtime. To avoid that happening, we just have to know if we're in Logout or
|
||||
// not.
|
||||
if(!logout && client)
|
||||
winset(client, null, "mapwindow.map.focus=true")
|
||||
return
|
||||
log_tgui(client, "[id]/close")
|
||||
release_lock()
|
||||
@@ -150,7 +155,8 @@
|
||||
// to read the error message.
|
||||
if(!fatally_errored)
|
||||
client << browse(null, "window=[id]")
|
||||
winset(client, null, "mapwindow.map.focus=true")
|
||||
if(!logout && client)
|
||||
winset(client, null, "mapwindow.map.focus=true")
|
||||
/**
|
||||
* public
|
||||
*
|
||||
|
||||
@@ -245,6 +245,25 @@ var/global/list/virusDB = list()
|
||||
|
||||
return r
|
||||
|
||||
/datum/disease2/disease/proc/get_tgui_info()
|
||||
. = list(
|
||||
"name" = name(),
|
||||
"spreadtype" = spreadtype,
|
||||
"antigen" = antigens2string(antigen),
|
||||
"rate" = stageprob * 10,
|
||||
"resistance" = resistance,
|
||||
"species" = jointext(affected_species, ", "),
|
||||
"symptoms" = list(),
|
||||
)
|
||||
|
||||
for(var/datum/disease2/effectholder/E in effects)
|
||||
.["symptoms"].Add(list(list(
|
||||
"stage" = E.stage,
|
||||
"name" = E.effect.name,
|
||||
"strength" = "[E.multiplier >= 3 ? "Severe" : E.multiplier > 1 ? "Above Average" : "Average"]",
|
||||
"aggressiveness" = E.chance * 15,
|
||||
)))
|
||||
|
||||
/datum/disease2/disease/proc/addToDB()
|
||||
if ("[uniqueID]" in virusDB)
|
||||
return 0
|
||||
@@ -252,6 +271,7 @@ var/global/list/virusDB = list()
|
||||
v.fields["id"] = uniqueID
|
||||
v.fields["name"] = name()
|
||||
v.fields["description"] = get_info()
|
||||
v.fields["tgui_description"] = get_tgui_info()
|
||||
v.fields["antigen"] = antigens2string(antigen)
|
||||
v.fields["spread type"] = spreadtype
|
||||
virusDB["[uniqueID]"] = v
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Window } from "../layouts";
|
||||
import { LoginInfo } from './common/LoginInfo';
|
||||
import { LoginScreen } from './common/LoginScreen';
|
||||
import { TemporaryNotice } from './common/TemporaryNotice';
|
||||
import { decodeHtmlEntities } from 'common/string';
|
||||
|
||||
const severities = {
|
||||
"Minor": "good",
|
||||
@@ -23,30 +24,45 @@ const doEdit = (context, field) => {
|
||||
};
|
||||
|
||||
const virusModalBodyOverride = (modal, context) => {
|
||||
const { act } = useBackend(context);
|
||||
const virus = modal.args;
|
||||
return (
|
||||
<Section
|
||||
level={2}
|
||||
m="-1rem"
|
||||
pb="1rem"
|
||||
title={virus.name || "Virus"}>
|
||||
title={virus.name || "Virus"}
|
||||
buttons={
|
||||
<Button
|
||||
icon="times"
|
||||
color="red"
|
||||
onClick={() => act('modal_close')} />
|
||||
}>
|
||||
<Box mx="0.5rem">
|
||||
<LabeledList>
|
||||
<LabeledList.Item label="Number of stages">
|
||||
{virus.max_stages}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Spread">
|
||||
{virus.spread_text} Transmission
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Possible cure">
|
||||
{virus.cure}
|
||||
{virus.antigen}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Notes">
|
||||
{virus.desc}
|
||||
<LabeledList.Item label="Rate of Progression">
|
||||
{virus.rate}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Severity"
|
||||
color={severities[virus.severity]}>
|
||||
{virus.severity}
|
||||
<LabeledList.Item label="Antibiotic Resistance">
|
||||
{virus.resistance}%
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Species Affected">
|
||||
{virus.species}
|
||||
</LabeledList.Item>
|
||||
<LabeledList.Item label="Symptoms">
|
||||
<LabeledList>
|
||||
{virus.symptoms.map(s => (
|
||||
<LabeledList.Item key={s.stage} label={s.stage + ". " + s.name}>
|
||||
<Box inline color="label">Strength:</Box> {s.strength}
|
||||
<Box inline color="label">Aggressiveness:</Box> {s.aggressiveness}
|
||||
</LabeledList.Item>
|
||||
))}
|
||||
</LabeledList>
|
||||
</LabeledList.Item>
|
||||
</LabeledList>
|
||||
</Box>
|
||||
@@ -91,7 +107,7 @@ export const MedicalRecords = (_properties, context) => {
|
||||
width={800}
|
||||
height={380}
|
||||
resizable>
|
||||
<ComplexModal />
|
||||
<ComplexModal maxHeight="100%" maxWidth="80%" />
|
||||
<Window.Content className="Layout__content--flexColumn">
|
||||
<LoginInfo />
|
||||
<TemporaryNotice />
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user