mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
optimize apply/remove_lum
Light sources no longer track applied lumcounts in an assocative list, using shared-indices with the applied turf list instead. Signed-off-by: Mloc <colmohici@gmail.com>
This commit is contained in:
@@ -143,15 +143,19 @@
|
|||||||
if(!strength) //Don't add turfs that aren't affected to the affected turfs.
|
if(!strength) //Don't add turfs that aren't affected to the affected turfs.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
effect_r[T.lighting_overlay] = round(lum_r * strength, LIGHTING_ROUND_VALUE)
|
effect_r += round(lum_r * strength, LIGHTING_ROUND_VALUE)
|
||||||
effect_g[T.lighting_overlay] = round(lum_g * strength, LIGHTING_ROUND_VALUE)
|
effect_g += round(lum_g * strength, LIGHTING_ROUND_VALUE)
|
||||||
effect_b[T.lighting_overlay] = round(lum_b * strength, LIGHTING_ROUND_VALUE)
|
effect_b += round(lum_b * strength, LIGHTING_ROUND_VALUE)
|
||||||
|
|
||||||
T.lighting_overlay.update_lumcount(
|
T.lighting_overlay.update_lumcount(
|
||||||
round(lum_r * strength, LIGHTING_ROUND_VALUE),
|
round(lum_r * strength, LIGHTING_ROUND_VALUE),
|
||||||
round(lum_g * strength, LIGHTING_ROUND_VALUE),
|
round(lum_g * strength, LIGHTING_ROUND_VALUE),
|
||||||
round(lum_b * strength, LIGHTING_ROUND_VALUE)
|
round(lum_b * strength, LIGHTING_ROUND_VALUE)
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
effect_r += 0
|
||||||
|
effect_g += 0
|
||||||
|
effect_b += 0
|
||||||
|
|
||||||
if(!T.affecting_lights)
|
if(!T.affecting_lights)
|
||||||
T.affecting_lights = list()
|
T.affecting_lights = list()
|
||||||
@@ -161,12 +165,15 @@
|
|||||||
|
|
||||||
/datum/light_source/proc/remove_lum()
|
/datum/light_source/proc/remove_lum()
|
||||||
applied = 0
|
applied = 0
|
||||||
|
var/i = 1
|
||||||
for(var/turf/T in effect_turf)
|
for(var/turf/T in effect_turf)
|
||||||
if(T.affecting_lights)
|
if(T.affecting_lights)
|
||||||
T.affecting_lights -= src
|
T.affecting_lights -= src
|
||||||
|
|
||||||
if(T.lighting_overlay)
|
if(T.lighting_overlay)
|
||||||
T.lighting_overlay.update_lumcount(-effect_r[T.lighting_overlay], -effect_g[T.lighting_overlay], -effect_b[T.lighting_overlay])
|
T.lighting_overlay.update_lumcount(-effect_r[i], -effect_g[i], -effect_b[i])
|
||||||
|
|
||||||
|
i++
|
||||||
|
|
||||||
effect_r.Cut()
|
effect_r.Cut()
|
||||||
effect_g.Cut()
|
effect_g.Cut()
|
||||||
|
|||||||
Reference in New Issue
Block a user