mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-22 16:12:19 +00:00
Adds a new process-based effects system with the goal of reducing insane lag from sparks. Currently only supports sparks, but should be easily extendable to other types of effects. Also fixes a bug with airlocks where the light from bolts wasn't updating. Refactors bears slightly to reduce duplicated code & pointless spark object creation and destruction. Lighting profiler will now log /turf locations & names correctly. Doors will no longer trigger way more visibility checks than they need to.
39 lines
1.2 KiB
Plaintext
39 lines
1.2 KiB
Plaintext
/obj/visual_effect
|
|
name = "effect"
|
|
anchored = 1
|
|
simulated = 0
|
|
mouse_opacity = 0
|
|
var/life_ticks // How many ticks this effect will life before it stops processing.
|
|
var/life_ticks_max // The high limit for the random tick picker.
|
|
var/life_ticks_min // The low limit for the random tick picker.
|
|
var/live_icon_state // The icon-state to use when this object is shown to the user.
|
|
|
|
/obj/visual_effect/New(var/life_min = 3 SECONDS, var/life_max = 5 SECONDS)
|
|
..()
|
|
life_ticks_min = life_min
|
|
life_ticks_max = life_max
|
|
life_ticks = rand(life_ticks_min, life_ticks_max)
|
|
|
|
// Called when the visual_effect is manifested.
|
|
/obj/visual_effect/proc/start()
|
|
if (live_icon_state)
|
|
icon_state = live_icon_state
|
|
|
|
// Called every effects processor tick. Return value determines what the process does to this object.
|
|
/obj/visual_effect/proc/tick()
|
|
if (!life_ticks)
|
|
return EFFECT_DESTROY
|
|
|
|
life_ticks--
|
|
return EFFECT_CONTINUE
|
|
|
|
// Called just before the visual_effect is returned to the pool.
|
|
/obj/visual_effect/proc/end()
|
|
loc = null
|
|
if (live_icon_state)
|
|
icon_state = null
|
|
|
|
/obj/visual_effect/Destroy()
|
|
// ¯\_(ツ)_/¯
|
|
// This runtimes in expansions.dm if ..() is called.
|