fraglimit_override = cvar("fraglimit_override");
leadlimit_override = cvar("leadlimit_override");
- // g_dodging = cvar("g_dodging");
if(cvar("g_dodging"))
MUTATOR_ADD(dodging);
c1 = c2 = c3 = c4 = -1;
cb1 = cb2 = cb3 = cb4 = 0;
- if(g_onslaught)
+ if(cvar("g_campaign") && for_whom && clienttype(for_whom) == CLIENTTYPE_REAL)
+ {
+ c1 = 0; // only allow RED team for player joining
+ }
+ else if(g_onslaught)
{
// onslaught is special
head = findchain(classname, "onslaught_generator");
if(totalteams <= 1)
{
- if(g_domination)
+ if(cvar("g_campaign") && pl && clienttype(pl) == CLIENTTYPE_REAL)
+ return 1; // special case for campaign and player joining
+ else if(g_domination)
error("Too few teams available for domination\n");
else if(g_ctf)
error("Too few teams available for ctf\n");
{
// 1: use team count, if equal prefer own team
if(c1 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM1) / 512.0);
- if(c2 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM2) / 512.0);
- if(c3 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM3) / 512.0);
- if(c4 >= 0) RandomSelection_Add(world, 1, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM4) / 512.0);
+ if(c2 >= 0) RandomSelection_Add(world, 2, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM2) / 512.0);
+ if(c3 >= 0) RandomSelection_Add(world, 3, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM3) / 512.0);
+ if(c4 >= 0) RandomSelection_Add(world, 4, string_null, 1, (maxc - c1) + (self.team == COLOR_TEAM4) / 512.0);
}
else if(balance_type == 3)
{
// find out what teams are available
CheckAllowedTeams(pl);
+ // if we want the player in a certain team for campaign, force him there
+ if(cvar("g_campaign"))
+ if(clienttype(pl) == CLIENTTYPE_REAL) // only players, not bots
+ {
+ switch(cvar("g_campaign_forceteam"))
+ {
+ case 1:
+ SetPlayerColors(pl, COLOR_TEAM1 - 1);
+ LogTeamchange(pl.playerid, pl.team, 2);
+ return COLOR_TEAM1;
+ case 2:
+ SetPlayerColors(pl, COLOR_TEAM2 - 1);
+ LogTeamchange(pl.playerid, pl.team, 2);
+ return COLOR_TEAM2;
+ case 3:
+ SetPlayerColors(pl, COLOR_TEAM3 - 1);
+ LogTeamchange(pl.playerid, pl.team, 2);
+ return COLOR_TEAM3;
+ case 4:
+ SetPlayerColors(pl, COLOR_TEAM4 - 1);
+ LogTeamchange(pl.playerid, pl.team, 2);
+ return COLOR_TEAM4;
+ default:
+ break;
+ }
+ }
+
// if we don't care what team he ends up on, put him on whatever team he entered as.
// if he's not on a valid team, then let other code put him on the smallest team
if(!forcebestteam)