nightshift improvements

This commit is contained in:
kevinz000
2020-01-03 00:01:48 -08:00
parent 8e1affa1f5
commit aac1b42b8f
5 changed files with 24 additions and 18 deletions

View File

@@ -41,13 +41,19 @@ SUBSYSTEM_DEF(nightshift)
if(nightshift_active != night_time)
update_nightshift(night_time, announcing)
/datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, max_level = (!active? INFINITY : CONFIG_GET(number/night_shift_public_area_only)))
/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
var/public_only = CONFIG_GET(number/night_shift_public_area_only)
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 && (!max_level || !APC.area.nightshift_public_area || (APC.area.nightshift_public_area <= max_level)) && (APC.area.type in GLOB.the_station_areas))

View File

@@ -1408,7 +1408,7 @@
var/our_level = area.nightshift_public_area
var/public_requires_auth = CONFIG_GET(flag/nightshift_toggle_public_requires_auth)
var/normal_requires_auth = CONFIG_GET(flag/nightshift_toggle_requires_auth)
return (configured_level && our_level && (our_level <= configured_level))? public_requires_auth : normal_requires_auth)
return (configured_level && our_level && ((our_level <= configured_level)? public_requires_auth : normal_requires_auth))
#undef UPSTATE_CELL_IN
#undef UPSTATE_OPENED1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -132,7 +132,7 @@
</ui-notice>
<ui-notice>
<ui-section label='Night Shift Lighting'>
{{#if data.locked && !data.siliconUser}}
{{#if data.locked && !data.siliconUser && data.lock_nightshift}}
<span>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</span>
{{else}}
<ui-button icon='lightbulb-o' action='toggle_nightshift'>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</ui-button>