Files
CHOMPStation2/code/controllers/Processes/ticker.dm
Leshana 82e6049821 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.
2017-06-10 19:01:58 -04:00

43 lines
1.2 KiB
Plaintext

var/global/datum/controller/process/ticker/tickerProcess
/datum/controller/process/ticker
var/lastTickerTimeDuration
var/lastTickerTime
/datum/controller/process/ticker/setup()
name = "ticker"
schedule_interval = 20 // every 2 seconds
lastTickerTime = world.timeofday
if(!ticker)
ticker = new
tickerProcess = src
spawn(0)
if(ticker)
ticker.pregame()
/datum/controller/process/ticker/doWork()
var/currentTime = world.timeofday
if(currentTime < lastTickerTime) // check for midnight rollover
lastTickerTimeDuration = (currentTime - (lastTickerTime - TICKS_IN_DAY)) / TICKS_IN_SECOND
else
lastTickerTimeDuration = (currentTime - lastTickerTime) / TICKS_IN_SECOND
lastTickerTime = currentTime
ticker.process()
/datum/controller/process/ticker/proc/getLastTickerTimeDuration()
return lastTickerTimeDuration
// 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)
/datum/controller/process/ticker/proc/IsRoundInProgress()
return (ticker && ticker.current_state == GAME_STATE_PLAYING)