/**/
MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
+/** allows overriding best team */
+#define EV_JoinBestTeam(i, o) \
+ /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** team number */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /**/
+MUTATOR_HOOKABLE(JoinBestTeam, EV_JoinBestTeam);
+
/** copies variables for spectating "spectatee" to "this" */
#define EV_SpectateCopy(i, o) \
/** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam)
{
- float smallest, selectedteam;
+ float bestteam, selectedteam;
// don't join a team if we're not playing a team game
if(!teamplay)
// otherwise end up on the smallest team (handled below)
}
- smallest = FindSmallestTeam(this, true);
+ bestteam = FindSmallestTeam(this, true);
+ MUTATOR_CALLHOOK(JoinBestTeam, this, bestteam);
+ bestteam = M_ARGV(1, float);
if(!only_return_best && !this.bot_forced_team)
{
- smallest = Team_NumberToTeam(smallest);
- if (smallest != -1)
+ bestteam = Team_NumberToTeam(bestteam);
+ if (bestteam != -1)
{
TeamchangeFrags(this);
- SetPlayerTeamSimple(this, smallest);
+ SetPlayerTeamSimple(this, bestteam);
}
else
{
Damage(this, this, this, 100000, DEATH_TEAMCHANGE.m_id, this.origin, '0 0 0');
}
- return smallest;
+ return bestteam;
}
//void() ctf_playerchanged;