From: terencehill Date: Tue, 18 Dec 2012 00:28:35 +0000 (+0100) Subject: Freezetag: display message Waiting for players to join... when round can't start X-Git-Tag: xonotic-v0.7.0~61^2~82 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=914329d902dff0746c381abd0599828430de9457;p=xonotic%2Fxonotic-data.pk3dir.git Freezetag: display message Waiting for players to join... when round can't start --- diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 75f5a0bde..83063cf69 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -469,6 +469,7 @@ float CPID_TIMEOUT_COUNTDOWN = 8; float CPID_MOTD = 9; float CPID_KH_MSG = 10; float CPID_PREVENT_JOIN = 11; +float CPID_WAITING_PLAYERS = 12; // CSQC centerprint/notify message types float MSG_SUICIDE = 0; diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index d16e7ad68..1629c6884 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -1,11 +1,11 @@ -float freezetag_TeamsCanPlay(); +float freezetag_CheckTeams(); float freezetag_CheckWinner(); void freezetag_Initialize() { precache_model("models/ice/ice.md3"); ScoreRules_freezetag(); - round_handler_Spawn(freezetag_TeamsCanPlay, freezetag_CheckWinner, 5, autocvar_g_freezetag_warmup); + round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, 5, autocvar_g_freezetag_warmup); addstat(STAT_REDALIVE, AS_INT, redalive_stat); addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat); @@ -62,6 +62,33 @@ float freezetag_TeamsCanPlay() return 0; } +float prev_total_players; +float freezetag_CheckTeams() +{ + entity e; + if(freezetag_TeamsCanPlay()) + { + if(prev_total_players != -1) + { + FOR_EACH_REALCLIENT(e) + Send_CSQC_Centerprint_Generic_Expire(e, CPID_WAITING_PLAYERS); + } + prev_total_players = -1; + return 1; + } + if(prev_total_players != total_players) + { + string teams_missing; + if(!redalive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM1), ", "); + if(!bluealive) teams_missing = strcat(teams_missing, ColoredTeamName(COLOR_TEAM2), ", "); + teams_missing = substring(teams_missing, 0, strlen(teams_missing)-2); + + FOR_EACH_REALCLIENT(e) + Send_CSQC_Centerprint_Generic(e, CPID_WAITING_PLAYERS, strcat("Waiting for players to join...\n\nNeed active players for: ", teams_missing), -1, 0); + prev_total_players = total_players; + } + return 0; +} float freezetag_CheckWinner() { if(freezetag_TeamsCanPlay())