mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
@@ -73,9 +73,9 @@
|
||||
#define LIGHT_NARROW 45
|
||||
|
||||
// Night lighting controller times
|
||||
// The time (in ticks based on worldtime2ticks()) that various actions trigger
|
||||
#define MORNING_LIGHT_RESET 252000 // 7am or 07:00 - lighting restores to normal in morning
|
||||
#define NIGHT_LIGHT_ACTIVE 648000 // 6pm or 18:00 - night lighting mode activates
|
||||
// The time (in hours based on worldtime2hours()) that various actions trigger
|
||||
#define MORNING_LIGHT_RESET 7 // 7am or 07:00 - lighting restores to normal in morning
|
||||
#define NIGHT_LIGHT_ACTIVE 18 // 6pm or 18:00 - night lighting mode activates
|
||||
|
||||
// Some brightness/range defines for objects.
|
||||
#define L_WALLMOUNT_POWER 0.4
|
||||
|
||||
@@ -10,10 +10,12 @@ proc/worldtime2text(time = world.time, timeshift = 1)
|
||||
if(!roundstart_hour) roundstart_hour = rand(0, 23)
|
||||
return timeshift ? time2text(time+(36000*roundstart_hour), "hh:mm") : time2text(time, "hh:mm")
|
||||
|
||||
proc/worldtime2ticks(time = world.time)
|
||||
if(!roundstart_hour)
|
||||
/proc/worldtime2hours()
|
||||
if (!roundstart_hour)
|
||||
worldtime2text()
|
||||
return ((roundstart_hour * 60 MINUTES) + time) % TICKS_IN_DAY
|
||||
. = (world.timeofday / (60 MINUTES)) + roundstart_hour
|
||||
if (. > 24)
|
||||
. -= 24
|
||||
|
||||
proc/worlddate2text()
|
||||
return num2text(game_year) + "-" + time2text(world.timeofday, "MM-DD")
|
||||
|
||||
@@ -10,7 +10,7 @@ var/datum/controller/process/night_lighting/nl_ctrl
|
||||
|
||||
/datum/controller/process/night_lighting/setup()
|
||||
name = "night lighting controller"
|
||||
schedule_interval = 3600 // Every 5 minutes.
|
||||
schedule_interval = 5 MINUTES
|
||||
|
||||
nl_ctrl = src
|
||||
|
||||
@@ -18,34 +18,26 @@ var/datum/controller/process/night_lighting/nl_ctrl
|
||||
// Stop trying to delete processes. Not how it goes.
|
||||
disabled = 1
|
||||
|
||||
|
||||
/datum/controller/process/night_lighting/preStart()
|
||||
|
||||
switch (worldtime2ticks())
|
||||
if (0 to config.nl_finish)
|
||||
deactivate()
|
||||
if (config.nl_start to TICKS_IN_DAY)
|
||||
activate()
|
||||
|
||||
var/time = worldtime2hours()
|
||||
if (time <= config.nl_finish || time >= config.nl_start)
|
||||
activate()
|
||||
else
|
||||
deactivate()
|
||||
|
||||
/datum/controller/process/night_lighting/doWork()
|
||||
if (manual_override) // don't automatically change lighting if it was manually changed in-game
|
||||
return
|
||||
|
||||
switch (worldtime2ticks())
|
||||
if (0 to config.nl_finish)
|
||||
if (isactive)
|
||||
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/bosuns_whistle.ogg')
|
||||
deactivate()
|
||||
|
||||
if (config.nl_start to TICKS_IN_DAY)
|
||||
if (!isactive)
|
||||
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/bosuns_whistle.ogg')
|
||||
activate()
|
||||
|
||||
else
|
||||
if (isactive)
|
||||
deactivate()
|
||||
var/time = worldtime2hours()
|
||||
if (time <= config.nl_finish || time >= config.nl_start)
|
||||
if (!isactive)
|
||||
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/bosuns_whistle.ogg')
|
||||
activate()
|
||||
else
|
||||
if (isactive)
|
||||
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/bosuns_whistle.ogg')
|
||||
deactivate()
|
||||
|
||||
// 'whitelisted' areas are areas that have nightmode explicitly enabled
|
||||
|
||||
|
||||
@@ -177,8 +177,8 @@ var/list/gamemode_cache = list()
|
||||
var/ghost_interaction = 0
|
||||
|
||||
var/night_lighting = 0
|
||||
var/nl_start = 19 * TICKS_IN_HOUR
|
||||
var/nl_finish = 8 * TICKS_IN_HOUR
|
||||
var/nl_start = 19
|
||||
var/nl_finish = 8
|
||||
|
||||
var/comms_password = ""
|
||||
|
||||
@@ -629,10 +629,10 @@ var/list/gamemode_cache = list()
|
||||
config.night_lighting = 1
|
||||
|
||||
if("nl_start_hour")
|
||||
config.nl_start = text2num(value) * TICKS_IN_HOUR
|
||||
config.nl_start = text2num(value)
|
||||
|
||||
if("nl_finish_hour")
|
||||
config.nl_finish = text2num(value) * TICKS_IN_HOUR
|
||||
config.nl_finish = text2num(value)
|
||||
|
||||
if("disable_player_mice")
|
||||
config.disable_player_mice = 1
|
||||
|
||||
Reference in New Issue
Block a user