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
+3 -11
View File
@@ -180,9 +180,7 @@ var/list/gamemode_cache = list()
var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour.
var/ghost_interaction = 0
var/night_lighting = 0
var/nl_start = 19
var/nl_finish = 8
var/time_offset = 6 //GMT to CST
var/enter_allowed = 1
@@ -708,14 +706,8 @@ var/list/gamemode_cache = list()
if("ghost_interaction")
config.ghost_interaction = 1
if("night_lighting")
config.night_lighting = 1
if("nl_start_hour")
config.nl_start = text2num(value)
if("nl_finish_hour")
config.nl_finish = text2num(value)
if("time_offset")
config.time_offset = text2num(value)
if("disable_player_rats")
config.disable_player_rats = 1
+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)