Cleaned fix for colored lights.

This commit is contained in:
ESwordTheCat
2014-06-12 21:06:02 -08:00
parent 5f25e4bfcd
commit 8c18170f7e

View File

@@ -261,7 +261,6 @@ turf/proc/update_lumcount(amount, _lcolor, removing = 0)
l_color = currentblended // blended the remaining colors so apply it.
else
l_color = null // Something went wrong, no color for you.
else
l_color = colors[colors.len]
else // we added a color.
@@ -279,16 +278,11 @@ turf/proc/update_lumcount(amount, _lcolor, removing = 0)
lighting_controller.changed_turfs += src
lighting_changed = 1
turf/proc/lighting_tag(var/level)
turf/proc/lighting_tag(const/level)
var/area/A = loc
// pomf - If we have a lighting color that is not white, apply the new tag to seperate the areas.
if (l_color)
return A.tagbase + "sd_LC[level][l_color][color_lighting_lumcount]" // pomf - We append the color lighting lumcount so we can have colored lights.
return A.tagbase + "sd_L[level]"
turf/proc/build_lighting_area(var/tag, var/level, const/color_light)
turf/proc/build_lighting_area(const/tag, const/level, const/color_light)
var/area/Area = loc
var/area/A = new Area.type() // create area if it wasn't found
// replicate vars
@@ -303,7 +297,7 @@ turf/proc/build_lighting_area(var/tag, var/level, const/color_light)
A.lighting_subarea = 1
A.lighting_space = 0 // in case it was copied from a space subarea
if (A.l_color != l_color)
if (l_color != A.l_color)
A.l_color = l_color
//color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states)
//world << "[color_light] [color_lighting_lumcount]"
@@ -321,13 +315,17 @@ turf/proc/shift_to_subarea()
var/level = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states)
var/new_tag = lighting_tag(level)
// pomf - If we have a lighting color that is not null, apply the new tag to seperate the areas.
if (l_color)
new_tag += "[l_color][color_lighting_lumcount]" // pomf - We append the color lighting lumcount so we can have colored lights.
if(Area.tag!=new_tag) //skip if already in this area
var/area/A = locate(new_tag) // find an appropriate area
var/color_light = min(max(round(color_lighting_lumcount,1),0),lighting_controller.lighting_states)
if (!A)
A = build_lighting_area(new_tag, level, color_light)
else if (A.l_color != l_color)
else if (l_color != A.l_color)
A.l_color = l_color
//color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states)
A.SetLightLevel(level, color_light)