diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index 3b4ede5402d..08fb75ead21 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -474,21 +474,9 @@ if(!.) return _AddComponent(args) -/** - * Removes the component from parent, ends up with a null parent - * Used as a helper proc by the component transfer proc, does not clean up the component like Destroy does - */ -/datum/component/proc/ClearFromParent() - if(!parent) - return - var/datum/old_parent = parent - PreTransfer() - _RemoveFromParent() - parent = null - SEND_SIGNAL(old_parent, COMSIG_COMPONENT_REMOVING, src) - /** * Removes the component from parent, ends up with a null parent + * Used as a helper proc by the component transfer proc, does not clean up the component like Destroy does */ /datum/component/proc/RemoveComponent() if(!parent) diff --git a/code/game/objects/effects/chem/chemsmoke.dm b/code/game/objects/effects/chem/chemsmoke.dm index 50d227e41e4..0c12b0d5f27 100644 --- a/code/game/objects/effects/chem/chemsmoke.dm +++ b/code/game/objects/effects/chem/chemsmoke.dm @@ -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. diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index c29faf6e9b2..5cda350c697 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -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()) @@ -213,9 +212,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) ///////////////////////////////////////////// @@ -431,6 +430,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) @@ -487,6 +490,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) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index ca86d620d59..22a529fb42c 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -114,7 +114,7 @@ var/climbing_delay = 1 //If rock_climbing, lower better. /obj/item/Initialize(mapload) - ..() + . = ..() for(var/path in actions_types) add_item_action(path) diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm index 9d0f1d96652..636b7f446f2 100644 --- a/code/game/objects/items/weapons/grenades/flashbang.dm +++ b/code/game/objects/items/weapons/grenades/flashbang.dm @@ -23,7 +23,7 @@ B.adjust_integrity(-damage) new/obj/effect/effect/sparks(src.loc) - new/obj/effect/effect/smoke/illumination(src.loc, 5, range=30, power=30, color="#FFFFFF") + new/obj/effect/effect/smoke/illumination(loc, 5, 30, 30, "#FFFFFF") qdel(src) diff --git a/code/game/objects/items/weapons/material/chainsaw.dm b/code/game/objects/items/weapons/material/chainsaw.dm index f595a757fd6..c00b526151f 100644 --- a/code/game/objects/items/weapons/material/chainsaw.dm +++ b/code/game/objects/items/weapons/material/chainsaw.dm @@ -22,8 +22,6 @@ /obj/item/chainsaw/Destroy() STOP_PROCESSING(SSobj, src) - if(reagents) - qdel(reagents) ..() /obj/item/chainsaw/proc/turnOn(mob/user as mob) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index b5bae811e5b..9d277fc5fcd 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -475,7 +475,7 @@ if(my_case) if(my_case.BB == src) my_case.BB = null - my_case = null + my_case = null return ..() diff --git a/code/modules/projectiles/projectile/blob.dm b/code/modules/projectiles/projectile/blob.dm index 291bfec6b28..72a4796e531 100644 --- a/code/modules/projectiles/projectile/blob.dm +++ b/code/modules/projectiles/projectile/blob.dm @@ -20,11 +20,6 @@ ready_chemicals() ..() -/obj/item/projectile/energy/blob/Destroy() - qdel(reagents) - reagents = null - ..() - /obj/item/projectile/energy/blob/on_impact(var/atom/A) if(splatter) var/turf/location = get_turf(src) diff --git a/code/modules/projectiles/projectile/energy.dm b/code/modules/projectiles/projectile/energy.dm index 9397fe3972b..936dbf26537 100644 --- a/code/modules/projectiles/projectile/energy.dm +++ b/code/modules/projectiles/projectile/energy.dm @@ -70,7 +70,7 @@ ..() //initial flash //residual illumination - new /obj/effect/effect/smoke/illumination(src.loc, rand(190,240) SECONDS, range=8, power=3, color=light_colour) //same lighting power as flare + new /obj/effect/effect/smoke/illumination(loc, rand(190,240) SECONDS, 8, 3, light_colour) //same lighting power as flare /obj/item/projectile/energy/electrode name = "electrode" diff --git a/code/modules/xenoarcheaology/artifacts/artifact.dm b/code/modules/xenoarcheaology/artifacts/artifact.dm index a1ea8e37eaa..ed09ce054bd 100644 --- a/code/modules/xenoarcheaology/artifacts/artifact.dm +++ b/code/modules/xenoarcheaology/artifacts/artifact.dm @@ -20,7 +20,7 @@ /obj/machinery/artifact/Destroy() if(artifact_master) var/datum/component/artifact_master/arti_mstr = artifact_master - arti_mstr.ClearFromParent() + arti_mstr.RemoveComponent() artifact_master = null if(!QDELETED(arti_mstr)) qdel(arti_mstr) diff --git a/code/modules/xenoarcheaology/finds/find_spawning.dm b/code/modules/xenoarcheaology/finds/find_spawning.dm index 8b93844b902..fdc89d3a54b 100644 --- a/code/modules/xenoarcheaology/finds/find_spawning.dm +++ b/code/modules/xenoarcheaology/finds/find_spawning.dm @@ -864,7 +864,7 @@ /obj/item/archaeological_find/Destroy() if(src.is_anomalous()) var/datum/component/artifact_master/arti_mstr = GetComponent(/datum/component/artifact_master) - arti_mstr.ClearFromParent() + arti_mstr.RemoveComponent() if(!QDELETED(arti_mstr)) qdel(arti_mstr)