From affc98668471ab2f93de5f9d7974baf3f85026de Mon Sep 17 00:00:00 2001 From: tigercat2000 Date: Mon, 26 Mar 2018 20:16:22 -0700 Subject: [PATCH] Fix time shit & Add secrets verb --- code/__HELPERS/time.dm | 8 ++++---- code/_globalvars/misc.dm | 2 +- code/controllers/subsystem/nightshift.dm | 2 +- code/modules/admin/secrets.dm | 1 + code/modules/admin/topic.dm | 18 ++++++++++++++++++ code/modules/power/apc.dm | 2 +- code/modules/power/lighting.dm | 2 +- code/world.dm | 2 +- 8 files changed, 28 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/time.dm b/code/__HELPERS/time.dm index c91f5921a54..00aae01d07b 100644 --- a/code/__HELPERS/time.dm +++ b/code/__HELPERS/time.dm @@ -33,17 +33,17 @@ /proc/gameTimestamp(format = "hh:mm:ss", wtime=null) if(!wtime) wtime = world.time - return time2text(wtime - timezoneOffset, format) + return time2text(wtime - GLOB.timezoneOffset, format) /* This is used for displaying the "station time" equivelent of a world.time value Calling it with no args will give you the current time, but you can specify a world.time-based value as an argument - You can use this, for example, to do "This will expire at [station_time_at(world.time + 500)]" to display a "station time" expiration date which is much more useful for a player)*/ -/proc/station_time(time=world.time) - return ((((time - round_start_time)) + GLOB.gametime_offset) % 864000) - timezoneOffset +/proc/station_time(time=world.time, display_only=FALSE) + return ((((time - round_start_time)) + GLOB.gametime_offset) % 864000) - (display_only ? GLOB.timezoneOffset : 0) /proc/station_time_timestamp(format = "hh:mm:ss", time=world.time) - return time2text(station_time(time), format) + return time2text(station_time(time, TRUE), format) /* Returns 1 if it is the selected month and day */ proc/isDay(var/month, var/day) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index cb0fdba6916..46c10ed351b 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -74,7 +74,7 @@ var/score_dmgestkey = null var/TAB = "    " -var/timezoneOffset = 0 // The difference betwen midnight (of the host computer) and 0 world.ticks. +GLOBAL_VAR_INIT(timezoneOffset, 0) // The difference betwen midnight (of the host computer) and 0 world.ticks. // For FTP requests. (i.e. downloading runtime logs.) // However it'd be ok to use for accessing attack logs and such too, which are even laggier. diff --git a/code/controllers/subsystem/nightshift.dm b/code/controllers/subsystem/nightshift.dm index 7c7b017868b..b24a1d45e59 100644 --- a/code/controllers/subsystem/nightshift.dm +++ b/code/controllers/subsystem/nightshift.dm @@ -48,7 +48,7 @@ SUBSYSTEM_DEF(nightshift) /datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE) nightshift_active = active if(announce) - if (active) + 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 announce("Good morning, crew. As it is now day time, all of the lights aboard the station have been restored to their former brightness.") diff --git a/code/modules/admin/secrets.dm b/code/modules/admin/secrets.dm index 9692eac6713..21731cc8b7a 100644 --- a/code/modules/admin/secrets.dm +++ b/code/modules/admin/secrets.dm @@ -23,6 +23,7 @@ Show Game Mode   Show Crew Manifest
Show current traitors and objectives
+ Set Night Shift Mode
Bombs
Bombing List   Remove all bombs currently in existence diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index d92b9088d4a..17b6a2b9dcd 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -3023,6 +3023,24 @@ dat += "[H]H.dna = null" dat += "" usr << browse(dat, "window=fingerprints;size=440x410") + if("night_shift_set") + var/val = alert(usr, "What do you want to set night shift to? This will override the automatic system until set to automatic again.", "Night Shift", "On", "Off", "Automatic") + switch(val) + if("Automatic") + if(config.enable_night_shifts) + SSnightshift.can_fire = TRUE + SSnightshift.fire() + else + SSnightshift.update_nightshift(FALSE, TRUE) + to_chat(usr, "Night shift set to automatic.") + if("On") + SSnightshift.can_fire = FALSE + SSnightshift.update_nightshift(TRUE, FALSE) + to_chat(usr, "Night shift forced on.") + if("Off") + SSnightshift.can_fire = FALSE + SSnightshift.update_nightshift(FALSE, FALSE) + to_chat(usr, "Night shift forced off.") else if(usr) log_admin("[key_name(usr)] used secret [href_list["secretsadmin"]]") diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index dac03bf0f16..188faa07b79 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -913,7 +913,7 @@ if(!is_authenticated(usr)) return - if(last_nightshift_switch < world.time + 100) // don't spam... + if(last_nightshift_switch > world.time + 100) // don't spam... to_chat(usr, "[src]'s night lighting circuit breaker is still cycling!") return last_nightshift_switch = world.time diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 16a9b577e90..9aab058f233 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -142,7 +142,7 @@ var/static_power_used = 0 var/brightness_range = 8 // luminosity when on, also used in power calculation var/brightness_power = 1 - var/brightness_color = null + var/brightness_color = "#FFFFFF" var/status = LIGHT_OK // LIGHT_OK, _EMPTY, _BURNED or _BROKEN var/flickering = 0 var/light_type = /obj/item/weapon/light/tube // the type of light item diff --git a/code/world.dm b/code/world.dm index 872b0cbd037..df3cf474d5a 100644 --- a/code/world.dm +++ b/code/world.dm @@ -32,7 +32,7 @@ var/global/list/map_transition_config = MAP_TRANSITION_CONFIG // dumb and hardcoded but I don't care~ config.server_name += " #[(world.port % 1000) / 100]" - timezoneOffset = text2num(time2text(0,"hh")) * 36000 + GLOB.timezoneOffset = text2num(time2text(0, "hh")) * 36000 callHook("startup")