From f8575c47674e4e0c9ec56af5e5475f149d962ced Mon Sep 17 00:00:00 2001 From: supersayu Date: Mon, 21 Oct 2013 17:34:41 -0400 Subject: [PATCH] Evens out space lighting and prevents space fire/party alarms Adds a dedicated lighting subarea for space turfs, and forces all space turfs to use it. This evens out irregularities in lighting space turfs ("this empty space is slightly brighter than that empty space") and removes fire and party alarms from space tiles. For now I have also made space lighting subareas unpowered. I guess this operates on the theory that the tiles mysteriously teleport power between themselves (along with flashing red lights and party strobes) but it does not work on empty space. --- code/controllers/_DynamicAreaLighting_TG.dm | 38 +++++++++++++++++++++ code/game/area/areas.dm | 4 ++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/code/controllers/_DynamicAreaLighting_TG.dm b/code/controllers/_DynamicAreaLighting_TG.dm index 09f6b60d191..9bad2943ff8 100644 --- a/code/controllers/_DynamicAreaLighting_TG.dm +++ b/code/controllers/_DynamicAreaLighting_TG.dm @@ -223,16 +223,54 @@ turf/proc/shift_to_subarea() A.tag = new_tag A.lighting_subarea = 1 + A.lighting_space = 0 // in case it was copied from a space subarea A.SetLightLevel(light) Area.related += A A.contents += src // move the turf into the area +// Dedicated lighting sublevel for space turfs +// helps us depower things in space, remove space fire alarms, +// and evens out space lighting +turf/space/shift_to_subarea() + lighting_changed = 0 + var/area/Area = loc + + var/find = findtextEx(Area.tag, "sd_L") + var/new_tag = copytext(Area.tag, 1, find) + new_tag += "sd_L_space" + 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) + switch(V) + if("contents","lighting_overlay","overlays") continue + else + if(issaved(Area.vars[V])) A.vars[V] = Area.vars[V] + + A.tag = new_tag + A.lighting_subarea = 1 + A.lighting_space = 1 + A.icon_state = null // in case the replicated area had an alert + + //var/light = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states) + A.SetLightLevel(4) + + Area.related += A + + A.contents += src // move the turf into the area + area var/lighting_use_dynamic = 1 //Turn this flag off to prevent sd_DynamicAreaLighting from affecting this area var/image/lighting_overlay //tracks the darkness image of the area for easy removal var/lighting_subarea = 0 //tracks whether we're a lighting sub-area + var/lighting_space = 0 // true for space-only lighting subareas proc/SetLightLevel(light) if(!src) return diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 13293f514dc..be5a2442c55 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -175,7 +175,7 @@ return /area/proc/updateicon() - if ((fire || eject || party) && ((!requires_power)?(!requires_power):power_environ))//If it doesn't require power, can still activate this proc. + if ((fire || eject || party) && (!requires_power||power_environ) && !lighting_space)//If it doesn't require power, can still activate this proc. if(fire && !eject && !party) icon_state = "blue" /*else if(atmosalm && !fire && !eject && !party) @@ -203,6 +203,8 @@ return 1 if(master.always_unpowered) return 0 + if(src.lighting_space) + return 0 // Nope sorry switch(chan) if(EQUIP) return master.power_equip