diff --git a/code/modules/lighting/light_source.dm b/code/modules/lighting/light_source.dm index ae9df7bb702..808f4d1dc3a 100644 --- a/code/modules/lighting/light_source.dm +++ b/code/modules/lighting/light_source.dm @@ -11,9 +11,9 @@ var/lum_g var/lum_b - var/tmp/old_lum_r - var/tmp/old_lum_g - var/tmp/old_lum_b + var/tmp/applied_lum_r + var/tmp/applied_lum_g + var/tmp/applied_lum_b var/list/effect_str var/list/effect_turf @@ -107,11 +107,6 @@ if(light_range && light_power && !applied) . = 1 - if(. || source_atom.light_color != light_color)//Save the old lumcounts if we need to update, if the colour changed DO IT BEFORE we parse the colour and LOSE the old lumcounts! - old_lum_r = lum_r - old_lum_g = lum_g - old_lum_b = lum_b - if(source_atom.light_color != light_color) light_color = source_atom.light_color parse_light_color() @@ -149,6 +144,12 @@ /datum/light_source/proc/apply_lum() applied = 1 + + // Cache the applied lum counts. + applied_lum_r = lum_r + applied_lum_g = lum_g + applied_lum_b = lum_b + if(istype(source_turf)) FOR_DVIEW(var/turf/T, light_range, source_turf, INVISIBILITY_LIGHTING) if(T.lighting_overlay) @@ -188,7 +189,7 @@ if(T.lighting_overlay) var/str = effect_str[i] - T.lighting_overlay.update_lumcount(-str * old_lum_r, -str * old_lum_g, -str * old_lum_b) + T.lighting_overlay.update_lumcount(-str * applied_lum_r, -str * applied_lum_g, -str * applied_lum_b) i++