From f21c65cb951378f2a7e12da46bd370ed80302f65 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 6 Mar 2017 18:58:36 -0500 Subject: [PATCH] Fixes lighting runtimes --- code/game/atoms.dm | 9 +++++++-- code/game/turfs/space/space.dm | 6 ++++++ code/game/turfs/turf.dm | 6 ++++++ code/modules/lighting/lighting_atom.dm | 11 ----------- code/modules/lighting/lighting_overlay.dm | 6 ++---- code/modules/lighting/lighting_turf.dm | 6 ------ 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index aabc86c47ea..a09dfd986e6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -60,8 +60,13 @@ if(color) add_atom_colour(color, FIXED_COLOUR_PRIORITY) - if(luminosity) - light = new(src) + if (light_power && light_range) + update_light() + + if (opacity && isturf(loc)) + var/turf/T = loc + T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guaranteed to be on afterwards anyways. + /atom/Destroy() if(alternate_appearances) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index f40b27d0bc7..8d6ead69643 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -28,6 +28,12 @@ if(requires_activation) SSair.add_to_active(src) + if (light_power && light_range) + update_light() + + if (opacity) + has_opaque_atom = TRUE + /turf/open/space/attack_ghost(mob/dead/observer/user) if(destination_z) var/turf/T = locate(destination_x, destination_y, destination_z) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 197461f1881..000fdbfb673 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -48,6 +48,12 @@ CalculateAdjacentTurfs() SSair.add_to_active(src) + if (light_power && light_range) + update_light() + + if (opacity) + has_opaque_atom = TRUE + /turf/proc/Initalize_Atmos(times_fired) CalculateAdjacentTurfs() diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index cb814545cb5..126495fd739 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -49,17 +49,6 @@ else light = new/datum/light_source(src, .) -// Incase any lighting vars are on in the typepath we turn the light on in New(). -/atom/New() - . = ..() - - if (light_power && light_range) - update_light() - - if (opacity && isturf(loc)) - var/turf/T = loc - T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guaranteed to be on afterwards anyways. - // Destroy our light source so we GC correctly. /atom/Destroy() if (light) diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm index b96c6e17dae..828e9d37ed9 100644 --- a/code/modules/lighting/lighting_overlay.dm +++ b/code/modules/lighting/lighting_overlay.dm @@ -16,7 +16,7 @@ var/needs_update = FALSE -/atom/movable/lighting_overlay/New(var/atom/loc, var/no_update = FALSE) +/atom/movable/lighting_overlay/Initialize(mapload, var/no_update = FALSE) . = ..() verbs.Cut() global.all_lighting_overlays += src @@ -43,9 +43,7 @@ T.lighting_overlay = null T.luminosity = 1 - ..() - return QDEL_HINT_QUEUE - + return ..() else return QDEL_HINT_LETMELIVE diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index c9944ef7eb0..32c2dcafd15 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -9,12 +9,6 @@ var/tmp/list/datum/lighting_corner/corners var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile. -/turf/New() - . = ..() - - if (opacity) - has_opaque_atom = TRUE - // Causes any affecting light sources to be queued for a visibility update, for example a door got opened. /turf/proc/reconsider_lights() for (var/datum/light_source/L in affecting_lights)