[MIRROR] some destroy cleanup (#9953)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-01-27 01:23:17 +01:00
committed by GitHub
co-authored by Kashargul
parent cac1d0170a
commit b91c3adca5
7 changed files with 33 additions and 31 deletions
+16 -14
View File
@@ -7,10 +7,9 @@
time_to_live = 300
pass_flags = PASSTABLE | PASSGRILLE | PASSGLASS //PASSGLASS is fine here, it's just so the visual effect can "flow" around glass
/obj/effect/effect/smoke/chem/New()
..()
/obj/effect/effect/smoke/chem/Initialize()
. = ..()
create_reagents(500)
return
/obj/effect/effect/smoke/chem/Destroy()
walk(src, 0) // Because we might have called walk_to, we must stop the walk loop or BYOND keeps an internal reference to us forever.
@@ -47,6 +46,14 @@
chemholder = new/obj()
chemholder.create_reagents(500)
/datum/effect/effect/system/smoke_spread/chem/Destroy()
QDEL_NULL(chemholder)
if(targetTurfs)
targetTurfs.Cut()
if(wallList)
wallList.Cut()
. = ..()
//Sets up the chem smoke effect
// Calculates the max range smoke can travel, then gets all turfs in that view range.
// Culls the selected turfs to a (roughly) circle shape, then calls smokeFlow() to make
@@ -174,11 +181,8 @@
walk_to(smoke, T)
if(initial(smoke.opacity))
smoke.set_opacity(1) //switching opacity on after the smoke has spawned, and then
spawn()
sleep(150+rand(0,20)) // turning it off before it is deleted results in cleaner
smoke.set_opacity(0) // lighting and view range updates
fadeOut(smoke)
qdel(smoke)
var/lifespan = 150 + rand(0, 20)
addtimer(CALLBACK(src, PROC_REF(fadeOut)), lifespan)
/datum/effect/effect/system/smoke_spread/chem/spores/spawnSmoke(var/turf/T, var/icon/I, var/dist = 1)
var/obj/effect/effect/smoke/chem/spores = new /obj/effect/effect/smoke/chem(location)
@@ -186,16 +190,14 @@
..(T, I, dist, spores)
/datum/effect/effect/system/smoke_spread/chem/proc/fadeOut(var/atom/A, var/frames = 16) // Fades out the smoke smoothly using it's alpha variable.
A.set_opacity(0) // lighting and view range updates
if(A.alpha == 0) //Handle already transparent case
qdel(A)
return
if(frames == 0)
frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame".
var/step = A.alpha / frames
for(var/i = 0, i < frames, i++)
A.alpha -= step
sleep(world.tick_lag)
return
animate(A, alpha = 0, time = frames)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), A), frames, TIMER_UNIQUE)
/datum/effect/effect/system/smoke_spread/chem/proc/smokeFlow() // Smoke pathfinder. Uses a flood fill method based on zones to quickly check what turfs the smoke (airflow) can actually reach.
+14 -7
View File
@@ -38,6 +38,7 @@ would spawn and follow the beaker, even if it is carried or thrown.
/datum/effect/effect/system/proc/start()
/datum/effect/effect/system/Destroy()
location = null
holder = null
return ..()
@@ -178,12 +179,10 @@ steam.start() -- spawns the effect
pixel_x = -32
pixel_y = -32
/obj/effect/effect/smoke/New()
..()
/obj/effect/effect/smoke/Initialize()
. = ..()
if(time_to_live)
spawn (time_to_live)
if(!QDELETED(src))
qdel(src)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), src), time_to_live, TIMER_DELETE_ME)
/obj/effect/effect/smoke/Crossed(mob/living/carbon/M as mob )
if(M.is_incorporeal())
@@ -215,9 +214,9 @@ steam.start() -- spawns the effect
icon = 'icons/effects/effects.dmi'
icon_state = "sparks"
/obj/effect/effect/smoke/illumination/New(var/newloc, var/lifetime=10, var/range=null, var/power=null, var/color=null)
/obj/effect/effect/smoke/illumination/Initialize(mapload, var/lifetime=10, var/range=null, var/power=null, var/color=null)
time_to_live=lifetime
..()
. = ..()
set_light(range, power, color)
/////////////////////////////////////////////
@@ -433,6 +432,10 @@ steam.start() -- spawns the effect
var/processing = 1
var/on = 1
/datum/effect/effect/system/ion_trail_follow/Destroy()
oldposition = null
. = ..()
/datum/effect/effect/system/ion_trail_follow/set_up(atom/atom)
attach(atom)
oldposition = get_turf(atom)
@@ -489,6 +492,10 @@ steam.start() -- spawns the effect
var/processing = 1
var/on = 1
/datum/effect/effect/system/steam_trail_follow/Destroy()
oldposition = null
. = ..()
/datum/effect/effect/system/steam_trail_follow/set_up(atom/atom)
attach(atom)
oldposition = get_turf(atom)