From 65557991197a2b825c564d503cfa21d3109be045 Mon Sep 17 00:00:00 2001 From: Leshana Date: Sun, 5 Apr 2020 15:45:41 -0400 Subject: [PATCH] Revamp Start Now admin verb to actually wait until init is done before starting. --- code/controllers/subsystems/ticker.dm | 7 +++++- code/modules/admin/admin.dm | 32 ++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 49f52444400..a51a409b303 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -18,6 +18,7 @@ SUBSYSTEM_DEF(ticker) // var/round_progressing = 1 //Whether the lobby clock is ticking down. var/pregame_timeleft = 0 // Time remaining until game starts in seconds. Set by config + var/start_immediately = FALSE // If true there is no lobby phase, the game starts immediately. var/hide_mode = FALSE // If the true game mode should be hidden (because we chose "secret") var/datum/game_mode/mode = null // The actual gamemode, if selected. @@ -79,13 +80,17 @@ var/global/datum/controller/subsystem/ticker/ticker if(round_progressing && last_fire) pregame_timeleft -= (world.time - last_fire) / (1 SECOND) - if(SSvote.time_remaining) + if(start_immediately) + pregame_timeleft = 0 + else if(SSvote.time_remaining) return // vote still going, wait for it. // Time to start the game! if(pregame_timeleft <= 0) current_state = GAME_STATE_SETTING_UP Master.SetRunLevel(RUNLEVEL_SETUP) + if(start_immediately) + fire() // Don't wait for next tick, do it now! return if(pregame_timeleft <= config.vote_autogamemode_timeleft && !SSvote.gamemode_vote_called) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index cbd3345b774..6fc26c7d48a 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -871,24 +871,26 @@ var/datum/announcement/minor/admin_min_announcer = new /datum/admins/proc/startnow() set category = "Server" - set desc="Start the round RIGHT NOW" + set desc="Start the round ASAP" set name="Start Now" - if(!ticker || !Master || Master.current_runlevel < RUNLEVEL_LOBBY) - alert("Unable to start the game as it is not set up.") - return - if(Master.current_runlevel == RUNLEVEL_LOBBY) - SSticker.current_state = GAME_STATE_SETTING_UP - Master.SetRunLevel(RUNLEVEL_SETUP) - if(SSvote.mode == VOTE_GAMEMODE) - SSvote.reset() // Cancel the vote if there is one. - log_admin("[usr.key] has started the game.") - message_admins("[usr.key] has started the game.") - feedback_add_details("admin_verb","SN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - return 1 - else + if(!check_rights(R_SERVER|R_EVENT)) + return + if(SSticker.current_state > GAME_STATE_PREGAME) to_chat(usr, "Error: Start Now: Game has already started.") - return 0 + return + if(!SSticker.start_immediately) + SSticker.start_immediately = TRUE + var/msg = "" + if(SSticker.current_state == GAME_STATE_INIT) + msg = " (The server is still setting up, but the round will be started as soon as possible.)" + log_admin("[key_name(usr)] has started the game.[msg]") + message_admins("[key_name_admin(usr)] has started the game.[msg]") + feedback_add_details("admin_verb","SN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + else + SSticker.start_immediately = FALSE + to_chat(world, "Immediate game start canceled. Normal startup resumed.") + log_and_message_admins("cancelled immediate game start.") /datum/admins/proc/toggleenter() set category = "Server"