From a8a2449805d43ecce8f16b4f21faf8182864984e Mon Sep 17 00:00:00 2001 From: Lucy Date: Tue, 30 Jul 2024 22:09:01 -0400 Subject: [PATCH 1/6] Fix up code relating to pathogen clouds / infections --- code/__DEFINES/subsystems.dm | 2 +- .../disease/base_disease_folder/_base.dm | 8 +- .../modules/virology/effects/cleanables.dm | 30 ++-- .../virology/effects/pathogen_cloud.dm | 154 +++++++++--------- .../virology/living/infection_procs.dm | 90 +++++----- .../virology/subsystems/pathogen_clouds.dm | 26 +-- 6 files changed, 159 insertions(+), 151 deletions(-) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 744d84495e3a..26bca1c22fc9 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -205,6 +205,7 @@ #define FIRE_PRIORITY_AMBIENCE 10 #define FIRE_PRIORITY_GARBAGE 15 #define FIRE_PRIORITY_DATABASE 16 +#define FIRE_PRIORITY_PATHOGEN 18 #define FIRE_PRIORITY_WET_FLOORS 20 #define FIRE_PRIORITY_FLUIDS 20 #define FIRE_PRIORITY_AIR 20 @@ -220,7 +221,6 @@ #define FIRE_PRIORITY_REAGENTS 26 #define FIRE_PRIORITY_SPACEDRIFT 30 #define FIRE_PRIORITY_HOTSPOT 30 -#define FIRE_PRIORITY_PATHOGEN 31 #define FIRE_PRIORITY_SMOOTHING 35 #define FIRE_PRIORITY_OBJ 40 #define FIRE_PRIORITY_ACID 40 diff --git a/monkestation/code/modules/virology/disease/base_disease_folder/_base.dm b/monkestation/code/modules/virology/disease/base_disease_folder/_base.dm index fcb845a452ef..b380fbe7557b 100644 --- a/monkestation/code/modules/virology/disease/base_disease_folder/_base.dm +++ b/monkestation/code/modules/virology/disease/base_disease_folder/_base.dm @@ -155,7 +155,7 @@ GLOBAL_LIST_INIT(virusDB, list()) return if(mob.immune_system) - if(prob(10 - (robustness * 0.01))) //100 robustness don't auto cure + if(SPT_PROB(10 - (robustness * 0.01), seconds_per_tick)) //100 robustness don't auto cure mob.immune_system.NaturalImmune() if(!mob.immune_system.CanInfect(src)) @@ -176,11 +176,11 @@ GLOBAL_LIST_INIT(virusDB, list()) ticks += 10 else logged_virusfood=0 - if(prob(strength * 0.1)) + if(SPT_PROB(strength * 0.1, seconds_per_tick)) incubate(mob, 1) //Moving to the next stage - if(ticks > stage*100 && prob(stageprob)) + if(ticks > (stage * 100) && SPT_PROB(stageprob, seconds_per_tick)) incubate(mob, 1) if(stage < max_stages) log += "
[ROUND_TIME()] NEXT STAGE ([stage])" @@ -222,7 +222,7 @@ GLOBAL_LIST_INIT(virusDB, list()) if (MOB_SIZE_HUGE) mob.bodytemperature += fever*2 - if (fever > 0 && prob(3)) + if (fever > 0 && SPT_PROB(3, seconds_per_tick)) switch (fever_warning) if (0) to_chat(mob, span_warning("You feel a fever coming on, your body warms up and your head hurts a bit.")) diff --git a/monkestation/code/modules/virology/effects/cleanables.dm b/monkestation/code/modules/virology/effects/cleanables.dm index 9e7d738b5b0e..d6ea6096fc69 100644 --- a/monkestation/code/modules/virology/effects/cleanables.dm +++ b/monkestation/code/modules/virology/effects/cleanables.dm @@ -1,21 +1,27 @@ -GLOBAL_LIST_INIT(infected_cleanables, list()) +GLOBAL_LIST_EMPTY_TYPED(infected_cleanables, /obj/effect/decal/cleanable) /obj/effect/decal/cleanable/Initialize(mapload, list/datum/disease/diseases) + ..() + return INITIALIZE_HINT_LATELOAD + +/obj/effect/decal/cleanable/LateInitialize() . = ..() - spawn(1)//cleanables can get infected in many different ways when they spawn so it's much easier to handle the pathogen overlay here after a delay - if (src.diseases && length(src.diseases)) - GLOB.infected_cleanables += src - if (!pathogen) - pathogen = image('monkestation/code/modules/virology/icons/effects.dmi',src,"pathogen_blood") - pathogen.plane = HUD_PLANE - pathogen.appearance_flags = RESET_COLOR|RESET_ALPHA - for (var/mob/L in GLOB.science_goggles_wearers) - if (L.client) - L.client.images |= pathogen + addtimer(CALLBACK(src, PROC_REF(handle_pathogen_images)), 0.1 SECONDS, TIMER_DELETE_ME) + +/obj/effect/decal/cleanable/proc/handle_pathogen_images() + if(!length(diseases)) + return + GLOB.infected_cleanables += src + if(!pathogen) + pathogen = image('monkestation/code/modules/virology/icons/effects.dmi', src, "pathogen_blood") + pathogen.plane = HUD_PLANE + pathogen.appearance_flags = RESET_COLOR|RESET_ALPHA + for (var/mob/wearer in GLOB.science_goggles_wearers) + wearer.client?.images |= pathogen /obj/effect/decal/cleanable/Destroy() - . = ..() GLOB.infected_cleanables -= src + return ..() /obj/effect/decal/cleanable/Entered(mob/living/perp) ..() diff --git a/monkestation/code/modules/virology/effects/pathogen_cloud.dm b/monkestation/code/modules/virology/effects/pathogen_cloud.dm index 42dd86e2b459..1ee0d216d353 100644 --- a/monkestation/code/modules/virology/effects/pathogen_cloud.dm +++ b/monkestation/code/modules/virology/effects/pathogen_cloud.dm @@ -13,7 +13,7 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) anchored = 0 density = 0 var/mob/source = null - var/sourceIsCarrier = TRUE + var/source_is_carrier = TRUE var/list/viruses = list() var/lifetime = 10 SECONDS //how long until we naturally disappear, humans breath about every 8 seconds, so it has to survive at least this long to have a chance to infect var/turf/target = null //when created, we'll slowly move toward this turf @@ -23,105 +23,105 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) var/list/id_list = list() var/death = 0 -/obj/effect/pathogen_cloud/New(turf/loc, mob/sourcemob, list/virus, isCarrier = TRUE, isCore = TRUE) - ..() - if (!loc || !virus || virus.len <= 0) - qdel(src) - return - core = isCore - sourceIsCarrier = isCarrier - GLOB.pathogen_clouds += src - - viruses = virus +/obj/effect/pathogen_cloud/Initialize(mob/source, list/viruses, is_carrier = TRUE, is_core = TRUE) + . = ..() + if (QDELETED(loc) || !length(viruses)) + return INITIALIZE_HINT_QDEL + src.source = source + src.viruses = viruses + src.source_is_carrier = is_carrier + src.core = is_core - for(var/datum/disease/advanced/D as anything in viruses) - id_list += "[D.uniqueID]-[D.subID]" + for(var/datum/disease/advanced/virus as anything in viruses) + id_list += "[virus.uniqueID]-[virus.subID]" if(!core) - var/obj/effect/pathogen_cloud/core/core = locate(/obj/effect/pathogen_cloud/core) in src.loc - if(get_turf(core) == get_turf(src)) - for(var/datum/disease/advanced/V as anything in viruses) - if("[V.uniqueID]-[V.subID]" in core.id_list) + var/obj/effect/pathogen_cloud/core/existing_core = locate(/obj/effect/pathogen_cloud/core) in src.loc + if(!QDELETED(existing_core)) + for(var/datum/disease/advanced/virus as anything in viruses) + if("[virus.uniqueID]-[virus.subID]" in existing_core.id_list) continue - core.viruses |= V.Copy() - core.modified = TRUE - qdel(src) + existing_core.viruses |= virus.Copy() + existing_core.modified = TRUE + return INITIALIZE_HINT_QDEL - if(istype(src, /obj/effect/pathogen_cloud/core)) - SSpathogen_clouds.cores += src - else - SSpathogen_clouds.clouds += src + GLOB.pathogen_clouds += src + register() - pathogen = image('monkestation/code/modules/virology/icons/96x96.dmi',src,"pathogen_airborne") + pathogen = image('monkestation/code/modules/virology/icons/96x96.dmi', src, "pathogen_airborne") pathogen.plane = HUD_PLANE - pathogen.appearance_flags = RESET_COLOR|RESET_ALPHA - for (var/mob/living/L as anything in GLOB.science_goggles_wearers) - if (L.client) - L.client.images |= pathogen + pathogen.appearance_flags = RESET_COLOR | RESET_ALPHA + for (var/mob/living/wearer in GLOB.science_goggles_wearers) + wearer.client?.images |= pathogen - source = sourcemob + if(lifetime) + QDEL_IN(src, lifetime) - death = world.time + lifetime +/obj/effect/pathogen_cloud/Destroy() + GLOB.pathogen_clouds -= src + unregister() + if(pathogen) + for(var/mob/living/wearer in GLOB.science_goggles_wearers) + wearer.client?.images -= pathogen + pathogen = null + source = null + viruses = null + target = null + return ..() - START_PROCESSING(SSpathogen_processing, src) +/obj/effect/pathogen_cloud/proc/register() + SSpathogen_clouds.clouds += src -/obj/effect/pathogen_cloud/process(seconds_per_tick) - if(death <= world.time) - qdel(src) - return PROCESS_KILL +/obj/effect/pathogen_cloud/proc/unregister() + SSpathogen_clouds.clouds -= src + SSpathogen_clouds.current_run_clouds -= src /obj/effect/pathogen_cloud/core core = TRUE -/obj/effect/pathogen_cloud/Destroy() - . = ..() - STOP_PROCESSING(SSpathogen_processing, src) - - if(istype(src, /obj/effect/pathogen_cloud/core)) - SSpathogen_clouds.cores -= src - SSpathogen_clouds.current_run_cores -= src - else - SSpathogen_clouds.clouds -= src - SSpathogen_clouds.current_run_clouds -= src - - if (pathogen) - for (var/mob/living/L in GLOB.science_goggles_wearers) - if (L.client) - L.client.images -= pathogen - pathogen = null - GLOB.pathogen_clouds -= src - source = null - viruses = list() - lifetime = 3 - target = null +/obj/effect/pathogen_cloud/core/Initialize(mapload, list/viruses, is_carrier = TRUE, is_core = TRUE) . = ..() - -/obj/effect/pathogen_cloud/core/New(turf/loc, mob/sourcemob, list/virus) - ..() - if (!loc || !virus || virus.len <= 0) + if(.) return - var/strength = 0 - for (var/datum/disease/advanced/V as anything in viruses) - strength += V.infectionchance - strength = round(strength/viruses.len) - var/list/possible_turfs = list() - for (var/turf/open/T in range(max(0,(strength/20)-1),loc))//stronger viruses can reach turfs further away. - if(isclosedturf(T)) - continue - possible_turfs += T - target = pick(possible_turfs) + for (var/datum/disease/advanced/virus as anything in viruses) + strength += virus.infectionchance + strength = round(strength / length(viruses)) + var/spread_range = max(0, (strength / 20) - 1) + if(spread_range > 0) + var/list/possible_turfs = list() + for(var/turf/open/turf as anything in RANGE_TURFS(spread_range, loc)) //stronger viruses can reach turfs further away. + if(!isopenturf(turf) || QDELING(turf)) + continue + possible_turfs += turf + if(length(possible_turfs)) + target = pick(possible_turfs) + START_PROCESSING(SSpathogen_processing, src) + +/obj/effect/pathogen_cloud/core/Destroy() + STOP_PROCESSING(SSpathogen_processing, src) + return ..() + +/obj/effect/pathogen_cloud/core/register() + SSpathogen_clouds.cores += src +/obj/effect/pathogen_cloud/core/unregister() + SSpathogen_clouds.cores -= src + SSpathogen_clouds.current_run_cores -= src /obj/effect/pathogen_cloud/core/process(seconds_per_tick) - . = ..() + if(!moving) + return PROCESS_KILL var/turf/open/turf = get_turf(src) + if(!istype(turf) || QDELING(turf)) + qdel(src) + return PROCESS_KILL if ((turf != target) && moving) - if (prob(75)) - if(!step_towards(src,target)) // we hit a wall and our momentum is shattered + if(!QDELETED(target) && SPT_PROB(75, seconds_per_tick)) + if(!step_towards(src, target)) // we hit a wall and our momentum is shattered moving = FALSE else step_rand(src) - var/obj/effect/pathogen_cloud/C = new /obj/effect/pathogen_cloud(turf, source, viruses, sourceIsCarrier, FALSE) - C.modified = modified - C.moving = FALSE + var/obj/effect/pathogen_cloud/new_cloud = new(turf, source, viruses, source_is_carrier, FALSE) + new_cloud.modified = src.modified + new_cloud.moving = FALSE diff --git a/monkestation/code/modules/virology/living/infection_procs.dm b/monkestation/code/modules/virology/living/infection_procs.dm index 543ba3891c78..ba1b834c6bdc 100644 --- a/monkestation/code/modules/virology/living/infection_procs.dm +++ b/monkestation/code/modules/virology/living/infection_procs.dm @@ -69,67 +69,67 @@ //Called in Life() by humans (in handle_breath.dm), monkeys and mice /mob/living/proc/breath_airborne_diseases()//only tries to find Airborne spread diseases. Blood and Contact ones are handled by find_nearby_disease() - if (!check_airborne_sterility() && isturf(loc))//checking for sterile mouth protections - breath_airborne_diseases_from_clouds() - - var/turf/T = get_turf(src) - var/list/breathable_cleanable_types = list( - /obj/effect/decal/cleanable/blood, - /obj/effect/decal/cleanable/vomit, - ) - - for(var/obj/effect/decal/cleanable/C in T) - if (is_type_in_list(C,breathable_cleanable_types)) - if(istype(C.diseases,/list) && C.diseases.len > 0) - for(var/datum/disease/advanced/V as anything in C.diseases) - if(V.spread_flags & DISEASE_SPREAD_AIRBORNE) - infect_disease(V, notes="(Airborne, from [C])") - /* - for(var/obj/effect/rune/R in T) - if(istype(R.virus2,/list) && R.virus2.len > 0) - for(var/datum/disease/advanced/V as anything in R.diseases) - if(V.spread_flags & DISEASE_SPREAD_AIRBORNE) - infect_disease(V, notes="(Airborne, from [R])") - */ + if (check_airborne_sterility() || !isturf(loc)) //checking for sterile mouth protections + return + breath_airborne_diseases_from_clouds() - spawn (1) - //we don't want the rest of the mobs to start breathing clouds before they've settled down - //otherwise it can produce exponential amounts of lag if many mobs are in an enclosed space - spread_airborne_diseases() + var/turf/T = get_turf(src) + var/list/breathable_cleanable_types = list( + /obj/effect/decal/cleanable/blood, + /obj/effect/decal/cleanable/vomit, + ) + + for(var/obj/effect/decal/cleanable/C in T) + if (is_type_in_list(C,breathable_cleanable_types)) + if(istype(C.diseases,/list) && C.diseases.len > 0) + for(var/datum/disease/advanced/V as anything in C.diseases) + if(V.spread_flags & DISEASE_SPREAD_AIRBORNE) + infect_disease(V, notes="(Airborne, from [C])") + /* + for(var/obj/effect/rune/R in T) + if(istype(R.virus2,/list) && R.virus2.len > 0) + for(var/datum/disease/advanced/V as anything in R.diseases) + if(V.spread_flags & DISEASE_SPREAD_AIRBORNE) + infect_disease(V, notes="(Airborne, from [R])") + */ + + // We don't want the rest of the mobs to start breathing clouds before they've settled down + // Otherwise it can produce exponential amounts of lag if many mobs are in an enclosed space + INVOKE_ASYNC(src, PROC_REF(spread_airborne_diseases)) /mob/living/proc/breath_airborne_diseases_from_clouds() - for(var/turf/T in range(1, src)) + for(var/turf/open/turf as anything in RANGE_TURFS(1, src)) + if(!isopenturf(turf) || QDELING(turf)) + continue var/sanity = 0 - for(var/obj/effect/pathogen_cloud/cloud in T.contents) + for(var/obj/effect/pathogen_cloud/cloud in turf.contents) if(sanity > 10) break sanity++ //anything more than 10 and you aint getting air really - if (!cloud.sourceIsCarrier || cloud.source != src || cloud.modified) - if (Adjacent(cloud)) - for (var/datum/disease/advanced/V in cloud.viruses) - //if (V.spread & SPREAD_AIRBORNE) //Anima Syndrome allows for clouds of non-airborne viruses - infect_disease(V, notes="(Airborne, from a pathogenic cloud[cloud.source ? " created by [key_name(cloud.source)]" : ""])") + if(!Adjacent(cloud)) + continue + if(!cloud.source_is_carrier || cloud.source != src || cloud.modified) + for (var/datum/disease/advanced/virus as anything in cloud.viruses) + //if (V.spread & SPREAD_AIRBORNE) //Anima Syndrome allows for clouds of non-airborne viruses + infect_disease(virus, notes="(Airborne, from a pathogenic cloud[cloud.source ? " created by [key_name(cloud.source)]" : ""])") /mob/living/proc/handle_virus_updates(seconds_per_tick) if(status_flags & GODMODE) - return 0 - + return FALSE find_nearby_disease()//getting diseases from blood/mucus/vomit splatters and open dishes - activate_diseases(seconds_per_tick) /mob/living/proc/activate_diseases(seconds_per_tick) if (length(diseases)) var/active_disease = pick(diseases)//only one disease will activate its effects at a time. - for (var/datum/disease/advanced/V as anything in diseases) - if(istype(V)) - V.activate(src, active_disease != V, seconds_per_tick) - - if(HAS_TRAIT(src, TRAIT_IRRADIATED)) - if (prob(50))//radiation turns your body into an inefficient pathogenic incubator. - V.incubate(src, 1) - //effect mutations won't occur unless the mob also has ingested mutagen - //and even if they occur, the new effect will have a badness similar to the old one, so helpful pathogen won't instantly become deadly ones. + for (var/datum/disease/advanced/virus as anything in diseases) + if(!istype(virus)) + continue + virus.activate(src, active_disease != virus, seconds_per_tick) + if(HAS_TRAIT(src, TRAIT_IRRADIATED) && SPT_PROB(50, seconds_per_tick)) //radiation turns your body into an inefficient pathogenic incubator. + virus.incubate(src, 1) + //effect mutations won't occur unless the mob also has ingested mutagen + //and even if they occur, the new effect will have a badness similar to the old one, so helpful pathogen won't instantly become deadly ones. else //Slowly decay back to regular strength immune system while you are sick if(immune_system?.strength > 1) diff --git a/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm b/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm index 6d3c50b01d7c..13445776be86 100644 --- a/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm +++ b/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm @@ -3,7 +3,7 @@ SUBSYSTEM_DEF(pathogen_clouds) init_order = INIT_ORDER_PATHOGEN priority = FIRE_PRIORITY_PATHOGEN wait = 1 SECONDS - flags = SS_BACKGROUND + flags = SS_NO_INIT | SS_BACKGROUND runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME var/list/current_run_cores = list() @@ -20,22 +20,24 @@ SUBSYSTEM_DEF(pathogen_clouds) msg += "Clouds:[length(clouds)]" return ..() - -/datum/controller/subsystem/pathogen_clouds/Initialize() - return SS_INIT_SUCCESS - /datum/controller/subsystem/pathogen_clouds/fire(resumed = FALSE) if(!length(cores) && !length(clouds)) - current_run_clouds = list() - current_run_cores = list() + current_run_clouds.Cut() + current_run_cores.Cut() return + list_clear_nulls(clouds) + list_clear_nulls(cores) + if(current_run_level == "clouds") + list_clear_nulls(current_run_clouds) for(var/obj/effect/pathogen_cloud/cloud as anything in current_run_clouds) - if(QDELETED(cloud) || isnull(cloud)) + if(QDELETED(cloud)) current_run_clouds -= cloud continue + if(MC_TICK_CHECK) + return //If we exist ontop of a core transfer viruses and die unless parent this means something moved back. //This should prevent mobs breathing in hundreds of clouds at once for(var/obj/effect/pathogen_cloud/core/core in cloud.loc) @@ -45,7 +47,6 @@ SUBSYSTEM_DEF(pathogen_clouds) core.viruses |= V.Copy() core.modified = TRUE qdel(cloud) - CHECK_TICK current_run_clouds -= cloud current_run_level = "cores" if(!length(current_run_clouds)) @@ -55,11 +56,13 @@ SUBSYSTEM_DEF(pathogen_clouds) current_run_clouds = clouds.Copy() if(current_run_level == "cores") + list_clear_nulls(current_run_cores) for(var/obj/effect/pathogen_cloud/core as anything in current_run_cores) - if(QDELETED(core) || isnull(core)) + if(QDELETED(core)) current_run_cores -= core continue - + if(MC_TICK_CHECK) + return if(!core.moving || core.target == get_turf(core)) for (var/obj/effect/pathogen_cloud/core/other_C in core.loc) if(other_C == core) @@ -71,7 +74,6 @@ SUBSYSTEM_DEF(pathogen_clouds) core.viruses |= V.Copy() core.modified = TRUE qdel(other_C) - CHECK_TICK core.moving = FALSE current_run_cores -= core current_run_level = "clouds" From ed55311adbcd509e3f40a84bc6de0a1f1472f18b Mon Sep 17 00:00:00 2001 From: Lucy Date: Thu, 8 Aug 2024 16:14:59 -0400 Subject: [PATCH 2/6] OH DAMMIT --- monkestation/code/modules/virology/effects/pathogen_cloud.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkestation/code/modules/virology/effects/pathogen_cloud.dm b/monkestation/code/modules/virology/effects/pathogen_cloud.dm index 1ee0d216d353..cf131df4ec2b 100644 --- a/monkestation/code/modules/virology/effects/pathogen_cloud.dm +++ b/monkestation/code/modules/virology/effects/pathogen_cloud.dm @@ -23,7 +23,7 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) var/list/id_list = list() var/death = 0 -/obj/effect/pathogen_cloud/Initialize(mob/source, list/viruses, is_carrier = TRUE, is_core = TRUE) +/obj/effect/pathogen_cloud/Initialize(mapload, mob/source, list/viruses, is_carrier = TRUE, is_core = TRUE) . = ..() if (QDELETED(loc) || !length(viruses)) return INITIALIZE_HINT_QDEL @@ -79,7 +79,7 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) /obj/effect/pathogen_cloud/core core = TRUE -/obj/effect/pathogen_cloud/core/Initialize(mapload, list/viruses, is_carrier = TRUE, is_core = TRUE) +/obj/effect/pathogen_cloud/core/Initialize(mapload, mob/source, list/viruses, is_carrier = TRUE, is_core = TRUE) . = ..() if(.) return From 11c9d77127e699bc0c5d588d841441b01f8284c5 Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 9 Aug 2024 04:16:29 -0400 Subject: [PATCH 3/6] Add metrics to SSpathogen_clouds --- .../code/modules/virology/subsystems/pathogen_clouds.dm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm b/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm index 13445776be86..de1cbf17575c 100644 --- a/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm +++ b/monkestation/code/modules/virology/subsystems/pathogen_clouds.dm @@ -79,3 +79,12 @@ SUBSYSTEM_DEF(pathogen_clouds) current_run_level = "clouds" if(!length(current_run_cores)) current_run_cores = cores.Copy() + +/datum/controller/subsystem/pathogen_clouds/get_metrics() + . = ..() + .["custom"] = list( + "cores" = length(cores), + "clouds" = length(clouds), + "current_run_cores" = length(current_run_cores), + "current_run_clouds" = length(current_run_clouds), + ) From 5dca726cf0298d5d4bd63f4d2fca472d3662d507 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 10 Aug 2024 23:27:27 -0400 Subject: [PATCH 4/6] use explicit lazylists --- .../code/modules/virology/effects/pathogen_cloud.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/monkestation/code/modules/virology/effects/pathogen_cloud.dm b/monkestation/code/modules/virology/effects/pathogen_cloud.dm index cf131df4ec2b..877bf5a84bfc 100644 --- a/monkestation/code/modules/virology/effects/pathogen_cloud.dm +++ b/monkestation/code/modules/virology/effects/pathogen_cloud.dm @@ -14,18 +14,18 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) density = 0 var/mob/source = null var/source_is_carrier = TRUE - var/list/viruses = list() + var/list/viruses var/lifetime = 10 SECONDS //how long until we naturally disappear, humans breath about every 8 seconds, so it has to survive at least this long to have a chance to infect var/turf/target = null //when created, we'll slowly move toward this turf var/core = FALSE var/modified = FALSE var/moving = TRUE - var/list/id_list = list() + var/list/id_list var/death = 0 /obj/effect/pathogen_cloud/Initialize(mapload, mob/source, list/viruses, is_carrier = TRUE, is_core = TRUE) . = ..() - if (QDELETED(loc) || !length(viruses)) + if (QDELETED(loc) || !LAZYLEN(viruses)) return INITIALIZE_HINT_QDEL src.source = source src.viruses = viruses @@ -33,7 +33,7 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) src.core = is_core for(var/datum/disease/advanced/virus as anything in viruses) - id_list += "[virus.uniqueID]-[virus.subID]" + LAZYADD(id_list, "[virus.uniqueID]-[virus.subID]") if(!core) var/obj/effect/pathogen_cloud/core/existing_core = locate(/obj/effect/pathogen_cloud/core) in src.loc @@ -41,7 +41,7 @@ GLOBAL_LIST_INIT(science_goggles_wearers, list()) for(var/datum/disease/advanced/virus as anything in viruses) if("[virus.uniqueID]-[virus.subID]" in existing_core.id_list) continue - existing_core.viruses |= virus.Copy() + LAZYOR(existing_core.viruses, virus.Copy()) existing_core.modified = TRUE return INITIALIZE_HINT_QDEL From 595e7f6be6e69afc7d5644845af0bd399ad0280c Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 10 Aug 2024 23:27:48 -0400 Subject: [PATCH 5/6] this is why global_list_empty exists --- monkestation/code/modules/virology/effects/pathogen_cloud.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkestation/code/modules/virology/effects/pathogen_cloud.dm b/monkestation/code/modules/virology/effects/pathogen_cloud.dm index 877bf5a84bfc..dfbc1cdd2bc2 100644 --- a/monkestation/code/modules/virology/effects/pathogen_cloud.dm +++ b/monkestation/code/modules/virology/effects/pathogen_cloud.dm @@ -1,5 +1,5 @@ -GLOBAL_LIST_INIT(pathogen_clouds, list()) -GLOBAL_LIST_INIT(science_goggles_wearers, list()) +GLOBAL_LIST_EMPTY(pathogen_clouds) +GLOBAL_LIST_EMPTY(science_goggles_wearers) /obj/effect/pathogen_cloud name = "" From 19fcb3105196653f43f216ec0ed7a24093d740c4 Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 10 Aug 2024 23:30:38 -0400 Subject: [PATCH 6/6] OKAY YEAH NO SPREADING THRU WALLS, WHOOPSIE DAISY --- monkestation/code/modules/virology/effects/pathogen_cloud.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkestation/code/modules/virology/effects/pathogen_cloud.dm b/monkestation/code/modules/virology/effects/pathogen_cloud.dm index dfbc1cdd2bc2..b65d34841481 100644 --- a/monkestation/code/modules/virology/effects/pathogen_cloud.dm +++ b/monkestation/code/modules/virology/effects/pathogen_cloud.dm @@ -90,7 +90,7 @@ GLOBAL_LIST_EMPTY(science_goggles_wearers) var/spread_range = max(0, (strength / 20) - 1) if(spread_range > 0) var/list/possible_turfs = list() - for(var/turf/open/turf as anything in RANGE_TURFS(spread_range, loc)) //stronger viruses can reach turfs further away. + for(var/turf/open/turf as anything in view(spread_range, loc)) //stronger viruses can reach turfs further away. if(!isopenturf(turf) || QDELING(turf)) continue possible_turfs += turf