[PORT] Refactor the gameticker controller into SSticker (#6994)

* Move gameticker to subsystem folder before editing to track history thru rename.

* Refactor the gameticker into SSticker

  - Instead of independently spawn'd while/sleep loops, it stores its state and lets the MC fire it.
  - Convert relative path indentation procs to absolute path as per modern style standards.
  - Break apart the inner loops into separate procs so you can see what is actually going on.
  - It now shows up in MC tab, along with stats about what phase it is in.

* Revamp Start Now admin verb to actually wait until init is done before starting.

* Update Lobby stat panel to show voting and server init status.

* Fix: Only call autogamemode vote once.

* Spawn statistic_cycle off to not sleep SSticker.

* Add SStickere changelog

* Change to use to_world and add wrapping spans.

* Added filtering spans by specific request of Polaris.
This commit is contained in:
Leshana
2020-04-25 12:26:54 -07:00
committed by GitHub
parent 9f33b8f597
commit ec86a98e16
14 changed files with 621 additions and 535 deletions
+20 -15
View File
@@ -868,21 +868,26 @@ proc/admin_notice(var/message, var/rights)
/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)
alert("Unable to start the game as it is not set up.")
if(!check_rights(R_SERVER|R_EVENT))
return
if(ticker.current_state == GAME_STATE_PREGAME)
ticker.current_state = GAME_STATE_SETTING_UP
Master.SetRunLevel(RUNLEVEL_SETUP)
log_admin("[usr.key] has started the game.")
message_admins("<font color='blue'>[usr.key] has started the game.</font>")
if(SSticker.current_state > GAME_STATE_PREGAME)
to_chat(usr, "<span class='warning'>Error: Start Now: Game has already started.</span>")
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("<span class='notice'>[key_name_admin(usr)] has started the game.[msg]</span>")
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>")
return 0
SSticker.start_immediately = FALSE
to_world("<span class='notice'>Immediate game start canceled. Normal startup resumed.</span>")
log_and_message_admins("cancelled immediate game start.")
/datum/admins/proc/toggleenter()
set category = "Server"
@@ -949,10 +954,10 @@ proc/admin_notice(var/message, var/rights)
set name="Delay"
if(!check_rights(R_SERVER|R_EVENT)) return
if (!ticker || ticker.current_state != GAME_STATE_PREGAME)
ticker.delay_end = !ticker.delay_end
log_admin("[key_name(usr)] [ticker.delay_end ? "delayed the round end" : "has made the round end normally"].")
message_admins("<font color='blue'>[key_name(usr)] [ticker.delay_end ? "delayed the round end" : "has made the round end normally"].</font>", 1)
if (SSticker.current_state >= GAME_STATE_PLAYING)
SSticker.delay_end = !SSticker.delay_end
log_admin("[key_name(usr)] [SSticker.delay_end ? "delayed the round end" : "has made the round end normally"].")
message_admins("<font color='blue'>[key_name(usr)] [SSticker.delay_end ? "delayed the round end" : "has made the round end normally"].</font>", 1)
return //alert("Round end delayed", null, null, null, null, null)
round_progressing = !round_progressing
if (!round_progressing)