This commit is contained in:
Sparky
2021-02-16 20:47:45 +01:00
committed by GitHub
parent e934f8f9d9
commit 7c3ed19c4b
8 changed files with 18 additions and 59 deletions
+2 -30
View File
@@ -4,7 +4,7 @@ var/datum/controller/subsystem/nightlight/SSnightlight
name = "Night Lighting"
wait = 5 MINUTES
init_order = SS_INIT_NIGHT
flags = SS_BACKGROUND | SS_NO_TICK_CHECK
flags = SS_BACKGROUND | SS_NO_TICK_CHECK | SS_NO_FIRE
priority = SS_PRIORITY_NIGHT
var/isactive = FALSE
@@ -13,18 +13,8 @@ var/datum/controller/subsystem/nightlight/SSnightlight
/datum/controller/subsystem/nightlight/New()
NEW_SS_GLOBAL(SSnightlight)
/datum/controller/subsystem/nightlight/Initialize(timeofday)
if (!config.night_lighting)
can_fire = FALSE
flags |= SS_NO_FIRE
return
fire(FALSE, FALSE)
..()
/datum/controller/subsystem/nightlight/stat_entry()
..("A:[isactive] T:[worldtime2hours()] DT:[config.nl_start] NT:[config.nl_finish] D:[disable_type]")
..("A:[isactive] T:[worldtime2hours()] D:[disable_type]")
/datum/controller/subsystem/nightlight/Recover()
src.isactive = SSnightlight.isactive
@@ -42,24 +32,6 @@ var/datum/controller/subsystem/nightlight/SSnightlight
if (disable_type == NL_TEMPORARY_DISABLE)
wake()
/datum/controller/subsystem/nightlight/fire(resumed = FALSE, announce = TRUE)
if (disable_type)
log_debug("SSnightlight: disable_type was [disable_type] but can_fire was TRUE! Disabling self.")
suspend()
return
var/time = worldtime2hours()
if (time <= config.nl_finish || time >= config.nl_start)
if (!isactive)
activate()
if (announce)
command_announcement.Announce("Good evening. The time is [worldtime2text()]. \n\nThe automated systems aboard the [station_name()] will now dim lighting in the public hallways in order to accommodate the circadian rhythm of some species.", "Automated Lighting System", new_sound = 'sound/misc/announcements/nightlight.ogg')
else
if (isactive)
deactivate()
if (announce)
command_announcement.Announce("Good morning. The time is [worldtime2text()]. \n\nThe automated systems aboard the [station_name()] will now return the public hallway lighting levels to normal.", "Automated Lighting System", new_sound = 'sound/misc/announcements/nightlight.ogg')
// 'whitelisted' areas are areas that have nightmode explicitly enabled
/datum/controller/subsystem/nightlight/proc/activate(var/whitelisted_only = 1)