From 021756999df2e7b01772a68c0cd2ce3e74df468d Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Sat, 17 Feb 2024 09:20:03 -0500 Subject: [PATCH] Adds a global spark limit (#24197) * Adds a global spark limit * spacing * Moves logic into when the effect is actually generated * don't want this kicking around * spacing * oops --- code/_globalvars/misc_globals.dm | 4 ++++ .../objects/effects/effect_system/effects_sparks.dm | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/code/_globalvars/misc_globals.dm b/code/_globalvars/misc_globals.dm index db39391a783..69744565813 100644 --- a/code/_globalvars/misc_globals.dm +++ b/code/_globalvars/misc_globals.dm @@ -56,3 +56,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/atmospherics/supermatter_cr GLOBAL_LIST_INIT(character_physiques, list("rail thin", "thin", "average", "well-built", "muscular", "overweight")) GLOBAL_LIST_INIT(character_heights, list("very short", "short", "average height", "tall", "very tall")) + +#define GLOBAL_SPARK_LIMIT 500 +/// Counter for the current amount of sparks +GLOBAL_VAR_INIT(sparks_active, 0) diff --git a/code/game/objects/effects/effect_system/effects_sparks.dm b/code/game/objects/effects/effect_system/effects_sparks.dm index dd1736f2d9e..5c7c1254b8d 100644 --- a/code/game/objects/effects/effect_system/effects_sparks.dm +++ b/code/game/objects/effects/effect_system/effects_sparks.dm @@ -45,6 +45,17 @@ /datum/effect_system/spark_spread effect_type = /obj/effect/particle_effect/sparks +/datum/effect_system/spark_spread/generate_effect() + var/spark_budget = GLOBAL_SPARK_LIMIT - GLOB.sparks_active + if(spark_budget <= 0) + return + GLOB.sparks_active++ + return ..() + +/datum/effect_system/spark_spread/decrement_total_effect() + GLOB.sparks_active-- + return ..() + ////////////////////////////////// //////SPARKLE FIREWORKS /////////////////////////////////