anchor.diff:  							7, 7)
   
   
  -proc
  -	ul_Clamp(var/Value)
  -		return min(max(Value, 0), ul_Steps)
  +proc/ul_Clamp(var/Value)
  +	return min(max(Value, 0), ul_Steps)
   
   atom
   	var
  
positive.code: 		LightLevelGreen = 0
  		LightLevelBlue = 0
  
  	proc
  		ul_Light(var/Red = LightLevelRed, var/Green = LightLevelGreen, var/Blue = LightLevelBlue)
  
  			if(!src || !src.ul_Lighting)
  				return
  
  			overlays -= ul_Overlay
  
  			LightLevelRed = Red
  			LightLevelGreen = Green
  			LightLevelBlue = Blue
  
  			luminosity = ul_IsLuminous(LightLevelRed, LightLevelGreen, LightLevelBlue)
  
  			ul_Overlay = image('ULIcons.dmi', , num2text(LightLevelRed) + "-" + num2text(LightLevelGreen) + "-" + num2text(LightLevelBlue), ul_Layer)
  
  			overlays += ul_Overlay
  
  			return
  
  		ul_Prep()
  
  			if(!tag)
  				tag = "[type]"
  			if(ul_Lighting)
  				if(!findtext(tag,":UL"))
  					ul_Light()
  			//world.log << tag
  
  			return
negative.code: 		list/MaxGreen = list( )
  		list/MaxBlue = list( )
  
  
  
  turf/proc/ul_GetRed()
  	return ul_Clamp(min(LightLevelRed, max(MaxRed)))
  turf/proc/ul_GetGreen()
  	return ul_Clamp(min(LightLevelGreen, max(MaxGreen)))
  turf/proc/ul_GetBlue()
  	return ul_Clamp(min(LightLevelBlue, max(MaxBlue)))
  
  turf/proc/ul_UpdateLight()
  
  	var/area/CurrentArea = loc
  
  	if(!isarea(CurrentArea) || !CurrentArea.ul_Lighting)
  		return
  
  	var/LightingTag = copytext(CurrentArea.tag, 1, findtext(CurrentArea.tag, ":UL")) + ":UL[ul_GetRed()]_[ul_GetGreen()]_[ul_GetBlue()]"
  
  	if(CurrentArea.tag != LightingTag)
  		var/area/NewArea = locate(LightingTag)
  
  		if(!NewArea)
  			NewArea = new CurrentArea.type()
  			NewArea.tag = LightingTag
  
  			for(var/V in CurrentArea.vars - "contents")
  				if(issaved(CurrentArea.vars[V]))
  					NewArea.vars[V] = CurrentArea.vars[V]
  
  			NewArea.tag = LightingTag
  
  			NewArea.ul_Light(ul_GetRed(), ul_GetGreen(), ul_GetBlue())
  
  
  		NewArea.contents += src
  
  	return
  
  turf/proc/ul_Recalculate()
  
  	ul_SuppressLightLevelChanges++
  
  	var/list/Lights = ul_BlankLocal()
  
  	LightLevelRed = 0
  	LightLevelGreen = 0
  	LightLevelBlue = 0
  
  	ul_UnblankLocal(Lights)
  
  	ul_SuppressLightLevelChanges--
  
  	return
  
  area
  	var
  