Refactors effect_system (#94999)

## About The Pull Request

This PR refactors ``effect_system``s to be a bit easier to use by
getting rid of ``set_up``, allowing ``attach()`` to be chained into
``start()`` and refactoring most direct system usages in our code to use
helper procs.

``set_up`` was unnecessary and only existed to allow ``New``'s behavior
to be fully overriden, which is not required if we split
sparks/lightning/steam into a new ``/datum/effect_system/basic`` subtype
which houses the effect spreading behavior. This allows us to roll all
logic from ``set_up`` into ``New`` and cut down on code complexity.
Chaining setup as ``system.attach(src).start()`` also helps a bit in
case no helper method exists

I've added ``do_chem_smoke`` and ``do_foam`` helpers, which respectively
allow chemical smoke or foam to be spawned easily without having to
manually create effect datums and reagent holders.

Also turns out we've had some nonfunctional effect systems which either
never set themselves up, or never started, so I fixed those while I was
at it (mostly by moving them to aforementioned helper procs)

## Why It's Good For The Game

Cleaner code, makes it significantly easier for users to work with. Also
most of our effect system usage was copypasta which was passing booleans
as numbers, while perfectly fine helper procs existed in our code.

## Changelog
🆑
refactor: Refactored sparks, foam, smoke, and other miscellaneous effect
systems.
refactor: Vapes now have consistent rigging with cigs using the new
system.
fix: Fixed some effects never working.
/🆑
This commit is contained in:
SmArtKar
2026-02-03 22:23:09 -05:00
committed by GitHub
parent b1e6830ec5
commit f58b8511f0
134 changed files with 621 additions and 904 deletions
@@ -484,9 +484,7 @@ Return to step 11 of normal process."}
/obj/item/restraints/handcuffs/energy/on_uncuffed(datum/source, mob/living/wearer)
. = ..()
wearer.visible_message(span_danger("[wearer]'s [name] breaks in a discharge of energy!"), span_userdanger("[wearer]'s [name] breaks in a discharge of energy!"))
var/datum/effect_system/spark_spread/sparks = new
sparks.set_up(4,0,wearer.loc)
sparks.start()
do_sparks(4, FALSE, wearer.loc)
qdel(src)
/obj/item/melee/baton/abductor/examine(mob/user)
@@ -58,9 +58,7 @@
/obj/effect/temp_visual/teleport_abductor/Initialize(mapload)
. = ..()
var/datum/effect_system/spark_spread/S = new
S.set_up(10,0,loc)
S.start()
do_sparks(10, FALSE, loc)
/obj/effect/temp_visual/teleport_golem
name = "bluespace silhouette"
@@ -106,9 +106,7 @@
color = "#d6ad8b"
/obj/item/clothing/suit/armor/reactive/psykerboost/cooldown_activation(mob/living/carbon/human/owner)
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
sparks.set_up(1, 1, src)
sparks.start()
do_sparks(1, TRUE, src)
return ..()
/obj/item/clothing/suit/armor/reactive/psykerboost/reactive_activation(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
@@ -147,8 +147,7 @@
else
human_user.gib(DROP_ALL_REMAINS)
human_user.investigate_log("has died from using telekinesis on a heretic influence.", INVESTIGATE_DEATHS)
var/datum/effect_system/reagents_explosion/explosion = new()
explosion.set_up(1, get_turf(human_user), 1)
var/datum/effect_system/reagents_explosion/explosion = new(get_turf(human_user), 1, 1, 1)
explosion.start(src)
/obj/effect/visible_heretic_influence/examine(mob/living/user)
@@ -303,8 +303,7 @@
var/obj/item/bodypart/head/head = locate() in carbon_view.bodyparts
if(!head?.dismember())
carbon_view.gib(DROP_ALL_REMAINS)
var/datum/effect_system/reagents_explosion/explosion = new()
explosion.set_up(1, get_turf(carbon_view), 1)
var/datum/effect_system/reagents_explosion/explosion = new(get_turf(carbon_view), 1, 1, 1)
explosion.start(src)
else
attempt_conversion(carbon_view, source)
@@ -57,13 +57,7 @@
return ..()
/obj/machinery/nuclearbomb/beer/proc/local_foam()
var/datum/reagents/tmp_holder = new/datum/reagents(1000)
tmp_holder.my_atom = src
tmp_holder.add_reagent(flood_reagent, 100)
var/datum/effect_system/fluid_spread/foam/foam = new
foam.set_up(200, holder = src, location = get_turf(src), carry = tmp_holder)
foam.start()
do_foam(200, src, get_turf(src), flood_reagent, 100)
disarm_nuke()
/obj/machinery/nuclearbomb/beer/really_actually_explode(detonation_status)
@@ -36,14 +36,13 @@
max_integrity = 200
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
item_flags = NEEDS_PERMIT
var/datum/effect_system/spark_spread/spark_system
var/datum/effect_system/basic/spark_spread/spark_system
var/datum/action/innate/dash/ninja/jaunt
/obj/item/energy_katana/Initialize(mapload)
. = ..()
jaunt = new(src)
spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system = new(src, 5, FALSE)
spark_system.attach(src)
/obj/item/energy_katana/ranged_interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers)
@@ -105,9 +105,8 @@
/obj/item/mjollnir/proc/shock(mob/living/target)
target.Stun(1.5 SECONDS)
target.Knockdown(10 SECONDS)
var/datum/effect_system/lightning_spread/s = new /datum/effect_system/lightning_spread
s.set_up(5, 1, target.loc)
s.start()
var/datum/effect_system/basic/lightning_spread/lightning = new(target.loc, 5, TRUE)
lightning.start()
target.visible_message(span_danger("[target.name] is shocked by [src]!"), \
span_userdanger("You feel a powerful shock course through your body sending you flying!"), \
span_hear("You hear a heavy electrical crack!"))
@@ -247,9 +247,7 @@
/datum/grand_side_effect/smoke/trigger(potency, turf/ritual_location, mob/invoker)
playsound(src, 'sound/effects/magic/smoke.ogg', 50, TRUE)
var/range = LERP(2, 4, potency/GRAND_RITUAL_FINALE_COUNT)
var/datum/effect_system/fluid_spread/smoke/colourful/smoke = new
smoke.set_up(range, holder = ritual_location, location = ritual_location)
smoke.start()
do_smoke(round(range), ritual_location, ritual_location, smoke_type = /datum/effect_system/fluid_spread/smoke/colourful)
/// Spawns randomly coloured smoke
/datum/effect_system/fluid_spread/smoke/colourful