Merge pull request #10417 from kevinz000/nightshift_1
Nightshift improvements: public area settings/levels, nightshift auth requirement change, config changes, etc etc
This commit is contained in:
@@ -362,6 +362,15 @@
|
||||
|
||||
/datum/config_entry/flag/enable_night_shifts
|
||||
|
||||
/datum/config_entry/number/night_shift_public_areas_only
|
||||
config_entry_value = NIGHTSHIFT_AREA_PUBLIC
|
||||
|
||||
/datum/config_entry/flag/nightshift_toggle_requires_auth
|
||||
config_entry_value = FALSE
|
||||
|
||||
/datum/config_entry/flag/nightshift_toggle_public_requires_auth
|
||||
config_entry_value = TRUE
|
||||
|
||||
/datum/config_entry/flag/randomize_shift_time
|
||||
|
||||
/datum/config_entry/flag/shift_time_realtime
|
||||
|
||||
@@ -35,21 +35,29 @@ SUBSYSTEM_DEF(nightshift)
|
||||
if(!emergency)
|
||||
announce("Restoring night lighting configuration to normal operation.")
|
||||
else
|
||||
announce("Disabling night lighting: Station is in a state of emergency.")
|
||||
announce("Disabling night lighting: Station is in a state of emergency.")
|
||||
if(emergency)
|
||||
night_time = FALSE
|
||||
if(nightshift_active != night_time)
|
||||
update_nightshift(night_time, announcing)
|
||||
|
||||
/datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE)
|
||||
/datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, max_level_override)
|
||||
nightshift_active = active
|
||||
if(announce)
|
||||
if (active)
|
||||
announce("Good evening, crew. To reduce power consumption and stimulate the circadian rhythms of some species, all of the lights aboard the station have been dimmed for the night.")
|
||||
else
|
||||
announce("Good morning, crew. As it is now day time, all of the lights aboard the station have been restored to their former brightness.")
|
||||
var/max_level
|
||||
var/configured_level = CONFIG_GET(number/night_shift_public_areas_only)
|
||||
if(isnull(max_level_override))
|
||||
max_level = active? configured_level : INFINITY //by default, deactivating shuts off nightshifts everywhere.
|
||||
else
|
||||
max_level = max_level_override
|
||||
for(var/A in GLOB.apcs_list)
|
||||
var/obj/machinery/power/apc/APC = A
|
||||
if (APC.area && (APC.area.type in GLOB.the_station_areas))
|
||||
APC.set_nightshift(active)
|
||||
CHECK_TICK
|
||||
if(APC.area?.type in GLOB.the_station_areas)
|
||||
var/their_level = APC.area.nightshift_public_area
|
||||
if(!max_level || (their_level <= max_level)) //if max level is 0, it means public area-only config is disabled so hit everything. if their level is 0, it means they have nightshift forced.
|
||||
APC.set_nightshift(active)
|
||||
CHECK_TICK
|
||||
|
||||
Reference in New Issue
Block a user