From 7c3ed19c4b409030fbda01aaa297a14aac4427bc Mon Sep 17 00:00:00 2001 From: Sparky Date: Tue, 16 Feb 2021 19:47:45 +0000 Subject: [PATCH] Real Time (#11076) --- code/__defines/lighting.dm | 5 --- code/_helpers/time.dm | 6 ++-- code/controllers/configuration.dm | 14 ++------ code/controllers/subsystems/night_lighting.dm | 32 ++----------------- code/modules/modular_computers/NTNet/NTNet.dm | 1 - code/modules/nano/modules/lighting_ctrl.dm | 2 -- config/example/config.txt | 10 ++---- html/changelogs/real time.yml | 7 ++++ 8 files changed, 18 insertions(+), 59 deletions(-) create mode 100644 html/changelogs/real time.yml diff --git a/code/__defines/lighting.dm b/code/__defines/lighting.dm index 8b4ed47a76b..06a92931191 100644 --- a/code/__defines/lighting.dm +++ b/code/__defines/lighting.dm @@ -107,11 +107,6 @@ #define LIGHT_WIDE 90 #define LIGHT_NARROW 45 -// Night lighting controller times -// 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 #define L_WALLMOUNT_RANGE 2 diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index de8ec4f451a..f6d21a45b1f 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -1,10 +1,12 @@ +#define TIME_OFFSET config.time_offset + var/roundstart_hour = 0 var/round_start_time //Returns the world time in english /proc/worldtime2text(time = world.time, timeshift = 1) - if(!roundstart_hour) roundstart_hour = rand(0, 23) - return timeshift ? time2text(time+(roundstart_hour HOURS), "hh:mm") : time2text(time, "hh:mm") + if(!roundstart_hour) roundstart_hour = REALTIMEOFDAY - (TIME_OFFSET HOURS) + return timeshift ? time2text(time+roundstart_hour, "hh:mm") : time2text(time, "hh:mm") /proc/worldtime2hours() if (!roundstart_hour) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 216e2fe5d81..f7c45b1d766 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -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 diff --git a/code/controllers/subsystems/night_lighting.dm b/code/controllers/subsystems/night_lighting.dm index ab6f999a182..49d0419c834 100644 --- a/code/controllers/subsystems/night_lighting.dm +++ b/code/controllers/subsystems/night_lighting.dm @@ -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) diff --git a/code/modules/modular_computers/NTNet/NTNet.dm b/code/modules/modular_computers/NTNet/NTNet.dm index e61f97b3d46..bd7007c747c 100644 --- a/code/modules/modular_computers/NTNet/NTNet.dm +++ b/code/modules/modular_computers/NTNet/NTNet.dm @@ -37,7 +37,6 @@ var/global/datum/ntnet/ntnet_global = new() R.NTNet = src build_software_lists() build_news_list() - add_log("NTNet logging system activated.") //add some default channels new /datum/ntnet_conversation("NTNet Relay", TRUE) diff --git a/code/modules/nano/modules/lighting_ctrl.dm b/code/modules/nano/modules/lighting_ctrl.dm index b83e616d4e0..2d9b81fd4b8 100644 --- a/code/modules/nano/modules/lighting_ctrl.dm +++ b/code/modules/nano/modules/lighting_ctrl.dm @@ -9,8 +9,6 @@ lstate = SSnightlight.is_active() ? "dark" : "full" /datum/nano_module/lighting_ctrl/proc/update_lighting() - if (!config.night_lighting) - return // whether to only select areas explicitly marked for nightlighting var/wl_only = context == "all" ? 0 : 1 diff --git a/config/example/config.txt b/config/example/config.txt index 6421f5824bf..1540417b577 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -327,14 +327,8 @@ GATEWAY_DELAY 18000 ## Uncomment to restrict non-admins from using humanoid alien races USEALIENWHITELIST -## Comment this to disable automated station night lighting -NIGHT_LIGHTING - -## Hour when the station night lighting is disabled (if above is enabled) -NL_FINISH_HOUR 8 - -## Hour when the station night lighting is enabled (if above is enabled) -NL_START_HOUR 19 +## Adjust this time to modify the time offset (in hours) of the station time from GMT +TIME_OFFSET 6 ## Comment this to unrestrict the number of alien players allowed in the round. The number represents the number of alien players for every human player. #ALIEN_PLAYER_RATIO 0.2 diff --git a/html/changelogs/real time.yml b/html/changelogs/real time.yml new file mode 100644 index 00000000000..b03e94a5a9f --- /dev/null +++ b/html/changelogs/real time.yml @@ -0,0 +1,7 @@ +author: Sparky_hotdog + +delete-after: True + +changes: + - tweak: "Station time is now based of Galactic Standard Time (CST IRL)." + - rscdel: "Removed automated nightlighting. Nightlighting can still be enabled via the lighting control program, and via individual APCs."