From dcbfff8aaa21912ba8776022426bd4f75ae133d0 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Wed, 1 Jul 2015 07:59:19 +0200 Subject: [PATCH] Fixes stuck lights --- code/modules/lighting/lighting_process.dm | 58 ++++++++++++----------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/code/modules/lighting/lighting_process.dm b/code/modules/lighting/lighting_process.dm index 28e1f1fa5e1..1571c6e388b 100644 --- a/code/modules/lighting/lighting_process.dm +++ b/code/modules/lighting/lighting_process.dm @@ -1,27 +1,31 @@ -/datum/controller/process/lighting/setup() - name = "lighting" - schedule_interval = LIGHTING_INTERVAL - - create_lighting_overlays() - -/datum/controller/process/lighting/doWork() - for(var/datum/light_source/L in lighting_update_lights) - if(L.needs_update) - if(L.destroyed || L.check() || L.force_update) - L.remove_lum() - if(!L.destroyed) L.apply_lum() - L.force_update = 0 - L.needs_update = 0 - - scheck() - - lighting_update_lights.Cut() - - for(var/atom/movable/lighting_overlay/O in lighting_update_overlays) - if(O.needs_update) - O.update_overlay() - O.needs_update = 0 - - scheck() - - lighting_update_overlays.Cut() +/datum/controller/process/lighting/setup() + name = "lighting" + schedule_interval = LIGHTING_INTERVAL + + create_lighting_overlays() + +/datum/controller/process/lighting/doWork() + var/list/lighting_update_lights_old = lighting_update_lights //We use a different list so any additions to the update lists during a delay from scheck() don't cause things to be cut from the list without being updated. + lighting_update_lights = null //Nulling it first because of http://www.byond.com/forum/?post=1854520 + lighting_update_lights = list() + + for(var/datum/light_source/L in lighting_update_lights_old) + if(L.needs_update) + if(L.destroyed || L.check() || L.force_update) + L.remove_lum() + if(!L.destroyed) L.apply_lum() + L.force_update = 0 + L.needs_update = 0 + + scheck() + + var/list/lighting_update_overlays_old = lighting_update_overlays //Same as above. + lighting_update_overlays = null //Same as above + lighting_update_overlays = list() + + for(var/atom/movable/lighting_overlay/O in lighting_update_overlays_old) + if(O.needs_update) + O.update_overlay() + O.needs_update = 0 + + scheck()