From 45d98a271edfa5c638a85353badd2b6017ffe00d Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Tue, 4 Dec 2012 11:10:43 +0000 Subject: [PATCH] -Fixes Issue 1142. Thanks to carn for the solution to the issue. The tags were being cut off and there were multiple areas of the same tag, so when locating with the tag it gave out unpredictable results. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5254 316c924e-a436-60f5-8080-3fe189b3f50e --- code/controllers/_DynamicAreaLighting_TG.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/controllers/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm index 36fffedbcb0..5f876207808 100644 --- a/code/controllers/_DynamicAreaLighting_TG.dm +++ b/code/controllers/_DynamicAreaLighting_TG.dm @@ -236,24 +236,24 @@ turf/proc/update_lumcount(amount) turf/proc/shift_to_subarea() lighting_changed = 0 - var/area/Area = loc + if(!istype(Area) || !Area.lighting_use_dynamic) return // change the turf's area depending on its brightness // restrict light to valid levels var/light = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states) - //var/new_tag = "[Area.type]sd_L[light]" - var/new_tag - if(length(Area.tag) > 5) - new_tag = "[copytext(Area.tag,1,-5)]sd_L[light]" - else - new_tag = "[Area.type]sd_L[light]" + var/find = findtextEx(Area.tag, "sd_L") + var/new_tag = copytext(Area.tag, 1, find) + new_tag += "sd_L[light]" if(Area.tag!=new_tag) //skip if already in this area + var/area/A = locate(new_tag) // find an appropriate area + if(!A) + A = new Area.type() // create area if it wasn't found // replicate vars for(var/V in Area.vars)