diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index 336d72fc13..9f83595e49 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -30,11 +30,20 @@ proc/isDay(var/month, var/day) var/next_duration_update = 0 var/last_round_duration = 0 -proc/round_duration() +var/round_start_time = 0 + +/hook/roundstart/proc/start_timer() + round_start_time = world.time + +#define round_duration_in_ticks (round_start_time ? world.time - round_start_time : 0) + +/proc/round_duration_as_text() + if(!round_start_time) + return "00:00" if(last_round_duration && world.time < next_duration_update) return last_round_duration - var/mills = world.time // 1/10 of a second, not real milliseconds but whatever + var/mills = round_duration_in_ticks // 1/10 of a second, not real milliseconds but whatever //var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence.. or something var/mins = round((mills % 36000) / 600) var/hours = round(mills / 36000) diff --git a/code/controllers/autotransfer.dm b/code/controllers/autotransfer.dm index 597b7f607c..afd1435ffa 100644 --- a/code/controllers/autotransfer.dm +++ b/code/controllers/autotransfer.dm @@ -12,6 +12,6 @@ datum/controller/transfer_controller/Destroy() datum/controller/transfer_controller/proc/process() currenttick = currenttick + 1 - if (world.time >= timerbuffer - 600) + if (round_duration_in_ticks >= timerbuffer - 1 MINUTE) vote.autotransfer() - timerbuffer = timerbuffer + config.vote_autotransfer_interval \ No newline at end of file + timerbuffer = timerbuffer + config.vote_autotransfer_interval diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 83a2f3b370..622be84c3d 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -392,7 +392,7 @@ if (ticker && ticker.current_state >= GAME_STATE_PLAYING) var/dat = "Round Status

Round Status

" dat += "Current Game Mode: [ticker.mode.name]
" - dat += "Round Duration: [round(world.time / 36000)]:[add_zero(world.time / 600 % 60, 2)]:[world.time / 100 % 6][world.time / 100 % 10]
" + dat += "Round Duration: [round_duration_as_text()]
" dat += "Emergency shuttle
" if (!emergency_shuttle.online()) dat += "Call Shuttle
" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index c185f880cc..f45fd574ce 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -645,7 +645,7 @@ if(.) if(statpanel("Status") && ticker && ticker.current_state != GAME_STATE_PREGAME) stat("Station Time", worldtime2text()) - stat("Round Duration", round_duration()) + stat("Round Duration", round_duration_as_text()) if(client.holder) if(statpanel("Status")) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ed04bdfd60..43f7d80815 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -364,7 +364,7 @@ var/dat = "
" dat += "Welcome, [name].
" - dat += "Round Duration: [round_duration()]
" + dat += "Round Duration: [round_duration_as_text()]
" if(emergency_shuttle) //In case Nanotrasen decides reposess CentComm's shuttles. if(emergency_shuttle.going_to_centcom()) //Shuttle is going to centcomm, not recalled diff --git a/code/world.dm b/code/world.dm index 4f89288c62..9dc5fe536e 100644 --- a/code/world.dm +++ b/code/world.dm @@ -155,7 +155,7 @@ var/world_topic_spam_protect_time = world.timeofday // This is dumb, but spacestation13.com's banners break if player count isn't the 8th field of the reply, so... this has to go here. s["players"] = 0 s["stationtime"] = worldtime2text() - s["roundduration"] = round_duration() + s["roundduration"] = round_duration_as_text() if(input["status"] == "2") var/list/players = list()