From 2b0f9c74a37ebd73e126e25f655b357edbd07e28 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sun, 1 Dec 2024 00:35:27 -0500 Subject: [PATCH] Clean up and fix bluespace varient code --- .../disease/symptom_varients/bluespace.dm | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/monkestation/code/modules/virology/disease/symptom_varients/bluespace.dm b/monkestation/code/modules/virology/disease/symptom_varients/bluespace.dm index 1535df0d293e..e4f302d75da0 100644 --- a/monkestation/code/modules/virology/disease/symptom_varients/bluespace.dm +++ b/monkestation/code/modules/virology/disease/symptom_varients/bluespace.dm @@ -1,4 +1,4 @@ -GLOBAL_LIST_INIT(bluespace_varient_list, list()) +GLOBAL_LIST_EMPTY_TYPED(bluespace_varient_list, /datum/symptom_varient/bluespace) /datum/symptom_varient/bluespace name = "Quantumly Entangled" @@ -10,11 +10,12 @@ GLOBAL_LIST_INIT(bluespace_varient_list, list()) var/bluespace_id = 0 var/static/last_bluespace_id = 0 -/datum/symptom_varient/bluespace/New(datum/symptom/host) +/datum/symptom_varient/bluespace/New(datum/symptom/host, bluespace_id) . = ..() GLOB.bluespace_varient_list += src - last_bluespace_id++ - bluespace_id = last_bluespace_id + if(isnull(bluespace_id)) + bluespace_id = last_bluespace_id++ + src.bluespace_id = bluespace_id /datum/symptom_varient/bluespace/Destroy(force) GLOB.bluespace_varient_list -= src @@ -24,15 +25,11 @@ GLOBAL_LIST_INIT(bluespace_varient_list, list()) . = ..() RegisterSignal(host_symptom, COMSIG_SYMPTOM_TRIGGER, PROC_REF(propagate)) -/datum/symptom_varient/bluespace/proc/propagate() - for(var/datum/symptom_varient/bluespace/bluespace as anything in GLOB.bluespace_varient_list) - if(bluespace_id != bluespace.bluespace_id) - continue - COOLDOWN_START(bluespace, host_cooldown, cooldown_time) +/datum/symptom_varient/bluespace/Copy(datum/symptom/new_symp) + return new /datum/symptom_varient/bluespace(new_symp, bluespace_id) +/datum/symptom_varient/bluespace/proc/propagate() for(var/datum/symptom_varient/bluespace/bluespace as anything in GLOB.bluespace_varient_list) - if(bluespace_id != bluespace.bluespace_id) - continue - if(!bluespace.host_disease) + if(QDELETED(bluespace) || bluespace_id != bluespace.bluespace_id) continue - bluespace.host_symptom.run_effect(bluespace.host_disease.return_parent(), bluespace.host_disease) + bluespace.trigger_symptom()