Files
Aurora.3/code/modules/effects/sparks/spawner.dm
Lohikar 5e33bd0e2c Misc tweaks (#3916)
changes:

/obj/visual_effect has been repathed to /obj/effect/visual.
Openspace movables will no longer use the space plane when on an openturf mimicing a space turf.
Lights now only update on direction change if your direction actually changed.
Fixed some bad set_dir() procs that were either pointless or that didn't return parent.
Mapped-in or maint dirtier-spawned glowing goo no longer self-deletes after 2 minutes.
Fixed an issue that may have caused some openspace movables to not properly handle direction changes.
2017-12-09 00:36:53 +02:00

46 lines
1.1 KiB
Plaintext

// -- Spark Datum --
/datum/effect_system/sparks
var/amount = 1 // How many sparks should we make
var/list/spread = list() // Which directions we should create sparks.
// Using the spark procs is preferred to directly instancing this.
/datum/effect_system/sparks/New(var/atom/movable/loc, var/start_immediately = TRUE, var/amt = 1, var/list/spread_dirs = list())
if(QDELETED(loc))
return
set_loc(loc)
if (amt)
amount = amt
if (spread_dirs)
spread = spread_dirs
else
spread = list()
..(start_immediately)
/datum/effect_system/sparks/process()
. = ..()
var/total_sparks = 1
if (location)
var/obj/effect/visual/sparks/S = new(location, src, 0) //Trigger one on the tile it's on
S.start()
playsound(location, "sparks", 100, 1)
QUEUE_VISUAL(S) // Queue it.
while (total_sparks <= src.amount)
playsound(location, "sparks", 100, 1)
var/direction = 0
if (LAZYLEN(src.spread))
direction = pick(src.spread)
else
direction = 0
S = new /obj/effect/visual/sparks(location, src)
S.start(direction)
QUEUE_VISUAL(S)
total_sparks++