mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Revamp Start Now admin verb to actually wait until init is done before starting.
This commit is contained in:
@@ -18,6 +18,7 @@ SUBSYSTEM_DEF(ticker)
|
|||||||
// var/round_progressing = 1 //Whether the lobby clock is ticking down.
|
// 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/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/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.
|
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)
|
if(round_progressing && last_fire)
|
||||||
pregame_timeleft -= (world.time - last_fire) / (1 SECOND)
|
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.
|
return // vote still going, wait for it.
|
||||||
|
|
||||||
// Time to start the game!
|
// Time to start the game!
|
||||||
if(pregame_timeleft <= 0)
|
if(pregame_timeleft <= 0)
|
||||||
current_state = GAME_STATE_SETTING_UP
|
current_state = GAME_STATE_SETTING_UP
|
||||||
Master.SetRunLevel(RUNLEVEL_SETUP)
|
Master.SetRunLevel(RUNLEVEL_SETUP)
|
||||||
|
if(start_immediately)
|
||||||
|
fire() // Don't wait for next tick, do it now!
|
||||||
return
|
return
|
||||||
|
|
||||||
if(pregame_timeleft <= config.vote_autogamemode_timeleft && !SSvote.gamemode_vote_called)
|
if(pregame_timeleft <= config.vote_autogamemode_timeleft && !SSvote.gamemode_vote_called)
|
||||||
|
|||||||
@@ -871,24 +871,26 @@ var/datum/announcement/minor/admin_min_announcer = new
|
|||||||
|
|
||||||
/datum/admins/proc/startnow()
|
/datum/admins/proc/startnow()
|
||||||
set category = "Server"
|
set category = "Server"
|
||||||
set desc="Start the round RIGHT NOW"
|
set desc="Start the round ASAP"
|
||||||
set name="Start Now"
|
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)
|
if(!check_rights(R_SERVER|R_EVENT))
|
||||||
SSticker.current_state = GAME_STATE_SETTING_UP
|
return
|
||||||
Master.SetRunLevel(RUNLEVEL_SETUP)
|
if(SSticker.current_state > GAME_STATE_PREGAME)
|
||||||
if(SSvote.mode == VOTE_GAMEMODE)
|
|
||||||
SSvote.reset() // Cancel the vote if there is one.
|
|
||||||
log_admin("[usr.key] has started the game.")
|
|
||||||
message_admins("<font color='blue'>[usr.key] has started the game.</font>")
|
|
||||||
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
|
|
||||||
to_chat(usr, "<font color='red'>Error: Start Now: Game has already started.</font>")
|
to_chat(usr, "<font color='red'>Error: Start Now: Game has already started.</font>")
|
||||||
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("<font color='blue'>[key_name_admin(usr)] has started the game.[msg]</font>")
|
||||||
|
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, "<b>Immediate game start canceled. Normal startup resumed.</b>")
|
||||||
|
log_and_message_admins("cancelled immediate game start.")
|
||||||
|
|
||||||
/datum/admins/proc/toggleenter()
|
/datum/admins/proc/toggleenter()
|
||||||
set category = "Server"
|
set category = "Server"
|
||||||
|
|||||||
Reference in New Issue
Block a user