mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
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:
@@ -12,7 +12,7 @@
|
||||
max_integrity = 100
|
||||
/// list of emotes whose cd is overridden by this skillchip. can be edited in mapping or ingame
|
||||
var/list/affected_emotes = list("spin", "flip", "backflip")
|
||||
var/datum/effect_system/spark_spread/sparks
|
||||
var/datum/effect_system/basic/spark_spread/sparks
|
||||
/// you can use this without lowering integrity! let's be honest. nobody's doing that
|
||||
var/allowed_usage = 5
|
||||
/// How many seconds does it take for it to recover one allowed usage
|
||||
@@ -49,7 +49,8 @@
|
||||
take_damage(1, sound_effect = FALSE)
|
||||
|
||||
if(!sparks)
|
||||
sparks = new(src)
|
||||
sparks = new(src, 5, FALSE)
|
||||
sparks.attach(src)
|
||||
|
||||
// minimum roll is by default capped at 50, with the min value lowering as integrity is reduced.
|
||||
var/mintegrity = clamp(50 - (100 - get_integrity()), 1, 100)
|
||||
@@ -84,8 +85,7 @@
|
||||
|
||||
// does not necessarily kill you directly. instead it causes cranial fissure + something to drop from your head. could be eyes, tongue, ears, brain, even implants
|
||||
new /obj/effect/gibspawner/generic(get_turf(bozo), bozo)
|
||||
|
||||
sparks.set_up(15, cardinals_only = FALSE, location = get_turf(src))
|
||||
sparks.amount = 15
|
||||
sparks.start()
|
||||
|
||||
qdel(src)
|
||||
@@ -101,8 +101,7 @@
|
||||
bozo.set_eye_blur_if_lower(10 SECONDS)
|
||||
// but the rest of the effects will happen either way
|
||||
bozo.adjust_organ_loss(ORGAN_SLOT_BRAIN, 20 - get_integrity())
|
||||
|
||||
sparks.set_up(5, cardinals_only = FALSE, location = get_turf(src))
|
||||
sparks.amount = 5
|
||||
sparks.start()
|
||||
|
||||
// brain Smoking. you should probably stop now
|
||||
@@ -142,8 +141,7 @@
|
||||
particle_effect.set_particle_position(-2, 12, 0)
|
||||
bozo.apply_status_effect(/datum/status_effect/temperature_over_time/chip_overheat, 15 SECONDS)
|
||||
QDEL_IN(particle_effect, 15 SECONDS)
|
||||
|
||||
sparks.set_up(10, cardinals_only = FALSE, location = get_turf(src))
|
||||
sparks.amount = 10
|
||||
sparks.start()
|
||||
|
||||
// hey, something isn't right...
|
||||
@@ -152,7 +150,7 @@
|
||||
span_warning("[bozo]'s head sparks."),
|
||||
)
|
||||
|
||||
sparks.set_up(rand(1,2), cardinals_only = TRUE, location = get_turf(src))
|
||||
sparks.amount = rand(1, 2)
|
||||
sparks.start()
|
||||
|
||||
return COMPONENT_EMOTE_COOLDOWN_BYPASS
|
||||
|
||||
Reference in New Issue
Block a user