mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
Normalizes how some lighting things GC
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
return ..()
|
||||
@@ -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,19 +59,15 @@
|
||||
|
||||
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()
|
||||
. = ..()
|
||||
if(!force)
|
||||
return QDEL_HINT_IWILLGC
|
||||
|
||||
// Yes this doesn't align correctly on anything other than 4 width tabs.
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user