Teamplay fixes and improvements
I've greatly improved teamplay functions. Let's start with hooks.
Enhanced:
-
Player_ChangeTeam
now can prevent player from changing teams.
New:
-
GetTeamCounts
andGetTeamCount
- can be used to override team counts. -
FindBestTeams
- returns the bitmask of the best teams for a player. Can be used to implement custom team balance. -
Player_ChangedTeam
- called after player has changed their team. Useful to keep track of player teams. -
Player_ChangeTeamKill
- can be used to allow player to change their team without killing themselves. -
ClientKill_Now
- can be used stop player from killing themselves right before that moment. This is more useful thanClientKill
.
Finally, some internal changes:
- I've added
SetPlayerTeamSimple
that callsPlayer_ChangeTeam
andPlayer_ChangedTeam
and modified other teamplay parts to use this function. The goal is to always keep track of player team which is critical to my mod. - I've split
TeamSmallerEqThanTeam
intoIsTeamSmallerThanTeam
andIsTeamEqualToTeam
. And I've changed the algorithm not to count bots so people can join teams that they weren't able before. This is complemented byAutoBalanceBots
which will swap player with bot and will keep teams balanced. - I've added
FindBestTeams
which returns bitmask of the best team for the player. Can be more useful thanFindSmallestTeam
. - Renamed
cbX
tonumbotsteamX
. - Added
lowestplayerteamX
andlowestbotteamX
. Useful for better team balance. - Substantially rewritten
ClientCommand_selectteam
.
Edited by Ghost User