if(!mutator_returnvalue)
{
- s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
+ if(entcs_GetWantsJoin(current_player))
+ {
+ int tm = Team_IndexToTeam(entcs_GetWantsJoin(current_player));
+ s = sprintf(_("^2You're queued to join the %s%s^2 team"), Team_ColorCode(tm), Team_ColorName(tm));
+ }
+ else
+ s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
InfoMessage(s);
}
}
if(pl == ignored_pl)
continue;
+ if(entcs_GetWantsJoin(pl.sv_entnum))
+ {
+ vector tmcolor = Team_ColorRGB(Team_IndexToTeam(entcs_GetWantsJoin(pl.sv_entnum)));
+ tmcolor -= tmcolor * sin(2*M_PI*time);
+
+ drawstring(pos, "(Q)", hud_fontsize, tmcolor, sbt_fg_alpha, DRAWFLAG_NORMAL);
+ pos.x += stringwidth("(Q) ", true, hud_fontsize);
+ }
+
field = "";
if(this_team == NUM_SPECTATOR)
{
{ WriteShort(chan, ent.frags); },
{ ent.frags = ReadShort(); })
+ENTCS_PROP(WANTSJOIN, true, wants_join, wants_join, ENTCS_SET_NORMAL,
+ { WriteByte(chan, ent.wants_join); },
+ { ent.wants_join = ReadByte(); })
+
// use sv_solid to avoid changing solidity state of entcs entities
ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
{ WriteByte(chan, ent.sv_solid); },
* @param i zero indexed player
*/
.int frags;
+ .int wants_join;
const int ENTCS_SPEC_PURE = 1; // real spectator
const int ENTCS_SPEC_IN_SCOREBOARD = 2; // spectator but still in game (can be in a team)
#define entcs_IsSpectating(i) boolean(entcs_GetSpecState(i))
/**
* @param i zero indexed player
+ */
+ int entcs_GetWantsJoin(int i)
+ {
+ entity e = entcs_receiver(i);
+ return e.wants_join;
+ }
+
+ /**
+ * @param i zero indexed player
*/
int entcs_GetClientColors(int i)
{
if (CS(this).just_joined)
CS(this).just_joined = false;
- if (CS(this).wants_join)
- CS(this).wants_join = false;
+ if (this.wants_join)
+ this.wants_join = 0;
}
int player_getspecies(entity this)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? GameLog_ProcessIP(this.netaddress) : "bot"), ":", playername(this.netname, this.team, false)));
CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects
- CS(this).wants_join = false;
+ this.wants_join = false;
stuffcmd(this, clientstuff, "\n");
stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
if(IS_PLAYER(this))
if(teamplay && this.team != -1)
{
- if(CS(this).wants_join)
+ if(this.wants_join)
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_PLAY_TEAM), this.netname);
}
else
this.team_selected = false;
if(queued_join)
- CS(queued_join).wants_join = false;
+ this.wants_join = 0;
}
int GetPlayerLimit()
if (teamplay && lockteams) return false;
if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false;
if (ShowTeamSelection(this)) return false;
- if (CS(this).wants_join) return false;
+ if (this.wants_join) return false;
if (IsQueueNeeded(this) && autocvar_g_balance_teams)
{
TeamBalance_JoinBestTeam(this);
if (blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- if (CS(this).wants_join)
+ if (this.wants_join)
SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR);
else
PutObserverInServer(this, false, true);
if (mutator_returnvalue == MUT_SPECCMD_RETURN) return;
- if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE || CS(caller).wants_join))
+ if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE || caller.wants_join))
if (autocvar_sv_spectate == 1)
ClientKill_TeamChange(caller, -2); // observe
}
{
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
if(it == this) continue;
- if(CS(it).wants_join) {
+ if(it.wants_join) {
LOG_DEBUGF("Player is waiting to join: %s", it.netname);
return it;
}
{
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_WANTS_TEAM), player.netname);
Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_JOIN_PREVENT_QUEUE);
- CS(player).wants_join = true; // TODO : Refactor
+ player.wants_join = team_index; // Player queued to join
}
else
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_PLAY_TEAM), player.netname);
Kill_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CPID_IDLING);
CS(player).idlekick_lasttimeleft = 0;
}
- else if (CS(player).wants_join)
+ else if (player.wants_join)
{
- CS(player).wants_join = false;
+ player.wants_join = 0;
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, player.netname);
}
else if (!CS(player).just_joined && player.frags != FRAGS_SPECTATOR)