Better round start time handling after using delay (#25035)

This commit is contained in:
Mikhail Dzianishchyts
2024-04-22 20:53:14 +00:00
committed by GitHub
parent 2d1d7e283b
commit 00be61a811
4 changed files with 8 additions and 10 deletions
+4 -7
View File
@@ -81,9 +81,9 @@ SUBSYSTEM_DEF(ticker)
switch(current_state)
if(GAME_STATE_STARTUP)
// This is ran as soon as the MC starts firing, and should only run ONCE, unless startup fails
round_start_time = world.time + (GLOB.configuration.general.lobby_time SECONDS)
pregame_timeleft = GLOB.configuration.general.lobby_time SECONDS
to_chat(world, "<b><span class='darkmblue'>Welcome to the pre-game lobby!</span></b>")
round_start_time = world.time + pregame_timeleft
to_chat(world, "<B><span class='darkmblue'>Welcome to the pre-game lobby!</span></B>")
to_chat(world, "Please, setup your character and select ready. Game will start in [GLOB.configuration.general.lobby_time] seconds")
current_state = GAME_STATE_PREGAME
fire() // TG says this is a good idea
@@ -95,12 +95,9 @@ SUBSYSTEM_DEF(ticker)
return
// This is so we dont have sleeps in controllers, because that is a bad, bad thing
if(!delay_end)
pregame_timeleft = max(0, round_start_time - world.time) // Normal lobby countdown when roundstart was not delayed
else
pregame_timeleft = max(0, pregame_timeleft - wait) // If roundstart was delayed, we should resume the countdown where it left off
pregame_timeleft = max(0, round_start_time - world.time)
if(pregame_timeleft <= 600 && !tipped) // 60 seconds
if(pregame_timeleft <= 1 MINUTES && !tipped)
send_tip_of_the_round()
tipped = TRUE