[MIRROR] fix splicer (#8730)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2
2024-08-03 02:52:41 -07:00
committed by GitHub
parent 080ce1f003
commit dd9cdf4cfb
2 changed files with 10 additions and 7 deletions

View File

@@ -82,7 +82,7 @@
if(dish.growth >= 50)
var/list/effects[0]
for (var/datum/disease2/effectholder/e in dish.virus2.effects)
effects.Add(list(list("name" = (dish.analysed ? e.effect.name : "Unknown"), "stage" = (e.stage), "reference" = "\ref[e]"), "badness" = e.effect.badness))
effects.Add(list(list("name" = (dish.analysed ? e.effect.name : "Unknown"), "stage" = (e.stage), "reference" = "\ref[e]", "badness" = e.effect.badness)))
data["effects"] = effects
else
data["info"] = "Insufficient cell growth for gene splicing."

View File

@@ -45,7 +45,7 @@ export const DiseaseSplicer = (props) => {
const DiseaseSplicerVirusDish = (props) => {
const { act, data } = useBackend<Data>();
const { dish_inserted, effects, info, growth, affected_species } = data;
const { dish_inserted, effects = [], info, growth, affected_species } = data;
return (
<Section
@@ -81,13 +81,16 @@ const DiseaseSplicerVirusDish = (props) => {
) : (
<>
<Section title="Symptoms">
{(effects &&
effects.map((effect) => (
{effects!.length > 0 ? (
effects!.map((effect) => (
<Box color="label" key={effect.stage}>
({effect.stage}) {effect.name}{' '}
{effect.badness > 1 ? 'Dangerous!' : null}
</Box>
))) || <Box>No virus sample loaded.</Box>}
))
) : (
<Box>No virus sample loaded.</Box>
)}
</Section>
<Section title="Affected Species" color="label">
{!affected_species || !affected_species.length
@@ -98,8 +101,8 @@ const DiseaseSplicerVirusDish = (props) => {
<Box color="bad" mb={1}>
<i>CAUTION: Reverse engineering will destroy the viral sample.</i>
</Box>
{effects &&
effects.map((e) => (
{!!effects!.length &&
effects!.map((e) => (
<Button
key={e.stage}
icon="exchange-alt"