From 9776ae04443cfbb7ef06c593b8837bd21775f4f4 Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 21 Apr 2020 15:36:16 +0200 Subject: [PATCH] Nightlight (#8688) --- code/controllers/subsystems/job.dm | 1 + code/game/area/areas.dm | 11 +++++++++-- code/game/machinery/lightswitch.dm | 10 ++++++++-- html/changelogs/geeves-non_essential_lights.yml | 6 ++++++ maps/_common/areas/station/civilian.dm | 1 + maps/_common/areas/station/engineering.dm | 1 + maps/_common/areas/station/hallways.dm | 10 ++++++---- maps/_common/areas/station/medical.dm | 6 ++++++ maps/_common/areas/station/research.dm | 5 +++++ maps/_common/areas/station/security.dm | 8 ++++++++ 10 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 html/changelogs/geeves-non_essential_lights.yml diff --git a/code/controllers/subsystems/job.dm b/code/controllers/subsystems/job.dm index 486992ae07e..8ccb00d09a9 100644 --- a/code/controllers/subsystems/job.dm +++ b/code/controllers/subsystems/job.dm @@ -341,6 +341,7 @@ if(istype(S, /obj/effect/landmark/start) && istype(S.loc, /turf)) H.forceMove(S.loc) H.lastarea = get_area(H.loc) + H.lastarea.set_lightswitch(TRUE) else LateSpawn(H, rank) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index af418c3b761..f0b82ca43f1 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -18,7 +18,7 @@ layer = 10 luminosity = 0 mouse_opacity = 0 - var/lightswitch = 1 + var/lightswitch = FALSE var/eject = null @@ -105,6 +105,13 @@ . = ..() +/area/proc/set_lightswitch(var/state) + lightswitch = state + var/obj/machinery/light_switch/L = locate() in src + if(L) + L.on = state + L.sync_lights() + /area/proc/get_cameras() . = list() for (var/thing in SSmachinery.all_cameras) @@ -479,4 +486,4 @@ var/list/mob/living/forced_ambiance_list = new A.Entered(AM, old_area) for(var/obj/machinery/M in T) - M.shuttle_move(T) \ No newline at end of file + M.shuttle_move(T) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 6dec215a04a..66db7a4b660 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -24,6 +24,7 @@ name = "light switch ([area.name])" src.on = src.area.lightswitch + addtimer(CALLBACK(src, .proc/sync_lights), 25) update_icon() /obj/machinery/light_switch/update_icon() @@ -42,8 +43,14 @@ /obj/machinery/light_switch/attack_hand(mob/user) playsound(src, "switch", 30) on = !on + sync_lights() - area.lightswitch = on +/obj/machinery/light_switch/proc/sync_lights() + var/area/A = get_area(src) + if(!A) + return + + A.lightswitch = on for(var/obj/machinery/light_switch/L in area) L.on = on @@ -54,7 +61,6 @@ L.stat &= ~POWEROFF else L.stat |= POWEROFF - L.update() /obj/machinery/light_switch/power_change() diff --git a/html/changelogs/geeves-non_essential_lights.yml b/html/changelogs/geeves-non_essential_lights.yml new file mode 100644 index 00000000000..9d6a26341c2 --- /dev/null +++ b/html/changelogs/geeves-non_essential_lights.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Areas with lightswitches now start with them off, unless someone spawned in at them during round start." \ No newline at end of file diff --git a/maps/_common/areas/station/civilian.dm b/maps/_common/areas/station/civilian.dm index d1cfba1b593..1e223fa7848 100644 --- a/maps/_common/areas/station/civilian.dm +++ b/maps/_common/areas/station/civilian.dm @@ -121,6 +121,7 @@ name = "\improper Bar" icon_state = "bar" sound_env = LARGE_SOFTFLOOR + lightswitch = TRUE allow_nightmode = 0 /area/crew_quarters/bar/below diff --git a/maps/_common/areas/station/engineering.dm b/maps/_common/areas/station/engineering.dm index 93a95ecd006..bf7c66d6fad 100644 --- a/maps/_common/areas/station/engineering.dm +++ b/maps/_common/areas/station/engineering.dm @@ -65,6 +65,7 @@ /area/engineering/engineering_hallway_main name = "\improper Engineering - Main Level Hallway" + lightswitch = TRUE icon_state = "engine_monitoring" /area/engineering/foyer diff --git a/maps/_common/areas/station/hallways.dm b/maps/_common/areas/station/hallways.dm index f99f22dd6f2..a6df4d101ec 100644 --- a/maps/_common/areas/station/hallways.dm +++ b/maps/_common/areas/station/hallways.dm @@ -3,8 +3,9 @@ /area/hallway sound_env = LARGE_ENCLOSED - allow_nightmode = 1 - station_area = 1 + allow_nightmode = TRUE + station_area = TRUE + lightswitch = TRUE holomap_color = HOLOMAP_AREACOLOR_HALLWAYS /area/hallway/primary/fore @@ -38,13 +39,14 @@ /area/hallway/secondary/exit name = "\improper Surface - Red Dock" icon_state = "escape" - no_light_control = 1 + no_light_control = TRUE holomap_color = HOLOMAP_AREACOLOR_ESCAPE /area/hallway/secondary/construction name = "\improper Construction Area" icon_state = "construction" - allow_nightmode = 0 + allow_nightmode = FALSE + lightswitch = FALSE /area/hallway/secondary/entry/fore name = "\improper Surface Lvl. Hallway Fore" diff --git a/maps/_common/areas/station/medical.dm b/maps/_common/areas/station/medical.dm index 952ee01db4f..459d0986b7b 100644 --- a/maps/_common/areas/station/medical.dm +++ b/maps/_common/areas/station/medical.dm @@ -7,6 +7,7 @@ /area/medical/medbay name = "\improper Medbay Hallway - Port" + lightswitch = TRUE icon_state = "medbay" ambience = list('sound/ambience/signal.ogg') @@ -22,16 +23,19 @@ /area/medical/medbay2 name = "\improper Medbay Hallway - Starboard" + lightswitch = TRUE icon_state = "medbay2" ambience = list('sound/ambience/signal.ogg') /area/medical/medbay3 name = "\improper Medbay Hallway - Fore" + lightswitch = TRUE icon_state = "medbay3" ambience = list('sound/ambience/signal.ogg') /area/medical/medbay4 name = "\improper Medbay Hallway - Staff Wing" + lightswitch = TRUE icon_state = "medbay4" ambience = list('sound/ambience/signal.ogg') @@ -52,6 +56,7 @@ /area/medical/upperlevel name = "\improper Medical - Upper-Level Hallway" + lightswitch = TRUE icon_state = "medbay2" /area/crew_quarters/medbreak @@ -85,6 +90,7 @@ /area/medical/patient_wing_hallway name = "\improper Medical - Patient Wing Hallway" + lightswitch = TRUE icon_state = "patients" /area/medical/patient_wing_gym diff --git a/maps/_common/areas/station/research.dm b/maps/_common/areas/station/research.dm index e20f40ee481..bace79a8905 100644 --- a/maps/_common/areas/station/research.dm +++ b/maps/_common/areas/station/research.dm @@ -30,6 +30,11 @@ station_area = 1 holomap_color = HOLOMAP_AREACOLOR_SCIENCE +/area/rnd/hallway + name = "\improper Research - Hallway" + icon_state = "research" + lightswitch = TRUE + /area/rnd/research name = "\improper Research and Development" icon_state = "research" diff --git a/maps/_common/areas/station/security.dm b/maps/_common/areas/station/security.dm index f5c0af4dfd3..4952632ae75 100644 --- a/maps/_common/areas/station/security.dm +++ b/maps/_common/areas/station/security.dm @@ -10,6 +10,12 @@ name = "\improper Security - Equipment Room" icon_state = "security" +// For mapppers +/area/security/hallway + name = "\improper Security - Hallway" + lightswitch = TRUE + icon_state = "security" + /area/security/lobby name = "\improper Security - Lobby" icon_state = "security" @@ -18,6 +24,7 @@ /area/security/brig name = "\improper Security - Brig" + lightswitch = TRUE icon_state = "brig" /area/security/brig/prison_break() @@ -30,6 +37,7 @@ /area/security/prison name = "\improper Security - Prison Wing" + lightswitch = TRUE icon_state = "sec_prison" /area/security/prison/prison_break()