Normalizes how some lighting things GC
This commit is contained in:
@@ -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,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)
|
||||
|
||||
Reference in New Issue
Block a user