bones_was_here [Fri, 14 Jun 2024 08:36:49 +0000 (18:36 +1000)]
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.
bones_was_here [Fri, 14 Jun 2024 07:54:46 +0000 (17:54 +1000)]
join queue: fix HUD infomessage, improve consistency and clarity of notifications
The state of having no team preference (deferred autoselect) was
implemented in 624a242e556387367d088dc2cde847989c0fd321 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).
bones_was_here [Thu, 6 Jun 2024 10:43:13 +0000 (20:43 +1000)]
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.
bones_was_here [Tue, 4 Jun 2024 12:15:37 +0000 (22:15 +1000)]
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.
Get rid of 2 warnings, one in the client and the other in the dedicated server, printed at startup
* _def_detect_dedicated and the usage of ${qport ?} instead of ${qport} are meant to avoid this warning in the dedicated server: Could not expand $qport in alias _if_dedicated
* The new _detect_dedicated_ aliases are meant to avoid this warning in the client: Unknown command "_detect_dedicated_60106"
The file is an unmaintained ancient relic which is no longer usable
in the project. dpdefs require manual syncing at the time of a release
and we do not use the sources mentioned in the file for them but
copy them from the DP engine we ship.
* Optimize swapwords and consequently shufflewords (which is called by g_maplist_shuffle) a little bit
* Avoid setting filename when not needed in Map_Check (called many times when the map vote starts)
* Save a few normalize calls in findtrajectorywithleading (called when bots use weapons like mortar and electro that fire projectiles with gravity)
findtrajectorywithleading patch probably causes a hash change due to extremely small aim direction changes (always < 0.0005) that at some point change the course of the bot match
The waypoint usage here was missing a check that it has been
initialised properly. Without waypoint updating code assumed
that the flag has >0 max_health which caused many div by zero errors.
Added the following if check:
autocvar_g_ctf_flag_return_time ||
(autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health)