Files
SmArtKar f58b8511f0 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.
/🆑
2026-02-03 22:23:09 -05:00

31 lines
1.2 KiB
Plaintext

//Reagent-based explosion effect
/datum/effect_system/reagents_explosion
/// Explosive power
var/amount
/// Factor of how powerful the flash effect relatively to the explosion
var/flashing_factor = null
/// Factor of how powerful the flame effect is relatively to explosion
var/flaming_factor = null
/// Whether we show a message to mobs.
var/explosion_message = 1
/datum/effect_system/reagents_explosion/New(turf/location, amount, flash_fact = null, flame_fact = null, message = TRUE)
. = ..()
src.amount = amount
explosion_message = message
if (!isturf(location))
location = get_turf(location)
flashing_factor = flash_fact
flaming_factor = flame_fact
/// Starts the explosion. The explosion_source is as part of logging and identifying the source of the explosion for logs.
/datum/effect_system/reagents_explosion/start(atom/explosion_source = null)
if(!explosion_source)
stack_trace("Reagent explosion triggered without a source atom. This explosion may have incomplete logging.")
if(explosion_message)
location.visible_message(span_danger("The solution violently explodes!"), span_hear("You hear an explosion!"))
dyn_explosion(location, amount, flash_range = flashing_factor, flame_range = flaming_factor, explosion_cause = explosion_source)