mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 18:22:14 +00:00
Productionizes #80615. The core optimization is this: ```patch - var/hint = to_delete.Destroy(arglist(args.Copy(2))) // Let our friend know they're about to get fucked up. + var/hint = to_delete.Destroy(force) // Let our friend know they're about to get fucked up. ``` We avoid a heap allocation in the form of copying the args over to a new list. A/B testing shows this results in 33% better overtime, and in a real round shaving off a full second of self time and 0.4 seconds of overtime--both of these would be doubled in the event this is merged as the new proc was only being run 50% of the time.
61 lines
1.9 KiB
Plaintext
61 lines
1.9 KiB
Plaintext
|
|
/particles/unusual_effect
|
|
icon = 'icons/effects/particles/pollen.dmi'
|
|
icon_state = "pollen"
|
|
width = 100
|
|
height = 100
|
|
count = 1000
|
|
spawning = 4
|
|
lifespan = 0.7 SECONDS
|
|
fade = 1 SECONDS
|
|
grow = -0.01
|
|
velocity = list(0, 0)
|
|
position = generator(GEN_CIRCLE, 0, 16, NORMAL_RAND)
|
|
drift = generator(GEN_VECTOR, list(0, -0.2), list(0, 0.2))
|
|
gravity = list(0, 0.95)
|
|
scale = generator(GEN_VECTOR, list(0.3, 0.3), list(1,1), NORMAL_RAND)
|
|
rotation = 30
|
|
spin = generator(GEN_NUM, -20, 20)
|
|
|
|
/// Creates a cool looking effect on the movable.
|
|
/// In the future, this could be expanded to have more interesting particles and effects.
|
|
/datum/component/unusual_effect
|
|
dupe_mode = COMPONENT_DUPE_HIGHLANDER
|
|
|
|
var/obj/effect/abstract/particle_holder/special_effects
|
|
|
|
var/color
|
|
|
|
COOLDOWN_DECLARE(glow_cooldown)
|
|
|
|
/datum/component/unusual_effect/Initialize(color, include_particles = FALSE)
|
|
var/atom/movable/parent_movable = parent
|
|
if (!istype(parent_movable))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
src.color = color
|
|
parent_movable.add_filter("unusual_effect", 2, list("type" = "outline", "color" = color, "size" = 2))
|
|
if(include_particles)
|
|
special_effects = new(parent_movable, /particles/unusual_effect)
|
|
START_PROCESSING(SSobj, src)
|
|
|
|
/datum/component/unusual_effect/Destroy(force)
|
|
var/atom/movable/parent_movable = parent
|
|
if (istype(parent_movable))
|
|
parent_movable.remove_filter("unusual_effect")
|
|
STOP_PROCESSING(SSobj, src)
|
|
return ..()
|
|
|
|
/datum/component/unusual_effect/process(seconds_per_tick)
|
|
var/atom/movable/parent_movable = parent
|
|
var/filter = parent_movable.get_filter("unusual_effect")
|
|
if (!filter)
|
|
parent_movable.add_filter("unusual_effect", 2, list("type" = "outline", "color" = color, "size" = 2))
|
|
return
|
|
if(!COOLDOWN_FINISHED(src, glow_cooldown))
|
|
return
|
|
|
|
animate(filter, alpha = 110, time = 1.5 SECONDS, loop = -1)
|
|
animate(alpha = 40, time = 2.5 SECONDS)
|
|
COOLDOWN_START(src, glow_cooldown, 4 SECONDS)
|