Make the lobby timer work on real world time instead of the internal ticker.

This commit is contained in:
Chris
2014-12-17 11:31:08 -06:00
parent 941ba1c5b4
commit ba9fa61ee4
3 changed files with 25 additions and 13 deletions

View File

@@ -39,7 +39,10 @@ var/global/datum/controller/gameticker/ticker
// Hack
var/obj/machinery/media/jukebox/superjuke/thematic/theme = null
#define LOBBY_TICKING 1
#define LOBBY_TICKING_RESTARTED 2
/datum/controller/gameticker/proc/pregame()
var/remaining_time = 0
login_music = pick(\
'sound/music/space.ogg',\
'sound/music/traitor.ogg',\
@@ -54,9 +57,9 @@ var/global/datum/controller/gameticker/ticker
'sound/music/moonbaseoddity.ogg',\
'sound/music/whatisthissong.ogg')
do
pregame_timeleft = 300
pregame_timeleft = world.timeofday + 3000 //actually 5 minutes or incase this is changed from 3000, (time_in_seconds * 10)
world << "<B><FONT color='blue'>Welcome to the pre-game lobby!</FONT></B>"
world << "Please, setup your character and select ready. Game will start in [pregame_timeleft] seconds"
world << "Please, setup your character and select ready. Game will start in [(pregame_timeleft - world.timeofday) / 10] seconds"
while(current_state == GAME_STATE_PREGAME)
for(var/i=0, i<10, i++)
sleep(1)
@@ -66,13 +69,18 @@ var/global/datum/controller/gameticker/ticker
world << "<span class='notice'>Server update detected, restarting momentarily.</span>"
watchdog.signal_ready()
return
if(going)
pregame_timeleft--
if(!going && !remaining_time)
remaining_time = pregame_timeleft - world.timeofday
if(going == LOBBY_TICKING_RESTARTED)
pregame_timeleft = world.timeofday + remaining_time
going = LOBBY_TICKING
remaining_time = 0
if(pregame_timeleft <= 0)
if(going && world.timeofday >= pregame_timeleft)
current_state = GAME_STATE_SETTING_UP
while (!setup())
#undef LOBBY_TICKING
#undef LOBBY_TICKING_RESTARTED
/datum/controller/gameticker/proc/StartThematic(var/playlist)
if(!theme)
theme = new(locate(1,1,CENTCOMM_Z))

View File

@@ -930,7 +930,8 @@ var/global/floorIsLava = 0
log_admin("[key_name(usr)] toggled Space Ninjas to [toggle_space_ninja].")
message_admins("[key_name_admin(usr)] toggled Space Ninjas [toggle_space_ninja ? "on" : "off"].", 1)
feedback_add_details("admin_verb","TSN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
#define LOBBY_TICKING_STOPPED 0
#define LOBBY_TICKING_RESTARTED 2
/datum/admins/proc/delay()
set category = "Server"
set desc="Delay the game start/end"
@@ -942,15 +943,18 @@ var/global/floorIsLava = 0
log_admin("[key_name(usr)] [ticker.delay_end ? "delayed the round end" : "has made the round end normally"].")
message_admins("\blue [key_name(usr)] [ticker.delay_end ? "delayed the round end" : "has made the round end normally"].", 1)
return //alert("Round end delayed", null, null, null, null, null)
going = !( going )
if (!( going ))
world << "<b>The game start has been delayed.</b>"
log_admin("[key_name(usr)] delayed the game.")
else
going = LOBBY_TICKING_RESTARTED
ticker.pregame_timeleft = world.timeofday + ticker.remaining_time
world << "<b>The game will start soon.</b>"
log_admin("[key_name(usr)] removed the delay.")
else
going = LOBBY_TICKING_STOPPED
world << "<b>The game start has been delayed.</b>"
log_admin("[key_name(usr)] delayed the game.")
feedback_add_details("admin_verb","DELAY") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
#undef LOBBY_TICKING_STOPPED
#undef LOBBY_TICKING_RESTARTED
/datum/admins/proc/adjump()
set category = "Server"
set desc="Toggle admin jumping"

View File

@@ -81,7 +81,7 @@
stat("Game Mode:", "[master_mode]")
if((ticker.current_state == GAME_STATE_PREGAME) && going)
stat("Time To Start:", ticker.pregame_timeleft)
stat("Time To Start:", (ticker.pregame_timeleft - world.timeofday) / 10)
if((ticker.current_state == GAME_STATE_PREGAME) && !going)
stat("Time To Start:", "DELAYED")