3 #include "../gamemode.qh"
5 int autocvar_g_ca_point_limit;
6 int autocvar_g_ca_point_leadlimit;
7 float autocvar_g_ca_round_timelimit;
8 bool autocvar_g_ca_team_spawns;
9 //int autocvar_g_ca_teams;
10 int autocvar_g_ca_teams_override;
11 float autocvar_g_ca_warmup;
15 bool allowed_to_spawn;
17 const int ST_CA_ROUNDS = 1;
20 bool CA_CheckWinner();
22 bool ca_isEliminated(entity e);
24 REGISTER_MUTATOR(ca, false)
28 // game loads at time 1
29 if (time > 1) error("This is a game type and it cannot be added at runtime.");
31 allowed_to_spawn = true;
33 ca_teams = autocvar_g_ca_teams_override;
35 ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
36 ca_teams = bound(2, ca_teams, 4);
39 if(ca_teams >= 1) teams |= BIT(0);
40 if(ca_teams >= 2) teams |= BIT(1);
41 if(ca_teams >= 3) teams |= BIT(2);
42 if(ca_teams >= 4) teams |= BIT(3);
44 ca_teams = teams; // now set it?
46 GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
47 field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
50 round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
51 round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
53 EliminatedPlayers_Init(ca_isEliminated);
55 GameRules_teams(true);
56 GameRules_limit_score(autocvar_g_ca_point_limit);
57 GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
59 if (autocvar_g_ca_team_spawns)
60 have_team_spawns = -1; // request team spawns
65 LOG_INFO("This is a game type and it cannot be removed at runtime.");
72 // should be removed in the future, as other code should not have to care
73 .float caplayer; // 0.5 if scheduled to join the next round