diff --git a/code/controllers/subsystem/lighting.dm b/code/controllers/subsystem/lighting.dm index a6547cd903..1c550c4672 100644 --- a/code/controllers/subsystem/lighting.dm +++ b/code/controllers/subsystem/lighting.dm @@ -36,9 +36,9 @@ SUBSYSTEM_DEF(lighting) for (i in 1 to GLOB.lighting_update_lights.len) var/datum/light_source/L = GLOB.lighting_update_lights[i] - if (L.check() || L.destroyed || L.force_update) + if (L.check() || QDELETED(L) || L.force_update) L.remove_lum() - if (!L.destroyed) + if (!QDELETED(L)) L.apply_lum() else if (L.vis_update) //We smartly update only tiles that became (in) visible to use. diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 6dc215bbcc..8d5622c3d1 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -95,6 +95,8 @@ LAZYCLEARLIST(priority_overlays) //SSoverlays.processing -= src //we COULD do this, but it's better to just let it fall out of the processing queue + QDEL_NULL(light) + return ..() /atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5) diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index 8d85db8f5e..0cd16eb47a 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -35,9 +35,7 @@ return if (!light_power || !light_range) // We won't emit light anyways, destroy the light source. - if(light) - light.destroy() - light = null + QDEL_NULL(light) else if (!istype(loc, /atom/movable)) // We choose what atom should be the top atom of the light here. . = src @@ -49,13 +47,6 @@ else light = new/datum/light_source(src, .) -// Destroy our light source so we GC correctly. -/atom/Destroy() - if (light) - light.destroy() - light = null - . = ..() - // If we have opacity, make sure to tell (potentially) affected light sources. /atom/movable/Destroy() var/turf/T = loc diff --git a/code/modules/lighting/lighting_corner.dm b/code/modules/lighting/lighting_corner.dm index 4e3b1821b9..2f431e884a 100644 --- a/code/modules/lighting/lighting_corner.dm +++ b/code/modules/lighting/lighting_corner.dm @@ -137,5 +137,5 @@ GLOBAL_LIST_INIT(LIGHTING_CORNER_DIAGONAL, list(NORTHEAST, SOUTHEAST, SOUTHWEST, return QDEL_HINT_LETMELIVE stack_trace("Ok, Look, TG, I need you to find whatever fucker decided to call qdel on a fucking lighting corner, then tell him very nicely and politely that he is 100% retarded and needs his head checked. Thanks. Send them my regards by the way.") - // Yeah fuck you anyways. - return QDEL_HINT_LETMELIVE \ No newline at end of file + + return ..() \ No newline at end of file diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index 99b437fd33..dacbb1ac33 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -28,7 +28,6 @@ var/vis_update // Whether we should smartly recalculate visibility. and then only update tiles that became (in)visible to us. var/needs_update // Whether we are queued for an update. - var/destroyed // Whether we are destroyed and need to stop emitting light. var/force_update /datum/light_source/New(var/atom/owner, var/atom/top) @@ -60,20 +59,16 @@ return ..() -// Kill ourselves. -/datum/light_source/proc/destroy() - destroyed = TRUE +/datum/light_source/Destroy(force) force_update() if (source_atom) source_atom.light_sources -= src if (top_atom) top_atom.light_sources -= src - -// Fuck supporting force. -/datum/light_source/Destroy(var/force) - destroy() - return QDEL_HINT_IWILLGC + . = ..() + if(!force) + return QDEL_HINT_IWILLGC // Yes this doesn't align correctly on anything other than 4 width tabs. // If you want it to go switch everybody to elastic tab stops. @@ -114,7 +109,7 @@ // Will check if we actually need to update, and update any variables that may need to be updated. /datum/light_source/proc/check() if (!source_atom || !light_range || !light_power) - destroy() + qdel(src) return 1 if (!top_atom)