Skip to content

selectteam, join, spec cmds: notifications, server admin features, fixes

bones_was_here requested to merge bones_was_here/teamplay5 into master

This provides polish necessary for a good experience with !1093 (merged) and several old features that were never really finished.

Improve sv_spectate 0 notifications and description, refactor nospectators command

The blockSpectators global is redundant. See !1289 (merged)

Players are now given the grace period and SPECTATE_WARNING when sv_spectate is disabled during a game, as well as when nospectators is voted.

Centreprints are added and displayed when they don't conflict with join restriction centreprints.

join: display translated notifications for relevant failures

teamplay: display translated notifications for typical failures or state changes

Fixes some uses of NOTIF_ONE where it should have been NOTIF_ONE_ONLY.

join queue: UI improvements and refactoring

Fixes duplicate and redundant chatcon notifications.

Displays relevant centreprint each time the team selection GUI or +jump are used to try to join (even if the player is already queued) for better noob friendliness.

Always notifies the player when their team selection conflicts with that of a queued player.

Notifies queued players to get their attention when they join as it may take some time before another player triggers the join.

Includes the team the player actually got assigned to in the relevant centreprint (for the cases where they had no preference, or someone else chose their preferred team first).

Prevents SetPlayerTeam() and queuePlayer() when the player definitely can't play (version mismatch, locked teams), fixing misleading notifications. Allows players to join the queue even when g_maxplayers blocks them from joining the match, so they can tag in if someone leaves.

Fixes bug with > 2 teams where if a player with a lower entity number queues for any available team, a player with a higher entity number and a specific team preference could be assigned to the same team (by adding a second pass in Join() ).

Fixes lack of "now playing" notification when a bot joins a gametype without teams.

This required some refactoring:

Calls joinAllowed() from ClientCommand_selectteam(), passing the team_index through to queuePlayer(). This means calling queuePlayer from SetPlayerTeam() is no longer needed. Uses a different logic order in joinAllowed() when the queue is enabled.

Moves the ForbidSpawn MUTATOR hook from joinAllowed() to PutPlayerInServer(). It seemed to be in the wrong place anyway: the player is only blocked from spawning, not from joining the match.

No longer sets the .team field when adding a player to the queue (they're not actually on the team yet), instead calls SetPlayerTeam() from Join() when actually spawning the queued player.

Uses the .team_selected field to pass selection conflicts to Join(), it can't be done with a parameter because join and selectteam are separate commands.

Moves the queue conflict detection from Player_SetTeamIndexChecked() to queuePlayer().

Reduces TeamBalance_JoinBestTeam() callsites.

Fixes some uses of NOTIF_ONE where it should have been NOTIF_ONE_ONLY.

join queue: fix 2 bugs that could result in too many players on a team

Join(): when a client queued for red, then a blue player left the team, then a client (re)joined blue, the client queued for red was joined too (stacking red team). Fixed by only joining queued players in Join() when teams are currently balanced (the unbalanced cases are handled by TeamBalance_QueuedPlayersTagIn()).

ClientKill_Now_TeamChange(): when all queued client(s) chose specific team(s) and the last client (which skips the queue and triggers the joins) chose autoselect from the team selection UI, it was possible they were assigned the same team as one of the queued clients. Fixed by deferring the autoselect to Join() when needed/possible.

join queue: fix HUD infomessage, improve consistency and clarity of notifications

The state of having no team preference (deferred autoselect) was implemented in 624a242e but it wasn't correctly declared and networked and displayed in the HUD info panel (it said you're queued to join the Neutral team).

join queue: disable in singleplayer, improve description

Fixes #2905 (closed)

Enable sv_teamnagger in CA, remove HideTeamNagger mutator hook

sv_teamnagger seems to work fine in CA and is already disabled in gametypes without teams.

Increase size of sv_teamnagger message, also use bold

Implements #2702 (closed)

join queue: fix removal of AFK players

Was broken in 433e811e

Improves documentation.

Don't end warmup when teams are unbalanced (WRT sv_teamnagger)

Allows spectators to see the unbalanced teams warning, because they could fix it by joining the smaller team.

Aborts countdown if teams become unbalanced, for the case of someone joining this can be avoided by enabling g_balance_teams_queue.

Updates the chatcon notification for countdown abort when the player count drops below the minimum.

Fix and extend networking of sv_teamnagger

It wasn't enabled reliably because the message could be received before CSQC was ready for it. Adds support for specifying a team size difference, mainly for use with g_balance_teams_queue.

Allow g_balance_teams_prevent_imbalance without g_balance_teams

I disagree with the comment because g_balance_teams is a misnomer: all it does is change whether the team selection UI appears when pressing +jump. Selecting a team manually can improve balance when players know each other's skills, and the fact that's in use doesn't automatically mean that people should be allowed to stack mid-match.

Added a condition to only enforce during the match or countdown, because it's easier to reorganise teams during warmup when players can directly switch to their team, instead of one of them needing to spec before the other can swap.

Edited by bones_was_here

Merge request reports

Loading