Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 6eba384

Browse files
authored
[PARTIAL REVERT] Removes round start lights off (keeps empty departments) (#21466)
* remove light delay round start * Update lighting.dm * Update lighting.dm * empty departments only * Update Space_Station_13_areas.dm
1 parent b829970 commit 6eba384

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

code/controllers/subsystem/ticker.dm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ SUBSYSTEM_DEF(ticker)
330330

331331
PostSetup()
332332

333-
// Toggle lightswitches on in occupied departments
333+
334+
// Toggle lightswitches off in unoccupied departments
334335
var/list/lightup_area_typecache = list()
335336
var/minimal_access = CONFIG_GET(flag/jobs_have_minimal_access)
336337
for(var/mob/living/carbon/human/player in GLOB.player_list)
@@ -341,11 +342,17 @@ SUBSYSTEM_DEF(ticker)
341342
if(!job)
342343
continue
343344
lightup_area_typecache |= job.areas_to_light_up(minimal_access)
344-
for(var/area in lightup_area_typecache)
345-
var/area/place = locate(area) in GLOB.areas
346-
if(!place || place.lights_always_start_on)
345+
346+
for(var/area/place as anything in GLOB.areas)
347+
if(!istype(place))
348+
continue
349+
if(place.lights_always_start_on)
350+
continue
351+
if(!is_station_level(place.z))
352+
continue
353+
if(is_type_in_typecache(place, lightup_area_typecache))
347354
continue
348-
place.lightswitch = TRUE
355+
place.lightswitch = FALSE
349356
place.update_appearance()
350357

351358
for(var/obj/machinery/light_switch/lswitch in place)

code/game/area/Space_Station_13_areas.dm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
515515
/area/crew_quarters/theatre/abandoned
516516
name = "Abandoned Theatre"
517517
icon_state = "Theatre"
518-
lights_always_start_on = FALSE
519518

520519
/area/library
521520
name = "Library"

code/game/area/areas.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135

136136
/// Whether the lights in this area aren't turned off when it's empty at roundstart
137137
var/lights_always_start_on = FALSE
138+
138139

139140
/**
140141
* A list of teleport locations

code/game/machinery/lightswitch.dm

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@
9191
return INITIALIZE_HINT_LATELOAD
9292
return INITIALIZE_HINT_NORMAL
9393

94-
/obj/machinery/light_switch/LateInitialize()
95-
if(!is_station_level(z))
96-
return
97-
var/area/source_area = get_area(get_turf(src))
98-
if(source_area.lights_always_start_on)
99-
return
100-
turn_off()
101-
10294
/obj/machinery/light_switch/update_appearance(updates=ALL)
10395
. = ..()
10496
luminosity = (stat & NOPOWER) ? 0 : 1

code/modules/power/lighting.dm

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@
287287
///More stress stuff.
288288
var/turning_on = FALSE
289289

290+
///Flicker cooldown
291+
COOLDOWN_DECLARE(flicker_cooldown)
292+
290293
/obj/machinery/light/broken
291294
status = LIGHT_BROKEN
292295
icon_state = "tube-broken"
@@ -353,9 +356,6 @@
353356
// Light projects out backwards from the dir of the light
354357
set_light(l_dir = REVERSE_DIR(dir))
355358

356-
if(mapload && our_area.lights_always_start_on)
357-
turn_on(trigger = FALSE, quiet = TRUE)
358-
359359
return INITIALIZE_HINT_LATELOAD
360360

361361
/obj/machinery/light/LateInitialize()
@@ -729,8 +729,9 @@
729729

730730
/obj/machinery/light/proc/flicker(amount = rand(10, 20))
731731
set waitfor = 0
732-
if(flickering)
732+
if(flickering || !COOLDOWN_FINISHED(src, flicker_cooldown))
733733
return
734+
COOLDOWN_START(src, flicker_cooldown, 10 SECONDS)
734735
flickering = 1
735736
if(on && status == LIGHT_OK)
736737
for(var/i = 0; i < amount; i++)
@@ -1075,9 +1076,9 @@
10751076
transfer_fingerprints_to(M)
10761077
qdel(src)
10771078

1078-
/proc/flicker_all_lights()
1079+
/proc/flicker_all_lights() //not QUITE all lights, but it reduces lag
10791080
for(var/obj/machinery/light/L in GLOB.machines)
1080-
if(is_station_level(L.z))
1081+
if(is_station_level(L.z) && prob(50))
10811082
addtimer(CALLBACK(L, TYPE_PROC_REF(/obj/machinery/light, flicker), rand(3, 6)), rand(0, 15))
10821083

10831084
#undef LIGHT_ON_DELAY_UPPER

0 commit comments

Comments
 (0)