Actually hooks up the StonedMC to run its subsystems in Polaris

* Hooks up informing Master the gameticker actually starts and stops the round subsystems will actually fire! What ho!
* We should convert the gameticker as an MC subsystem someday, and probably completely rewrite it while we are at it becuase it is crazy.  But this should bridge the gap until then.
This commit is contained in:
Leshana
2017-06-07 17:51:47 -04:00
parent fb92653ac9
commit 82e6049821
5 changed files with 15 additions and 1 deletions

View File

@@ -34,5 +34,9 @@ var/global/datum/controller/process/ticker/tickerProcess
/datum/controller/process/ticker/proc/getLastTickerTimeDuration() /datum/controller/process/ticker/proc/getLastTickerTimeDuration()
return lastTickerTimeDuration return lastTickerTimeDuration
/world/proc/has_round_started() // Use these preferentially to directly examining ticker.current_state to help prepare for transition to ticker as subsystem!
/datum/controller/process/ticker/proc/HasRoundStarted()
return (ticker && ticker.current_state >= GAME_STATE_PLAYING) return (ticker && ticker.current_state >= GAME_STATE_PLAYING)
/datum/controller/process/ticker/proc/IsRoundInProgress()
return (ticker && ticker.current_state == GAME_STATE_PLAYING)

View File

@@ -62,6 +62,7 @@ var/global/datum/controller/gameticker/ticker
vote.process() vote.process()
if(pregame_timeleft <= 0) if(pregame_timeleft <= 0)
current_state = GAME_STATE_SETTING_UP current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
while (!setup()) while (!setup())
@@ -74,6 +75,7 @@ var/global/datum/controller/gameticker/ticker
if((master_mode=="random") || (master_mode=="secret")) if((master_mode=="random") || (master_mode=="secret"))
if(!runnable_modes.len) if(!runnable_modes.len)
current_state = GAME_STATE_PREGAME current_state = GAME_STATE_PREGAME
Master.SetRunLevel(RUNLEVEL_LOBBY)
world << "<B>Unable to choose playable game mode.</B> Reverting to pre-game lobby." world << "<B>Unable to choose playable game mode.</B> Reverting to pre-game lobby."
return 0 return 0
if(secret_force_mode != "secret") if(secret_force_mode != "secret")
@@ -88,6 +90,7 @@ var/global/datum/controller/gameticker/ticker
if(!src.mode) if(!src.mode)
current_state = GAME_STATE_PREGAME current_state = GAME_STATE_PREGAME
Master.SetRunLevel(RUNLEVEL_LOBBY)
world << "<span class='danger'>Serious error in mode setup!</span> Reverting to pre-game lobby." world << "<span class='danger'>Serious error in mode setup!</span> Reverting to pre-game lobby."
return 0 return 0
@@ -99,6 +102,7 @@ var/global/datum/controller/gameticker/ticker
if(!src.mode.can_start()) if(!src.mode.can_start())
world << "<B>Unable to start [mode.name].</B> Not enough players, [mode.required_players] players needed. Reverting to pre-game lobby." world << "<B>Unable to start [mode.name].</B> Not enough players, [mode.required_players] players needed. Reverting to pre-game lobby."
current_state = GAME_STATE_PREGAME current_state = GAME_STATE_PREGAME
Master.SetRunLevel(RUNLEVEL_LOBBY)
mode.fail_setup() mode.fail_setup()
mode = null mode = null
job_master.ResetOccupations() job_master.ResetOccupations()
@@ -127,6 +131,7 @@ var/global/datum/controller/gameticker/ticker
shuttle_controller.setup_shuttle_docks() shuttle_controller.setup_shuttle_docks()
// TODO - Leshana - Dear God Fix This. Fix all of this. Not just this line, this entire proc. This entire file!
spawn(0)//Forking here so we dont have to wait for this to finish spawn(0)//Forking here so we dont have to wait for this to finish
mode.post_setup() mode.post_setup()
//Cleanup some stuff //Cleanup some stuff
@@ -155,6 +160,7 @@ var/global/datum/controller/gameticker/ticker
*/ */
processScheduler.start() processScheduler.start()
Master.SetRunLevel(RUNLEVEL_GAME)
if(config.sql_enabled) if(config.sql_enabled)
statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE
@@ -319,6 +325,7 @@ var/global/datum/controller/gameticker/ticker
if(!mode.explosion_in_progress && game_finished && (mode_finished || post_game)) if(!mode.explosion_in_progress && game_finished && (mode_finished || post_game))
current_state = GAME_STATE_FINISHED current_state = GAME_STATE_FINISHED
Master.SetRunLevel(RUNLEVEL_POSTGAME)
spawn spawn
declare_completion() declare_completion()

View File

@@ -783,6 +783,7 @@ proc/admin_notice(var/message, var/rights)
return return
if(ticker.current_state == GAME_STATE_PREGAME) if(ticker.current_state == GAME_STATE_PREGAME)
ticker.current_state = GAME_STATE_SETTING_UP ticker.current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
log_admin("[usr.key] has started the game.") log_admin("[usr.key] has started the game.")
message_admins("<font color='blue'>[usr.key] has started the game.</font>") 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! feedback_add_details("admin_verb","SN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -45,6 +45,7 @@ var/total_unit_tests = 0
sleep(1) sleep(1)
ticker.current_state = GAME_STATE_SETTING_UP ticker.current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
log_unit_test("Round has been started. Waiting 10 seconds to start tests.") log_unit_test("Round has been started. Waiting 10 seconds to start tests.")
sleep(100) sleep(100)

View File

@@ -433,6 +433,7 @@ var/world_topic_spam_protect_time = world.timeofday
*/ */
processScheduler.stop() processScheduler.stop()
Master.Shutdown() //run SS shutdowns
for(var/client/C in clients) for(var/client/C in clients)
if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite