Files
Polaris/code/modules/effects/vfx/sparks.dm
Atermonera 0232be9531 Repaths obj/effect/effect, datum/effect/effect [MDB_IGNORE] (#8312)
* Repaths obj/effect/effect, datum/effect/effect

* linter fixes

* No new

Co-authored-by: Atermonera <forslandm@gmail.com>
2022-01-16 00:14:39 -08:00

68 lines
1.6 KiB
Plaintext

/////////////////////////////////////////////
//SPARK SYSTEM (like steam system)
// The attach(atom/atom) proc is optional, and can be called to attach the effect
// to something, like the RCD, so then you can just call start() and the sparks
// will always spawn at the items location.
/////////////////////////////////////////////
/obj/effect/vfx/sparks
name = "sparks"
icon_state = "sparks"
var/amount = 6.0
anchored = 1.0
mouse_opacity = 0
/obj/effect/vfx/sparks/Initialize()
. = ..()
playsound(src, "sparks", 100, 1)
var/turf/T = src.loc
if (istype(T, /turf))
T.hotspot_expose(1000,100)
QDEL_IN(src, 5 SECONDS)
/obj/effect/vfx/sparks/Destroy()
var/turf/T = src.loc
if (istype(T, /turf))
T.hotspot_expose(1000,100)
return ..()
/obj/effect/vfx/sparks/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
if(isturf(loc))
var/turf/T = loc
T.hotspot_expose(1000,100)
/datum/effect_system/spark_spread
var/total_sparks = 0 // To stop it being spammed and lagging!
/datum/effect_system/spark_spread/set_up(n = 3, c = 0, loca)
if(n > 10)
n = 10
number = n
cardinals = c
if(istype(loca, /turf/))
location = loca
else
location = get_turf(loca)
/datum/effect_system/spark_spread/start()
var/i = 0
for(i=0, i<src.number, i++)
if(src.total_sparks > 20)
return
spawn(0)
if(holder)
src.location = get_turf(holder)
var/obj/effect/vfx/sparks/sparks = new /obj/effect/vfx/sparks(src.location)
src.total_sparks++
var/direction
if(src.cardinals)
direction = pick(cardinal)
else
direction = pick(alldirs)
for(i=0, i<pick(1,2,3), i++)
sleep(5)
step(sparks,direction)
spawn(20)
src.total_sparks--