diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index b6a812ce9ab..9bc38204946 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -171,8 +171,7 @@ ///Clears the affected_turfs lazylist, removing from its contents the effects of being near the light. /datum/component/overlay_lighting/proc/clean_old_turfs() - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= lum_power affected_turfs = null @@ -182,9 +181,12 @@ if(!current_holder) return var/atom/movable/light_source = GET_LIGHT_SOURCE + . = list() for(var/turf/lit_turf in view(lumcount_range, get_turf(light_source))) lit_turf.dynamic_lumcount += lum_power - LAZYADD(affected_turfs, lit_turf) + . += lit_turf + if(length(.)) + affected_turfs = . ///Clears the old affected turfs and populates the new ones. @@ -431,8 +433,7 @@ . = lum_power lum_power = new_lum_power var/difference = . - lum_power - for(var/t in affected_turfs) - var/turf/lit_turf = t + for(var/turf/lit_turf as anything in affected_turfs) lit_turf.dynamic_lumcount -= difference ///Moves the light directional_atom that emits our "light" based on our position and our direction