From bd73bf33d3512072c55def05f1f0a30ae9b8196b Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Sat, 24 Sep 2011 14:14:40 +0000 Subject: [PATCH] - Randomized light brightness for lights at round start is now no longer tied to individual lights, but to the area they start in, meaning some areas might start out darker on some rounds. Most have far too many lights tho, so they don't affect anything. - 10 percent of lights with tubes will now start out broken and 25 percent of lights with bulbs will now start out broken. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2261 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/area/Space Station 13 areas.dm | 2 ++ code/game/area/areas.dm | 1 + code/modules/power/lighting.dm | 38 +++++++++++++-------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/code/defines/area/Space Station 13 areas.dm b/code/defines/area/Space Station 13 areas.dm index d86f1acaafe..9e7d56b9801 100644 --- a/code/defines/area/Space Station 13 areas.dm +++ b/code/defines/area/Space Station 13 areas.dm @@ -28,6 +28,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station mouse_opacity = 0 var/lightswitch = 1 + var/area_lights_luminosity = 9 //This gets assigned at area creation. It is used to determine how bright the lights in an area should be. At the time of writing the value that it gets assigned is rand(6,9) - only used for light tubes + var/eject = null var/requires_power = 1 diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 1a4b12b05d5..a91fcfd922c 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -31,6 +31,7 @@ sd_lighting = 0 // *DAL* else luminosity = 0 + area_lights_luminosity = rand(6,9) //sd_SetLuminosity(0) // *DAL* diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 81f1aadf063..63077189f53 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -74,13 +74,22 @@ /obj/machinery/light/New() ..() - switch(fitting) - if("tube") - brightness = rand(6,9) - if("bulb") - brightness = 3 - spawn(1) - update() + spawn(2) + switch(fitting) + if("tube") + if(src.loc && src.loc.loc && isarea(src.loc.loc)) + var/area/A = src.loc.loc + brightness = A.area_lights_luminosity + else + brightness = rand(6,9) + if(prob(10)) + broken(1) + if("bulb") + brightness = 3 + if(prob(25)) + broken(1) + spawn(1) + update() /obj/machinery/light/Del() var/area/A = get_area(src) @@ -307,16 +316,17 @@ // break the light and make sparks if was on -/obj/machinery/light/proc/broken() +/obj/machinery/light/proc/broken(var/skip_sound_and_sparks = 0) if(status == LIGHT_EMPTY) return - if(status == LIGHT_OK || status == LIGHT_BURNED) - playsound(src.loc, 'Glasshit.ogg', 75, 1) - if(on) - var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread - s.set_up(3, 1, src) - s.start() + if(!skip_sound_and_sparks) + if(status == LIGHT_OK || status == LIGHT_BURNED) + playsound(src.loc, 'Glasshit.ogg', 75, 1) + if(on) + var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread + s.set_up(3, 1, src) + s.start() status = LIGHT_BROKEN update()