Partial sparks boilerplate reduction (#26081)

* Partial sparks boilerplate reduction

- Lots of obects are making `/datum/effect_system/spark_spread`, setting
them up, firing them, and then not qdeling them afterwards.
- Makes a `do_sparks` global proc that takes the same arguments as `set_up`
and then calls `start` and then `qdel`
- Switches a bunch of things to use this proc
- Makes emitters keep their own spark_spread datum around, since they
spark so damn much.
- Also makes some things use timers and ports some things to Initialize.

* Compilation
This commit is contained in:
coiax
2017-04-12 18:59:45 +01:00
committed by AnturK
parent a1403bc424
commit de35ec5f67
21 changed files with 72 additions and 114 deletions

View File

@@ -350,9 +350,7 @@
else
to_chat(user, "<span class='userdanger'>You stick \the [W] into the light socket!</span>")
if(has_power() && (W.flags & CONDUCT))
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src)
s.start()
do_sparks(3, TRUE, src)
if (prob(75))
electrocute_mob(user, get_area(src), src, rand(0.7,1.0), TRUE)
else
@@ -523,9 +521,7 @@
if(status == LIGHT_OK || status == LIGHT_BURNED)
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
if(on)
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src)
s.start()
do_sparks(3, TRUE, src)
status = LIGHT_BROKEN
update()