Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasint committed Jul 7, 2024
1 parent 9793860 commit 89eee21
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 72 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/~monkestation/virology.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@

#define DISEASE_DORMANT (1 << 3)
#define DISEASE_COPYSTAGE (1<<4)
#define DISEASE_ANALYZED (1<<5)
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ DEFINE_BITFIELD(disease_flags, list(
"CURABLE" = CURABLE,
"DORMANT" = DISEASE_DORMANT,
"STAGE_COPY" = DISEASE_COPYSTAGE,
"ANALYZED" = DISEASE_ANALYZED,
))

DEFINE_BITFIELD(flags_1, list(
Expand Down
1 change: 1 addition & 0 deletions monkestation/code/modules/virology/machines/analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
popup.set_content(dish.info)
popup.open()
dish.analysed = TRUE
dish.contained_virus.disease_flags |= DISEASE_ANALYZED
dish.update_appearance()
dish.forceMove(loc)
dish = null
Expand Down
9 changes: 9 additions & 0 deletions monkestation/code/modules/virology/machines/incubator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@
dish_ui_datum["minor_mutations_effects"] = mutatechance //add support for other reagents
dish_ui_datum["dish_slot"] = i

var/list/symptom_data = list()
var/obj/item/weapon/virusdish/dish = dish_datum.dish
for(var/datum/symptom/symptom in dish.contained_virus.symptoms)
if(!(dish.contained_virus.disease_flags & DISEASE_ANALYZED))
symptom_data += list(list("name" = "Unknown", "desc" = "Unknown", "strength" = symptom.multiplier, "max_strength" = symptom.max_multiplier, "chance" = symptom.chance, "max_chance" = symptom.max_chance, "stage" = symptom.stage))
continue
symptom_data += list(list("name" = symptom.name, "desc" = symptom.desc, "strength" = symptom.multiplier, "max_strength" = symptom.max_multiplier, "chance" = symptom.chance, "max_chance" = symptom.max_chance, "stage" = symptom.stage))
dish_ui_datum["symptom_data"] = symptom_data

return data

/obj/machinery/disease2/incubator/process()
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/modules/virology/machines/splicer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
qdel(dish)
dish = null
update_icon()
flick("splicer_scan", src)
flick_overlay("splicer_scan", src)

/obj/machinery/computer/diseasesplicer/proc/eject_dish()
if(!dish)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
if(istype(parent, /obj/item/weapon/virusdish))
var/obj/item/weapon/virusdish/dish = parent
dish.analysed = FALSE
dish.contained_virus.disease_flags &= ~DISEASE_ANALYZED
dish.info = "OUTDATED : [dish.info]"
dish.update_appearance()
if(machine)
Expand All @@ -19,5 +20,6 @@
if(istype(parent, /obj/item/weapon/virusdish))
var/obj/item/weapon/virusdish/dish = parent
dish.analysed = FALSE
dish.contained_virus.disease_flags &= ~DISEASE_ANALYZED
dish.info = "OUTDATED : [dish.info]"
dish.update_appearance()
1 change: 1 addition & 0 deletions monkestation/code/modules/virology/reagents/incubation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
if(istype(parent, /obj/item/weapon/virusdish))
var/obj/item/weapon/virusdish/dish = parent
dish.analysed = FALSE
dish.contained_virus.disease_flags &= ~DISEASE_ANALYZED
dish.info = "OUTDATED : [dish.info]"
dish.update_appearance()
if(machine)
Expand Down
215 changes: 144 additions & 71 deletions tgui/packages/tgui/interfaces/DiseaseIncubator.jsx
Original file line number Diff line number Diff line change
@@ -1,82 +1,155 @@
import { useBackend } from '../backend';
import { Button, LabeledList, Section } from '../components';
import {
Button,
Collapsible,
LabeledList,
NoticeBox,
ProgressBar,
Section,
Stack,
} from '../components';
import { Window } from '../layouts';

export const DiseaseIncubator = (props) => {
const { act, data } = useBackend();
const { dishes, on, can_focus } = data;
const { dishes = [], on = 0 } = data;

return (
<Window width={475} height={575}>
<Section
title="Incubator"
buttons={
<Button
icon="power-off"
content={on ? 'On' : 'Off'}
color={on ? 'green' : 'red'}
onClick={() => act('power')}
<Stack fill vertical>
<Stack.Item>
<Section
title="Incubator"
buttons={
<Button
icon="power-off"
content={on ? 'On' : 'Off'}
color={on ? 'green' : 'red'}
onClick={() => act('power')}
/>
}
/>
}
>
<Section context="Dishes">
{dishes.map((dish) => (
<Section
key={dish.name}
title={dish.name}
buttons={
<>
{' '}
<Button
content="Eject Disk"
tooltip="Eject the dish into your active hand"
disabled={!dish.dish_slot}
onClick={() => act('ejectdish', { slot: dish.dish_slot })}
/>
<Button
content="Examine"
tooltip="Examine the dish, not very useful unless examined"
disabled={!dish.dish_slot}
onClick={() => act('examinedish', { slot: dish.dish_slot })}
/>
<Button
content="Flush"
tooltip="Flush the reagents of this dish"
disabled={!dish.dish_slot}
onClick={() => act('flushdish', { slot: dish.dish_slot })}
/>
<Button
content="Focus"
tooltip="Change the Stage Focus for this dish"
disabled={!dish.dish_slot}
onClick={() => act('changefocus', { slot: dish.dish_slot })}
/>
</>
}
>
<LabeledList key={dish.name}>
<LabeledList.Item label="Growth">
{dish.growth}
</LabeledList.Item>
<LabeledList.Item label="Volume">
{dish.reagents_volume}
</LabeledList.Item>
<LabeledList.Item label="Major Mutate Count">
{dish.major_mutations}
</LabeledList.Item>
<LabeledList.Item label="Minor Mutate Strength">
{dish.minor_mutations_strength}
</LabeledList.Item>
<LabeledList.Item label="Minor Mutate Robustness">
{dish.minor_mutations_robustness}
</LabeledList.Item>
<LabeledList.Item label="Minor Mutate Effect Chance">
{dish.minor_mutations_effects}
</LabeledList.Item>
</LabeledList>
</Section>
))}
</Section>
</Section>
</Stack.Item>

<Stack.Item grow overflowY="auto">
<Section context="Dishes">
{dishes.map((dish, dishIndex) => (
<Section
key={dishIndex}
title={dish.name || 'Unnamed Dish'}
buttons={
<>
<Button
content="Eject Disk"
tooltip="Eject the dish into your active hand"
disabled={!dish.dish_slot}
onClick={() => act('ejectdish', { slot: dish.dish_slot })}
/>
<Button
content="Examine"
tooltip="Examine the dish, not very useful unless analyzed first"
disabled={!dish.dish_slot}
onClick={() =>
act('examinedish', { slot: dish.dish_slot })
}
/>
<Button
content="Flush"
tooltip="Flush the reagents of this dish"
disabled={!dish.dish_slot}
onClick={() => act('flushdish', { slot: dish.dish_slot })}
/>
<Button
content="Focus"
tooltip="Change the Stage Focus for this dish"
disabled={!dish.dish_slot}
onClick={() =>
act('changefocus', { slot: dish.dish_slot })
}
/>
</>
}
>
<ProgressBar
value={dish.growth}
minValue={0}
maxValue={100}
ranges={{
good: [70, 100],
average: [40, 70],
bad: [0, 40],
}}
>
Growth Percentage: {dish.growth}%
</ProgressBar>
<ProgressBar
value={dish.reagents_volume}
minValue={0}
maxValue={10}
ranges={{
good: [7, 10],
average: [4, 7],
bad: [0, 4],
}}
>
Reagent Volume Percentage:{' '}
{Math.round(dish.reagents_volume * 10)}%
</ProgressBar>
<LabeledList>
<LabeledList.Item label="Minor Mutate Strength">
{dish.minor_mutations_strength}
</LabeledList.Item>
<LabeledList.Item label="Minor Mutate Robustness">
{dish.minor_mutations_robustness}
</LabeledList.Item>
<LabeledList.Item label="Minor Mutate Effect Chance">
{dish.minor_mutations_effects}
</LabeledList.Item>
</LabeledList>
{Array.isArray(dish.symptom_data) &&
dish.symptom_data.length > 0 ? (
<Collapsible fill title="Symptoms">
<LabeledList>
{dish.symptom_data.map((symptom, symptomIndex) => (
<LabeledList.Item key={symptomIndex}>
<Collapsible
color="good"
key={symptomIndex}
title={symptom.name || 'Unnamed Symptom'}
>
<LabeledList>
<LabeledList.Item label="Description">
{symptom.desc || 'No description available'}
</LabeledList.Item>
<LabeledList.Item label="Strength">
{symptom.strength}
</LabeledList.Item>
<LabeledList.Item label="Max Strength">
{symptom.max_strength}
</LabeledList.Item>
<LabeledList.Item label="Chance">
{symptom.chance}%
</LabeledList.Item>
<LabeledList.Item label="Max Chance">
{symptom.max_chance}%
</LabeledList.Item>
<LabeledList.Item label="Stage">
{symptom.stage}
</LabeledList.Item>
</LabeledList>
</Collapsible>
</LabeledList.Item>
))}
</LabeledList>
</Collapsible>
) : (
<NoticeBox warn>No symptom data available.</NoticeBox>
)}
</Section>
))}
</Section>
</Stack.Item>
</Stack>
</Window>
);
};

0 comments on commit 89eee21

Please sign in to comment.