REGISTER_MUTATOR(ca, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- // game loads at time 1
- if (time > 1) error("This is a game type and it cannot be added at runtime.");
-
- allowed_to_spawn = true;
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_ca_team_spawns);
+ GameRules_limit_score(autocvar_g_ca_point_limit);
+ GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
ca_teams = autocvar_g_ca_teams_override;
if (ca_teams < 2)
ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
- ca_teams = bound(2, ca_teams, 4);
-
- int teams = 0;
- if(ca_teams >= 1) teams |= BIT(0);
- if(ca_teams >= 2) teams |= BIT(1);
- if(ca_teams >= 3) teams |= BIT(2);
- if(ca_teams >= 4) teams |= BIT(3);
-
- ca_teams = teams; // now set it?
- GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ ca_teams = BITS(bound(2, ca_teams, 4));
+ GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, {
field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
});
+ allowed_to_spawn = true;
round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
-
EliminatedPlayers_Init(ca_isEliminated);
-
- GameRules_teams(true);
- GameRules_limit_score(autocvar_g_ca_point_limit);
- GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
-
- GameRules_spawning_teams(autocvar_g_ca_team_spawns);
}
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}