Skip to content

Teamplay fixes and improvements

Ghost User requested to merge Lyberta/TeamplayFixes_ into master

I've greatly improved teamplay functions. Let's start with hooks.

Enhanced:

  • Player_ChangeTeam now can prevent player from changing teams.

New:

  • GetTeamCounts and GetTeamCount - 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 than ClientKill.

Finally, some internal changes:

  • I've added SetPlayerTeamSimple that calls Player_ChangeTeam and Player_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 into IsTeamSmallerThanTeam and IsTeamEqualToTeam. And I've changed the algorithm not to count bots so people can join teams that they weren't able before. This is complemented by AutoBalanceBots 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 than FindSmallestTeam.
  • Renamed cbX to numbotsteamX.
  • Added lowestplayerteamX and lowestbotteamX. Useful for better team balance.
  • Substantially rewritten ClientCommand_selectteam.
Edited by Ghost User

Merge request reports

Loading