Randomized Station Time + Night Shifts

This commit is contained in:
kevinz000
2018-02-17 16:05:31 -08:00
parent 0097714eab
commit 8ebc63d2f2
33 changed files with 206 additions and 57 deletions

View File

@@ -24,4 +24,4 @@ When using time2text(), please use "DDD" to find the weekday. Refrain from using
#define DS2TICKS(DS) ((DS)/world.tick_lag) #define DS2TICKS(DS) ((DS)/world.tick_lag)
#define TICKS2DS(T) ((T) TICKS) #define TICKS2DS(T) ((T) TICKS)

View File

@@ -9,7 +9,23 @@
/proc/gameTimestamp(format = "hh:mm:ss", wtime=null) /proc/gameTimestamp(format = "hh:mm:ss", wtime=null)
if(!wtime) if(!wtime)
wtime = world.time wtime = world.time
return time2text(wtime - GLOB.timezoneOffset + SSticker.gametime_offset - SSticker.round_start_time, format) return time2text(wtime - GLOB.timezoneOffset, format)
/proc/station_time()
return ((((world.time - SSticker.round_start_time) * SSticker.station_time_rate_multiplier) + SSticker.gametime_offset) % 864000) - GLOB.timezoneOffset
/proc/station_time_timestamp(format = "hh:mm:ss")
return time2text(station_time(), format)
/proc/station_time_debug(force_set)
if(isnum(force_set))
SSticker.gametime_offset = force_set
return
SSticker.gametime_offset = rand(0, 864000) //hours in day * minutes in hour * seconds in minute * deciseconds in second
if(prob(50))
SSticker.gametime_offset = FLOOR(SSticker.gametime_offset, 3600)
else
SSticker.gametime_offset = CEILING(SSticker.gametime_offset, 3600)
/* Returns 1 if it is the selected month and day */ /* Returns 1 if it is the selected month and day */
/proc/isDay(month, day) /proc/isDay(month, day)

View File

@@ -13,7 +13,7 @@
//#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green //#define VISUALIZE_ACTIVE_TURFS //Highlights atmos active turfs in green
#endif #endif
//#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER //#define UNIT_TESTS //Enables unit tests via TEST_RUN_PARAMETER
#ifndef PRELOAD_RSC //set to: #ifndef PRELOAD_RSC //set to:
#define PRELOAD_RSC 0 // 0 to allow using external resources or on-demand behaviour; #define PRELOAD_RSC 0 // 0 to allow using external resources or on-demand behaviour;

View File

@@ -258,3 +258,9 @@
integer = FALSE integer = FALSE
/datum/config_entry/flag/ic_printing /datum/config_entry/flag/ic_printing
/datum/config_entry/flag/enable_night_shifts
/datum/config_entry/flag/randomize_shift_time
/datum/config_entry/flag/shift_time_realtime

View File

@@ -0,0 +1,68 @@
SUBSYSTEM_DEF(nightshift)
name = "Night Shift"
wait = 600
flags = SS_NO_TICK_CHECK
var/nightshift_active = FALSE
var/nightshift_start_time = 702000 //7:30 PM, station time
var/nightshift_end_time = 270000 //7:30 AM, station time
var/nightshift_first_check = 30 SECONDS
var/obey_security_level = TRUE
var/high_security_mode = FALSE
/datum/controller/subsystem/nightshift/Initialize()
if(!CONFIG_GET(flag/enable_night_shifts))
can_fire = FALSE
return ..()
/datum/controller/subsystem/nightshift/fire(resumed = FALSE)
if(world.time - SSticker.round_start_time < nightshift_first_check)
return
check_nightshift()
/datum/controller/subsystem/nightshift/proc/check_nightshift(force_set = FALSE)
var/time = station_time()
var/nightshift = time < nightshift_end_time || time > nightshift_start_time
var/red_or_delta = GLOB.security_level == SEC_LEVEL_RED || GLOB.security_level == SEC_LEVEL_DELTA
var/announcing = TRUE
if(nightshift && red_or_delta)
nightshift = FALSE
if(high_security_mode && !red_or_delta)
high_security_mode = FALSE
priority_announce("Restoring night lighting configuration to normal operation.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
announcing = FALSE
else if(!high_security_mode && red_or_delta)
high_security_mode = TRUE
priority_announce("Night lighting disabled: Station is in a state of emergency.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
announcing = FALSE
if((nightshift_active != nightshift) || force_set)
nightshift? activate_nightshift(announcing) : deactivate_nightshift(announcing)
/datum/controller/subsystem/nightshift/proc/activate_nightshift(announce = TRUE)
if(!nightshift_active)
if(announce)
priority_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.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
nightshift_active = TRUE
var/list/area/affected = return_nightshift_area_types()
for(var/i in affected)
var/area/A = locate(i) in GLOB.sortedAreas
for(var/obj/machinery/power/apc/APC in A)
APC.set_nightshift(TRUE)
CHECK_TICK
/datum/controller/subsystem/nightshift/proc/deactivate_nightshift(announce = TRUE)
if(nightshift_active)
if(announce)
priority_announce("Good morning, crew. As it is now day time, all of the lights aboard the station have been restored to their former brightness.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
nightshift_active = FALSE
var/list/area/affected = return_nightshift_area_types()
for(var/i in affected)
var/area/A = locate(i) in GLOB.sortedAreas
for(var/obj/machinery/power/apc/APC in A)
APC.set_nightshift(FALSE)
CHECK_TICK
/datum/controller/subsystem/nightshift/proc/return_nightshift_area_types()
return GLOB.the_station_areas.Copy()

View File

@@ -45,7 +45,8 @@ SUBSYSTEM_DEF(ticker)
var/timeLeft //pregame timer var/timeLeft //pregame timer
var/start_at var/start_at
var/gametime_offset = 432000 // equal to 12 hours, making gametime at roundstart 12:00:00 var/gametime_offset = 432000 //Deciseconds to add to world.time for station time.
var/station_time_rate_multiplier = 24 //factor of station time progressal vs real time.
var/totalPlayers = 0 //used for pregame stats on statpanel var/totalPlayers = 0 //used for pregame stats on statpanel
var/totalPlayersReady = 0 //used for pregame stats on statpanel var/totalPlayersReady = 0 //used for pregame stats on statpanel
@@ -131,6 +132,10 @@ SUBSYSTEM_DEF(ticker)
..() ..()
start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10) start_at = world.time + (CONFIG_GET(number/lobby_countdown) * 10)
if(CONFIG_GET(flag/randomize_shift_time))
gametime_offset = rand(0, 23) HOURS
else if(CONFIG_GET(flag/shift_time_realtime))
gametime_offset = world.timeofday
/datum/controller/subsystem/ticker/fire() /datum/controller/subsystem/ticker/fire()
switch(current_state) switch(current_state)

View File

@@ -187,7 +187,7 @@
interact(usr) //Refresh the UI after a filter changes interact(usr) //Refresh the UI after a filter changes
/obj/machinery/computer/apc_control/emag_act(mob/user) /obj/machinery/computer/apc_control/emag_act(mob/user)
if(!authenticated) if(!authenticated)
to_chat(user, "<span class='warning'>You bypass [src]'s access requirements using your emag.</span>") to_chat(user, "<span class='warning'>You bypass [src]'s access requirements using your emag.</span>")
authenticated = TRUE authenticated = TRUE
log_activity("logged in") log_activity("logged in")
@@ -199,7 +199,7 @@
/obj/machinery/computer/apc_control/proc/log_activity(log_text) /obj/machinery/computer/apc_control/proc/log_activity(log_text)
var/op_string = operator && !(obj_flags & EMAGGED) ? operator : "\[NULL OPERATOR\]" var/op_string = operator && !(obj_flags & EMAGGED) ? operator : "\[NULL OPERATOR\]"
LAZYADD(logs, "<b>([worldtime2text()])</b> [op_string] [log_text]") LAZYADD(logs, "<b>([station_time_timestamp()])</b> [op_string] [log_text]")
/mob/proc/using_power_flow_console() /mob/proc/using_power_flow_console()
for(var/obj/machinery/computer/apc_control/A in range(1, src)) for(var/obj/machinery/computer/apc_control/A in range(1, src))

View File

@@ -495,7 +495,7 @@
var/counter = 1 var/counter = 1
while(src.active2.fields[text("com_[]", counter)]) while(src.active2.fields[text("com_[]", counter)])
counter++ counter++
src.active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [] [], []<BR>[]", src.authenticated, src.rank, worldtime2text(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1) src.active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [] [], []<BR>[]", src.authenticated, src.rank, station_time_timestamp(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1)
else if(href_list["del_c"]) else if(href_list["del_c"])
if((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])])) if((istype(src.active2, /datum/data/record) && src.active2.fields[text("com_[]", href_list["del_c"])]))

View File

@@ -474,7 +474,7 @@ What a mess.*/
var/counter = 1 var/counter = 1
while(active2.fields[text("com_[]", counter)]) while(active2.fields[text("com_[]", counter)])
counter++ counter++
active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [] [], []<BR>[]", src.authenticated, src.rank, worldtime2text(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1) active2.fields[text("com_[]", counter)] = text("Made by [] ([]) on [] [], []<BR>[]", src.authenticated, src.rank, station_time_timestamp(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1)
if("Delete Record (ALL)") if("Delete Record (ALL)")
if(active1) if(active1)
@@ -616,7 +616,7 @@ What a mess.*/
if(active1.fields["photo_front"]) if(active1.fields["photo_front"])
if(istype(active1.fields["photo_front"], /obj/item/photo)) if(istype(active1.fields["photo_front"], /obj/item/photo))
var/obj/item/photo/P = active1.fields["photo_front"] var/obj/item/photo/P = active1.fields["photo_front"]
print_photo(P.img, active1.fields["name"]) print_photo(P.img, active1.fields["name"])
if("show_photo_side") if("show_photo_side")
if(active1.fields["photo_side"]) if(active1.fields["photo_side"])
if(istype(active1.fields["photo_side"], /obj/item/photo)) if(istype(active1.fields["photo_side"], /obj/item/photo))
@@ -631,14 +631,14 @@ What a mess.*/
if(active1.fields["photo_side"]) if(active1.fields["photo_side"])
if(istype(active1.fields["photo_side"], /obj/item/photo)) if(istype(active1.fields["photo_side"], /obj/item/photo))
var/obj/item/photo/P = active1.fields["photo_side"] var/obj/item/photo/P = active1.fields["photo_side"]
print_photo(P.img, active1.fields["name"]) print_photo(P.img, active1.fields["name"])
if("mi_crim_add") if("mi_crim_add")
if(istype(active1, /datum/data/record)) if(istype(active1, /datum/data/record))
var/t1 = stripped_input(usr, "Please input minor crime names:", "Secure. records", "", null) var/t1 = stripped_input(usr, "Please input minor crime names:", "Secure. records", "", null)
var/t2 = stripped_input(usr, "Please input minor crime details:", "Secure. records", "", null) var/t2 = stripped_input(usr, "Please input minor crime details:", "Secure. records", "", null)
if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return return
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, worldtime2text()) var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, station_time_timestamp())
GLOB.data_core.addMinorCrime(active1.fields["id"], crime) GLOB.data_core.addMinorCrime(active1.fields["id"], crime)
if("mi_crim_delete") if("mi_crim_delete")
if(istype(active1, /datum/data/record)) if(istype(active1, /datum/data/record))
@@ -652,7 +652,7 @@ What a mess.*/
var/t2 = stripped_input(usr, "Please input major crime details:", "Secure. records", "", null) var/t2 = stripped_input(usr, "Please input major crime details:", "Secure. records", "", null)
if(!canUseSecurityRecordsConsole(usr, t1, null, a2)) if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return return
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, worldtime2text()) var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, station_time_timestamp())
GLOB.data_core.addMajorCrime(active1.fields["id"], crime) GLOB.data_core.addMajorCrime(active1.fields["id"], crime)
if("ma_crim_delete") if("ma_crim_delete")
if(istype(active1, /datum/data/record)) if(istype(active1, /datum/data/record))

View File

@@ -141,7 +141,7 @@ GLOBAL_LIST_INIT(possible_uplinker_IDs, list("Alfa","Bravo","Charlie","Delta","E
var/list/transferlog = list() var/list/transferlog = list()
/obj/machinery/computer/telecrystals/boss/proc/logTransfer(logmessage) /obj/machinery/computer/telecrystals/boss/proc/logTransfer(logmessage)
transferlog += ("<b>[worldtime2text()]</b> [logmessage]") transferlog += ("<b>[station_time_timestamp()]</b> [logmessage]")
/obj/machinery/computer/telecrystals/boss/proc/scanUplinkers() /obj/machinery/computer/telecrystals/boss/proc/scanUplinkers()
for(var/obj/machinery/computer/telecrystals/uplinker/A in urange(scanrange, src.loc)) for(var/obj/machinery/computer/telecrystals/uplinker/A in urange(scanrange, src.loc))

View File

@@ -122,7 +122,7 @@ GLOBAL_LIST_EMPTY(allCasters)
var/datum/newscaster/feed_message/newMsg = new /datum/newscaster/feed_message var/datum/newscaster/feed_message/newMsg = new /datum/newscaster/feed_message
newMsg.author = author newMsg.author = author
newMsg.body = msg newMsg.body = msg
newMsg.time_stamp = "[worldtime2text()]" newMsg.time_stamp = "[station_time_timestamp()]"
newMsg.is_admin_message = adminMessage newMsg.is_admin_message = adminMessage
newMsg.locked = !allow_comments newMsg.locked = !allow_comments
if(photo) if(photo)
@@ -701,7 +701,7 @@ GLOBAL_LIST_EMPTY(allCasters)
var/datum/newscaster/feed_comment/FC = new/datum/newscaster/feed_comment var/datum/newscaster/feed_comment/FC = new/datum/newscaster/feed_comment
FC.author = scanned_user FC.author = scanned_user
FC.body = cominput FC.body = cominput
FC.time_stamp = worldtime2text() FC.time_stamp = station_time_timestamp()
FM.comments += FC FM.comments += FC
log_talk(usr,"[key_name(usr)] as [scanned_user] commented on message [FM.returnBody(-1)] -- [FC.body]",LOGCOMMENT) log_talk(usr,"[key_name(usr)] as [scanned_user] commented on message [FM.returnBody(-1)] -- [FC.body]",LOGCOMMENT)
updateUsrDialog() updateUsrDialog()

View File

@@ -996,7 +996,7 @@
/obj/mecha/proc/log_message(message as text,red=null) /obj/mecha/proc/log_message(message as text,red=null)
log.len++ log.len++
log[log.len] = list("time"="[worldtime2text()]","date","year"="[GLOB.year_integer+540]","message"="[red?"<font color='red'>":null][message][red?"</font>":null]") log[log.len] = list("time"="[station_time_timestamp()]","date","year"="[GLOB.year_integer+540]","message"="[red?"<font color='red'>":null][message][red?"</font>":null]")
return log.len return log.len
/obj/mecha/proc/log_append_to_last(message as text,red=null) /obj/mecha/proc/log_append_to_last(message as text,red=null)

View File

@@ -212,7 +212,7 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += text("ID: <a href='?src=[REF(src)];choice=Authenticate'>[id ? "[id.registered_name], [id.assignment]" : "----------"]") dat += text("ID: <a href='?src=[REF(src)];choice=Authenticate'>[id ? "[id.registered_name], [id.assignment]" : "----------"]")
dat += text("<br><a href='?src=[REF(src)];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br><br>") dat += text("<br><a href='?src=[REF(src)];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br><br>")
dat += "[worldtime2text()]<br>" //:[world.time / 100 % 6][world.time / 100 % 10]" dat += "[station_time_timestamp()]<br>" //:[world.time / 100 % 6][world.time / 100 % 10]"
dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]" dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]"
dat += "<br><br>" dat += "<br><br>"

View File

@@ -1074,7 +1074,7 @@
/obj/item/toy/clockwork_watch/examine(mob/user) /obj/item/toy/clockwork_watch/examine(mob/user)
..() ..()
to_chat(user, "<span class='info'>Station Time: [worldtime2text()]") to_chat(user, "<span class='info'>Station Time: [station_time_timestamp()]")
/* /*
* Toy Dagger * Toy Dagger

View File

@@ -64,12 +64,14 @@
return FALSE return FALSE
/datum/ntnet/proc/log_data_transfer(datum/netdata/data) /datum/ntnet/proc/log_data_transfer(datum/netdata/data)
logs += "[worldtime2text()] - [data.generate_netlog()]" logs += "[station_time_timestamp()] - [data.generate_netlog()]"
if(logs.len > setting_maxlogcount)
logs = logs.Copy(logs.len - setting_maxlogcount, 0)
return return
// Simplified logging: Adds a log. log_string is mandatory parameter, source is optional. // Simplified logging: Adds a log. log_string is mandatory parameter, source is optional.
/datum/ntnet/proc/add_log(log_string, obj/item/computer_hardware/network_card/source = null) /datum/ntnet/proc/add_log(log_string, obj/item/computer_hardware/network_card/source = null)
var/log_text = "[worldtime2text()] - " var/log_text = "[station_time_timestamp()] - "
if(source) if(source)
log_text += "[source.get_network_tag()] - " log_text += "[source.get_network_tag()] - "
else else

View File

@@ -11,7 +11,7 @@
to_chat(user, "<span class='notice'>We begin our stasis, preparing energy to arise once more.</span>") to_chat(user, "<span class='notice'>We begin our stasis, preparing energy to arise once more.</span>")
if(user.stat != DEAD) if(user.stat != DEAD)
user.emote("deathgasp") user.emote("deathgasp")
user.tod = worldtime2text() user.tod = station_time_timestamp()
user.fakedeath("changeling") //play dead user.fakedeath("changeling") //play dead
user.update_stat() user.update_stat()
user.update_canmove() user.update_canmove()

View File

@@ -103,7 +103,7 @@
// We gathered everything. Create a fork and slowly display the results to the holder of the scanner. // We gathered everything. Create a fork and slowly display the results to the holder of the scanner.
var/found_something = 0 var/found_something = 0
add_log("<B>[worldtime2text()][get_timestamp()] - [target_name]</B>", 0) add_log("<B>[station_time_timestamp()][get_timestamp()] - [target_name]</B>", 0)
// Fingerprints // Fingerprints
if(length(fingerprints)) if(length(fingerprints))

View File

@@ -73,7 +73,7 @@
var/obj/item/clothing/suit/space/space_ninja/SN = wear_suit var/obj/item/clothing/suit/space/space_ninja/SN = wear_suit
if(statpanel("SpiderOS")) if(statpanel("SpiderOS"))
stat("SpiderOS Status:","[SN.s_initialized ? "Initialized" : "Disabled"]") stat("SpiderOS Status:","[SN.s_initialized ? "Initialized" : "Disabled"]")
stat("Current Time:", "[worldtime2text()]") stat("Current Time:", "[station_time_timestamp()]")
if(SN.s_initialized) if(SN.s_initialized)
//Suit gear //Suit gear
stat("Energy Charge:", "[round(SN.cell.charge/100)]%") stat("Energy Charge:", "[round(SN.cell.charge/100)]%")
@@ -423,7 +423,7 @@
return return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security) && !istype(H.getorganslot(ORGAN_SLOT_HUD), /obj/item/organ/cyberimp/eyes/hud/security)) else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security) && !istype(H.getorganslot(ORGAN_SLOT_HUD), /obj/item/organ/cyberimp/eyes/hud/security))
return return
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, allowed_access, worldtime2text()) var/crime = GLOB.data_core.createCrimeEntry(t1, t2, allowed_access, station_time_timestamp())
GLOB.data_core.addMinorCrime(R.fields["id"], crime) GLOB.data_core.addMinorCrime(R.fields["id"], crime)
to_chat(usr, "<span class='notice'>Successfully added a minor crime.</span>") to_chat(usr, "<span class='notice'>Successfully added a minor crime.</span>")
return return
@@ -438,7 +438,7 @@
return return
else if (!istype(H.glasses, /obj/item/clothing/glasses/hud/security) && !istype(H.getorganslot(ORGAN_SLOT_HUD), /obj/item/organ/cyberimp/eyes/hud/security)) else if (!istype(H.glasses, /obj/item/clothing/glasses/hud/security) && !istype(H.getorganslot(ORGAN_SLOT_HUD), /obj/item/organ/cyberimp/eyes/hud/security))
return return
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, allowed_access, worldtime2text()) var/crime = GLOB.data_core.createCrimeEntry(t1, t2, allowed_access, station_time_timestamp())
GLOB.data_core.addMajorCrime(R.fields["id"], crime) GLOB.data_core.addMajorCrime(R.fields["id"], crime)
to_chat(usr, "<span class='notice'>Successfully added a major crime.</span>") to_chat(usr, "<span class='notice'>Successfully added a major crime.</span>")
return return
@@ -470,7 +470,7 @@
var/counter = 1 var/counter = 1
while(R.fields[text("com_[]", counter)]) while(R.fields[text("com_[]", counter)])
counter++ counter++
R.fields[text("com_[]", counter)] = text("Made by [] on [] [], []<BR>[]", allowed_access, worldtime2text(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1) R.fields[text("com_[]", counter)] = text("Made by [] on [] [], []<BR>[]", allowed_access, station_time_timestamp(), time2text(world.realtime, "MMM DD"), GLOB.year_integer+540, t1)
to_chat(usr, "<span class='notice'>Successfully added comment.</span>") to_chat(usr, "<span class='notice'>Successfully added comment.</span>")
return return
to_chat(usr, "<span class='warning'>Unable to locate a data core entry for this person.</span>") to_chat(usr, "<span class='warning'>Unable to locate a data core entry for this person.</span>")

View File

@@ -47,7 +47,7 @@
stat = DEAD stat = DEAD
unset_machine() unset_machine()
timeofdeath = world.time timeofdeath = world.time
tod = worldtime2text() tod = station_time_timestamp()
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
for(var/obj/item/I in contents) for(var/obj/item/I in contents)
I.on_mob_death(src, gibbed) I.on_mob_death(src, gibbed)

View File

@@ -228,5 +228,5 @@
if(stat == DEAD) if(stat == DEAD)
return return
add_trait(TRAIT_FAKEDEATH, source) add_trait(TRAIT_FAKEDEATH, source)
tod = worldtime2text() tod = station_time_timestamp()
update_stat() update_stat()

View File

@@ -284,7 +284,7 @@
else else
client.perspective = EYE_PERSPECTIVE client.perspective = EYE_PERSPECTIVE
client.eye = loc client.eye = loc
return 1 return 1
/mob/living/reset_perspective(atom/A) /mob/living/reset_perspective(atom/A)
if(..()) if(..())
@@ -595,7 +595,8 @@
stat(null, "Next Map: [cached.map_name]") stat(null, "Next Map: [cached.map_name]")
stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]") stat(null, "Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]")
stat(null, "Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]") stat(null, "Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]")
stat(null, "Station Time: [worldtime2text()]") stat(null, "Round Time: [worldtime2text()]")
stat(null, "Station Time: [station_time_timestamp()]")
stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)") stat(null, "Time Dilation: [round(SStime_track.time_dilation_current,1)]% AVG:([round(SStime_track.time_dilation_avg_fast,1)]%, [round(SStime_track.time_dilation_avg,1)]%, [round(SStime_track.time_dilation_avg_slow,1)]%)")
if(SSshuttle.emergency) if(SSshuttle.emergency)
var/ETA = SSshuttle.emergency.getModeStr() var/ETA = SSshuttle.emergency.getModeStr()

View File

@@ -19,12 +19,12 @@
return ..() return ..()
/datum/ntnet_conversation/proc/add_message(message, username) /datum/ntnet_conversation/proc/add_message(message, username)
message = "[worldtime2text()] [username]: [message]" message = "[station_time_timestamp()] [username]: [message]"
messages.Add(message) messages.Add(message)
trim_message_list() trim_message_list()
/datum/ntnet_conversation/proc/add_status_message(message) /datum/ntnet_conversation/proc/add_status_message(message)
messages.Add("[worldtime2text()] -!- [message]") messages.Add("[station_time_timestamp()] -!- [message]")
trim_message_list() trim_message_list()
/datum/ntnet_conversation/proc/trim_message_list() /datum/ntnet_conversation/proc/trim_message_list()

View File

@@ -330,7 +330,7 @@
data["PC_programheaders"] = program_headers data["PC_programheaders"] = program_headers
data["PC_stationtime"] = worldtime2text() data["PC_stationtime"] = station_time_timestamp()
data["PC_hasheader"] = 1 data["PC_hasheader"] = 1
data["PC_showexitprogram"] = active_program ? 1 : 0 // Hides "Exit Program" button on mainscreen data["PC_showexitprogram"] = active_program ? 1 : 0 // Hides "Exit Program" button on mainscreen
return data return data

View File

@@ -159,7 +159,7 @@
<br> <br>
[GLOB.data_core ? GLOB.data_core.get_manifest(0) : ""] [GLOB.data_core ? GLOB.data_core.get_manifest(0) : ""]
"} "}
if(!printer.print_text(contents,text("crew manifest ([])", worldtime2text()))) if(!printer.print_text(contents,text("crew manifest ([])", station_time_timestamp())))
to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>") to_chat(usr, "<span class='notice'>Hardware error: Printer was unable to print the file. It may be out of paper.</span>")
return return
else else

View File

@@ -145,7 +145,7 @@
t = replacetext(t, "\[/i\]", "</I>") t = replacetext(t, "\[/i\]", "</I>")
t = replacetext(t, "\[u\]", "<U>") t = replacetext(t, "\[u\]", "<U>")
t = replacetext(t, "\[/u\]", "</U>") t = replacetext(t, "\[/u\]", "</U>")
t = replacetext(t, "\[time\]", "[worldtime2text()]") t = replacetext(t, "\[time\]", "[station_time_timestamp()]")
t = replacetext(t, "\[date\]", "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]") t = replacetext(t, "\[date\]", "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]")
t = replacetext(t, "\[large\]", "<font size=\"4\">") t = replacetext(t, "\[large\]", "<font size=\"4\">")
t = replacetext(t, "\[/large\]", "</font>") t = replacetext(t, "\[/large\]", "</font>")

View File

@@ -90,6 +90,8 @@
var/failure_timer = 0 var/failure_timer = 0
var/force_update = 0 var/force_update = 0
var/emergency_lights = FALSE var/emergency_lights = FALSE
var/nightshift_lights = FALSE
var/last_nightshift_switch = 0
var/update_state = -1 var/update_state = -1
var/update_overlay = -1 var/update_overlay = -1
var/icon_update_needed = FALSE var/icon_update_needed = FALSE
@@ -755,6 +757,7 @@
"siliconUser" = user.has_unlimited_silicon_privilege || user.using_power_flow_console(), "siliconUser" = user.has_unlimited_silicon_privilege || user.using_power_flow_console(),
"malfStatus" = get_malf_status(user), "malfStatus" = get_malf_status(user),
"emergencyLights" = !emergency_lights, "emergencyLights" = !emergency_lights,
"nightshiftLights" = nightshift_lights,
"powerChannels" = list( "powerChannels" = list(
list( list(
@@ -857,6 +860,13 @@
if("breaker") if("breaker")
toggle_breaker() toggle_breaker()
. = TRUE . = TRUE
if("toggle_nightshift")
if(last_nightshift_switch > world.time + 100) //don't spam..
to_chat(usr, "<span class='warning'>[src]'s night lighting circuit breaker is still cycling!</span>")
return
last_nightshift_switch = world.time
set_nightshift(!nightshift_lights)
. = TRUE
if("charge") if("charge")
chargemode = !chargemode chargemode = !chargemode
if(!chargemode) if(!chargemode)
@@ -1304,6 +1314,16 @@
failure_timer = max(failure_timer, round(duration)) failure_timer = max(failure_timer, round(duration))
/obj/machinery/power/apc/proc/set_nightshift(on)
set waitfor = FALSE
nightshift_lights = on
for(var/area/A in area.related)
for(var/obj/machinery/light/L in A)
if(L.nightshift_allowed)
L.nightshift_enabled = nightshift_lights
L.update(FALSE)
CHECK_TICK
#undef UPSTATE_CELL_IN #undef UPSTATE_CELL_IN
#undef UPSTATE_OPENED1 #undef UPSTATE_OPENED1
#undef UPSTATE_OPENED2 #undef UPSTATE_OPENED2

View File

@@ -210,6 +210,13 @@
var/obj/item/stock_parts/cell/cell var/obj/item/stock_parts/cell/cell
var/start_with_cell = TRUE // if true, this fixture generates a very weak cell at roundstart var/start_with_cell = TRUE // if true, this fixture generates a very weak cell at roundstart
var/nightshift_enabled = FALSE //Currently in night shift mode?
var/nightshift_allowed = TRUE //Set to FALSE to never let this light get switched to night mode.
var/nightshift_brightness = 8
var/nightshift_light_power = 0.45
var/nightshift_light_color = "#FFDDCC"
var/emergency_mode = FALSE // if true, the light is in emergency mode var/emergency_mode = FALSE // if true, the light is in emergency mode
var/no_emergency = FALSE // if true, this light cannot ever have an emergency mode var/no_emergency = FALSE // if true, this light cannot ever have an emergency mode
var/bulb_emergency_brightness_mul = 0.25 // multiplier for this light's base brightness in emergency power mode var/bulb_emergency_brightness_mul = 0.25 // multiplier for this light's base brightness in emergency power mode
@@ -301,23 +308,27 @@
return return
// update the icon_state and luminosity of the light depending on its state // update the icon_state and luminosity of the light depending on its state
/obj/machinery/light/proc/update(trigger = 1) /obj/machinery/light/proc/update(trigger = TRUE)
switch(status) switch(status)
if(LIGHT_BROKEN,LIGHT_BURNED,LIGHT_EMPTY) if(LIGHT_BROKEN,LIGHT_BURNED,LIGHT_EMPTY)
on = FALSE on = FALSE
emergency_mode = FALSE emergency_mode = FALSE
if(on) if(on)
if(!light || light.light_range != brightness) var/BR = nightshift_enabled? nightshift_brightness : brightness
var/PO = nightshift_enabled? nightshift_light_power : bulb_power
var/CO = nightshift_enabled? nightshift_light_color : bulb_colour
var/matching = light && BR == light.light_range && PO == light.light_power && CO == light.light_color
if(!matching)
switchcount++ switchcount++
if(rigged) if(rigged)
if(status == LIGHT_OK && trigger) if(status == LIGHT_OK && trigger)
explode() explode()
else if( prob( min(60, switchcount*switchcount*0.01) ) ) else if( prob( min(60, (switchcount^2)*0.01) ) )
if(trigger) if(trigger)
burn_out() burn_out()
else else
use_power = ACTIVE_POWER_USE use_power = ACTIVE_POWER_USE
set_light(brightness, bulb_power, bulb_colour) set_light(BR, PO, CO)
else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off()) else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off())
use_power = IDLE_POWER_USE use_power = IDLE_POWER_USE
emergency_mode = TRUE emergency_mode = TRUE

View File

@@ -1,8 +1,8 @@
GLOBAL_VAR_INIT(security_level, 0) GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
//0 = code green //SEC_LEVEL_GREEN = code green
//1 = code blue //SEC_LEVEL_BLUE = code blue
//2 = code red //SEC_LEVEL_RED = code red
//3 = code delta //SEC_LEVEL_DELTA = code delta
//config.alert_desc_blue_downto //config.alert_desc_blue_downto
@@ -80,6 +80,7 @@ GLOBAL_VAR_INIT(security_level, 0)
D.visible_message("<span class='notice'>[D] whirrs as it automatically lifts access requirements!</span>") D.visible_message("<span class='notice'>[D] whirrs as it automatically lifts access requirements!</span>")
playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE) playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE)
SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level()) SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level())
SSnightshift.check_nightshift()
else else
return return

View File

@@ -486,4 +486,13 @@ MICE_ROUNDSTART 10
#EMERGENCY_SHUTTLE_AUTOCALL_THRESHOLD 0.2 #EMERGENCY_SHUTTLE_AUTOCALL_THRESHOLD 0.2
## Determines if players are allowed to print integrated circuits, uncomment to allow. ## Determines if players are allowed to print integrated circuits, uncomment to allow.
#IC_PRINTING #IC_PRINTING
## Enable night shifts ##
ENABLE_NIGHT_SHIFTS
## Enable randomized shift start times##
RANDOMIZE_SHIFT_TIME
## Sets shift time to server time at roundstart. Overridden by RANDOMIZE_SHIFT_TIME ##
#SHIFT_TIME_REALTIME

View File

@@ -214,6 +214,7 @@
#include "code\controllers\subsystem\medals.dm" #include "code\controllers\subsystem\medals.dm"
#include "code\controllers\subsystem\minimap.dm" #include "code\controllers\subsystem\minimap.dm"
#include "code\controllers\subsystem\mobs.dm" #include "code\controllers\subsystem\mobs.dm"
#include "code\controllers\subsystem\nightshift.dm"
#include "code\controllers\subsystem\npcpool.dm" #include "code\controllers\subsystem\npcpool.dm"
#include "code\controllers\subsystem\orbit.dm" #include "code\controllers\subsystem\orbit.dm"
#include "code\controllers\subsystem\overlays.dm" #include "code\controllers\subsystem\overlays.dm"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -130,6 +130,15 @@
{{/if}} {{/if}}
</ui-section> </ui-section>
</ui-notice> </ui-notice>
<ui-notice>
<ui-section label='Night Shift Lighting'>
{{#if data.locked && !data.siliconUser}}
<span>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</span>
{{else}}
<ui-button icon='lightbulb-o' action='toggle_nightshift'>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</ui-button>
{{/if}}
</ui-section>
</ui-notice>
<ui-notice> <ui-notice>
<ui-section label='Cover Lock'> <ui-section label='Cover Lock'>
{{#if data.locked && !data.siliconUser}} {{#if data.locked && !data.siliconUser}}