]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_freezetag.qc
Merge branch 'terencehill/quickmenu_file_example' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_freezetag.qc
1 #ifndef GAMEMODE_FREEZETAG_H
2 #define GAMEMODE_FREEZETAG_H
3
4 int autocvar_g_freezetag_point_limit;
5 int autocvar_g_freezetag_point_leadlimit;
6 bool autocvar_g_freezetag_team_spawns;
7 void freezetag_Initialize();
8
9 REGISTER_MUTATOR(ft, false)
10 {
11         MUTATOR_ONADD
12         {
13                 if (time > 1) // game loads at time 1
14                         error("This is a game type and it cannot be added at runtime.");
15                 freezetag_Initialize();
16
17                 ActivateTeamplay();
18                 SetLimits(autocvar_g_freezetag_point_limit, autocvar_g_freezetag_point_leadlimit, -1, -1);
19
20                 if (autocvar_g_freezetag_team_spawns)
21                         have_team_spawns = -1; // request team spawns
22         }
23
24         MUTATOR_ONROLLBACK_OR_REMOVE
25         {
26                 // we actually cannot roll back freezetag_Initialize here
27                 // BUT: we don't need to! If this gets called, adding always
28                 // succeeds.
29         }
30
31         MUTATOR_ONREMOVE
32         {
33                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
34                 return -1;
35         }
36
37         return 0;
38 }
39
40 .float freezetag_frozen_time;
41 .float freezetag_frozen_timeout;
42 const float ICE_MAX_ALPHA = 1;
43 const float ICE_MIN_ALPHA = 0.1;
44 float freezetag_teams;
45
46 .float reviving; // temp var
47
48 float autocvar_g_freezetag_revive_extra_size;
49 float autocvar_g_freezetag_revive_speed;
50 bool autocvar_g_freezetag_revive_nade;
51 float autocvar_g_freezetag_revive_nade_health;
52
53 #endif
54 #ifdef IMPLEMENTATION
55
56 float autocvar_g_freezetag_frozen_maxtime;
57 float autocvar_g_freezetag_revive_clearspeed;
58 float autocvar_g_freezetag_round_timelimit;
59 int autocvar_g_freezetag_teams;
60 int autocvar_g_freezetag_teams_override;
61 float autocvar_g_freezetag_warmup;
62
63 const float SP_FREEZETAG_REVIVALS = 4;
64 void freezetag_ScoreRules(float teams)
65 {
66         ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true); // SFL_SORT_PRIO_PRIMARY
67         ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
68         ScoreRules_basics_end();
69 }
70
71 void freezetag_count_alive_players()
72 {
73         entity e;
74         total_players = redalive = bluealive = yellowalive = pinkalive = 0;
75         FOR_EACH_PLAYER(e)
76         {
77                 switch(e.team)
78                 {
79                         case NUM_TEAM_1: ++total_players; if(e.health >= 1 && e.frozen != 1) ++redalive; break;
80                         case NUM_TEAM_2: ++total_players; if(e.health >= 1 && e.frozen != 1) ++bluealive; break;
81                         case NUM_TEAM_3: ++total_players; if(e.health >= 1 && e.frozen != 1) ++yellowalive; break;
82                         case NUM_TEAM_4: ++total_players; if(e.health >= 1 && e.frozen != 1) ++pinkalive; break;
83                 }
84         }
85         FOR_EACH_REALCLIENT(e)
86         {
87                 e.redalive_stat = redalive;
88                 e.bluealive_stat = bluealive;
89                 e.yellowalive_stat = yellowalive;
90                 e.pinkalive_stat = pinkalive;
91         }
92
93         eliminatedPlayers.SendFlags |= 1;
94 }
95 #define FREEZETAG_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0))
96 #define FREEZETAG_ALIVE_TEAMS_OK() (FREEZETAG_ALIVE_TEAMS() == freezetag_teams)
97
98 float freezetag_CheckTeams()
99 {
100         static float prev_missing_teams_mask;
101         if(FREEZETAG_ALIVE_TEAMS_OK())
102         {
103                 if(prev_missing_teams_mask > 0)
104                         Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
105                 prev_missing_teams_mask = -1;
106                 return 1;
107         }
108         if(total_players == 0)
109         {
110                 if(prev_missing_teams_mask > 0)
111                         Kill_Notification(NOTIF_ALL, world, MSG_CENTER_CPID, CPID_MISSING_TEAMS);
112                 prev_missing_teams_mask = -1;
113                 return 0;
114         }
115         float missing_teams_mask = (!redalive) + (!bluealive) * 2;
116         if(freezetag_teams >= 3) missing_teams_mask += (!yellowalive) * 4;
117         if(freezetag_teams >= 4) missing_teams_mask += (!pinkalive) * 8;
118         if(prev_missing_teams_mask != missing_teams_mask)
119         {
120                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask);
121                 prev_missing_teams_mask = missing_teams_mask;
122         }
123         return 0;
124 }
125
126 float freezetag_getWinnerTeam()
127 {
128         float winner_team = 0;
129         if(redalive >= 1)
130                 winner_team = NUM_TEAM_1;
131         if(bluealive >= 1)
132         {
133                 if(winner_team) return 0;
134                 winner_team = NUM_TEAM_2;
135         }
136         if(yellowalive >= 1)
137         {
138                 if(winner_team) return 0;
139                 winner_team = NUM_TEAM_3;
140         }
141         if(pinkalive >= 1)
142         {
143                 if(winner_team) return 0;
144                 winner_team = NUM_TEAM_4;
145         }
146         if(winner_team)
147                 return winner_team;
148         return -1; // no player left
149 }
150
151 float freezetag_CheckWinner()
152 {
153         entity e;
154         if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
155         {
156                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
157                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
158                 FOR_EACH_PLAYER(e)
159                 {
160                         e.freezetag_frozen_timeout = 0;
161                         nades_Clear(e);
162                 }
163                 round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
164                 return 1;
165         }
166
167         if(FREEZETAG_ALIVE_TEAMS() > 1)
168                 return 0;
169
170         float winner_team;
171         winner_team = freezetag_getWinnerTeam();
172         if(winner_team > 0)
173         {
174                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_));
175                 Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_));
176                 TeamScore_AddToTeam(winner_team, ST_SCORE, +1);
177         }
178         else if(winner_team == -1)
179         {
180                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED);
181                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
182         }
183
184         FOR_EACH_PLAYER(e)
185         {
186                 e.freezetag_frozen_timeout = 0;
187                 nades_Clear(e);
188         }
189         round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
190         return 1;
191 }
192
193 entity freezetag_LastPlayerForTeam()
194 {SELFPARAM();
195         entity pl, last_pl = world;
196         FOR_EACH_PLAYER(pl)
197         {
198                 if(pl.health >= 1)
199                 if(!pl.frozen)
200                 if(pl != self)
201                 if(pl.team == self.team)
202                 if(!last_pl)
203                         last_pl = pl;
204                 else
205                         return world;
206         }
207         return last_pl;
208 }
209
210 void freezetag_LastPlayerForTeam_Notify()
211 {
212         if(round_handler_IsActive())
213         if(round_handler_IsRoundStarted())
214         {
215                 entity pl = freezetag_LastPlayerForTeam();
216                 if(pl)
217                         Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE);
218         }
219 }
220
221 void freezetag_Add_Score(entity attacker)
222 {SELFPARAM();
223         if(attacker == self)
224         {
225                 // you froze your own dumb self
226                 // counted as "suicide" already
227                 PlayerScore_Add(self, SP_SCORE, -1);
228         }
229         else if(IS_PLAYER(attacker))
230         {
231                 // got frozen by an enemy
232                 // counted as "kill" and "death" already
233                 PlayerScore_Add(self, SP_SCORE, -1);
234                 PlayerScore_Add(attacker, SP_SCORE, +1);
235         }
236         // else nothing - got frozen by the game type rules themselves
237 }
238
239 void freezetag_Freeze(entity attacker)
240 {SELFPARAM();
241         if(self.frozen)
242                 return;
243
244         if(autocvar_g_freezetag_frozen_maxtime > 0)
245                 self.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
246
247         Freeze(self, 0, 1, true);
248
249         freezetag_count_alive_players();
250
251         freezetag_Add_Score(attacker);
252 }
253
254 void freezetag_Unfreeze(entity attacker)
255 {SELFPARAM();
256         self.freezetag_frozen_time = 0;
257         self.freezetag_frozen_timeout = 0;
258
259         Unfreeze(self);
260 }
261
262 float freezetag_isEliminated(entity e)
263 {
264         if(IS_PLAYER(e) && (e.frozen == 1 || e.deadflag != DEAD_NO))
265                 return true;
266         return false;
267 }
268
269
270 // ================
271 // Bot player logic
272 // ================
273
274 void() havocbot_role_ft_freeing;
275 void() havocbot_role_ft_offense;
276
277 void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius)
278 {SELFPARAM();
279         entity head;
280         float distance;
281
282         FOR_EACH_PLAYER(head)
283         {
284                 if ((head != self) && (head.team == self.team))
285                 {
286                         if (head.frozen == 1)
287                         {
288                                 distance = vlen(head.origin - org);
289                                 if (distance > sradius)
290                                         continue;
291                                 navigation_routerating(head, ratingscale, 2000);
292                         }
293                         else
294                         {
295                                 // If teamate is not frozen still seek them out as fight better
296                                 // in a group.
297                                 navigation_routerating(head, ratingscale/3, 2000);
298                         }
299                 }
300         }
301 }
302
303 void havocbot_role_ft_offense()
304 {SELFPARAM();
305         entity head;
306         float unfrozen;
307
308         if(self.deadflag != DEAD_NO)
309                 return;
310
311         if (!self.havocbot_role_timeout)
312                 self.havocbot_role_timeout = time + random() * 10 + 20;
313
314         // Count how many players on team are unfrozen.
315         unfrozen = 0;
316         FOR_EACH_PLAYER(head)
317         {
318                 if ((head.team == self.team) && (head.frozen != 1))
319                         unfrozen++;
320         }
321
322         // If only one left on team or if role has timed out then start trying to free players.
323         if (((unfrozen == 0) && (!self.frozen)) || (time > self.havocbot_role_timeout))
324         {
325                 LOG_TRACE("changing role to freeing\n");
326                 self.havocbot_role = havocbot_role_ft_freeing;
327                 self.havocbot_role_timeout = 0;
328                 return;
329         }
330
331         if (time > self.bot_strategytime)
332         {
333                 self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
334
335                 navigation_goalrating_start();
336                 havocbot_goalrating_items(10000, self.origin, 10000);
337                 havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
338                 havocbot_goalrating_freeplayers(9000, self.origin, 10000);
339                 //havocbot_goalrating_waypoints(1, self.origin, 1000);
340                 navigation_goalrating_end();
341         }
342 }
343
344 void havocbot_role_ft_freeing()
345 {SELFPARAM();
346         if(self.deadflag != DEAD_NO)
347                 return;
348
349         if (!self.havocbot_role_timeout)
350                 self.havocbot_role_timeout = time + random() * 10 + 20;
351
352         if (time > self.havocbot_role_timeout)
353         {
354                 LOG_TRACE("changing role to offense\n");
355                 self.havocbot_role = havocbot_role_ft_offense;
356                 self.havocbot_role_timeout = 0;
357                 return;
358         }
359
360         if (time > self.bot_strategytime)
361         {
362                 self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
363
364                 navigation_goalrating_start();
365                 havocbot_goalrating_items(8000, self.origin, 10000);
366                 havocbot_goalrating_enemyplayers(10000, self.origin, 10000);
367                 havocbot_goalrating_freeplayers(20000, self.origin, 10000);
368                 //havocbot_goalrating_waypoints(1, self.origin, 1000);
369                 navigation_goalrating_end();
370         }
371 }
372
373
374 // ==============
375 // Hook Functions
376 // ==============
377
378 void ft_RemovePlayer()
379 {SELFPARAM();
380         self.health = 0; // neccessary to update correctly alive stats
381         if(!self.frozen)
382                 freezetag_LastPlayerForTeam_Notify();
383         freezetag_Unfreeze(world);
384         freezetag_count_alive_players();
385 }
386
387 MUTATOR_HOOKFUNCTION(ft, ClientDisconnect)
388 {SELFPARAM();
389         ft_RemovePlayer();
390         return 1;
391 }
392
393 MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver)
394 {SELFPARAM();
395         ft_RemovePlayer();
396         return false;
397 }
398
399 MUTATOR_HOOKFUNCTION(ft, PlayerDies)
400 {SELFPARAM();
401         if(round_handler_IsActive())
402         if(round_handler_CountdownRunning())
403         {
404                 if(self.frozen)
405                         freezetag_Unfreeze(world);
406                 freezetag_count_alive_players();
407                 return 1; // let the player die so that he can respawn whenever he wants
408         }
409
410         // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe
411         // you succeed changing team through the menu: you both really die (gibbing) and get frozen
412         if(ITEM_DAMAGE_NEEDKILL(frag_deathtype)
413                 || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id)
414         {
415                 // let the player die, he will be automatically frozen when he respawns
416                 if(self.frozen != 1)
417                 {
418                         freezetag_Add_Score(frag_attacker);
419                         freezetag_count_alive_players();
420                         freezetag_LastPlayerForTeam_Notify();
421                 }
422                 else
423                         freezetag_Unfreeze(world); // remove ice
424                 self.health = 0; // Unfreeze resets health
425                 self.freezetag_frozen_timeout = -2; // freeze on respawn
426                 return 1;
427         }
428
429         if(self.frozen)
430                 return 1;
431
432         freezetag_Freeze(frag_attacker);
433         freezetag_LastPlayerForTeam_Notify();
434
435         if(frag_attacker == frag_target || frag_attacker == world)
436         {
437                 if(IS_PLAYER(frag_target))
438                         Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_SELF);
439                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_SELF, frag_target.netname);
440         }
441         else
442         {
443                 if(IS_PLAYER(frag_target))
444                         Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_FROZEN, frag_attacker.netname);
445                 if(IS_PLAYER(frag_attacker))
446                         Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_FREEZETAG_FREEZE, frag_target.netname);
447                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_FREEZE, frag_target.netname, frag_attacker.netname);
448         }
449
450         return 1;
451 }
452
453 MUTATOR_HOOKFUNCTION(ft, PlayerSpawn)
454 {SELFPARAM();
455         if(self.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
456                 return 1; // do nothing, round is starting right now
457
458         if(self.freezetag_frozen_timeout == -2) // player was dead
459         {
460                 freezetag_Freeze(world);
461                 return 1;
462         }
463
464         freezetag_count_alive_players();
465
466         if(round_handler_IsActive())
467         if(round_handler_IsRoundStarted())
468         {
469                 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
470                 freezetag_Freeze(world);
471         }
472
473         return 1;
474 }
475
476 MUTATOR_HOOKFUNCTION(ft, reset_map_players)
477 {SELFPARAM();
478         entity e;
479         FOR_EACH_PLAYER(e)
480         {
481                 e.killcount = 0;
482                 e.freezetag_frozen_timeout = -1;
483                 setself(e);
484                 PutClientInServer();
485                 e.freezetag_frozen_timeout = 0;
486         }
487         freezetag_count_alive_players();
488         return 1;
489 }
490
491 MUTATOR_HOOKFUNCTION(ft, GiveFragsForKill, CBC_ORDER_FIRST)
492 {
493         frag_score = 0; // no frags counted in Freeze Tag
494         return 1;
495 }
496
497 MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
498 {SELFPARAM();
499         float n;
500
501         if(gameover)
502                 return 1;
503
504         if(self.frozen == 1)
505         {
506                 // keep health = 1
507                 self.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
508         }
509
510         if(round_handler_IsActive())
511         if(!round_handler_IsRoundStarted())
512                 return 1;
513
514         entity o;
515         o = world;
516         //if(self.frozen)
517         //if(self.freezetag_frozen_timeout > 0 && time < self.freezetag_frozen_timeout)
518                 //self.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (self.freezetag_frozen_timeout - time) / (self.freezetag_frozen_timeout - self.freezetag_frozen_time);
519
520         if(self.freezetag_frozen_timeout > 0 && time >= self.freezetag_frozen_timeout)
521                 n = -1;
522         else
523         {
524                 vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
525                 n = 0;
526                 FOR_EACH_PLAYER(other)
527                 if(self != other)
528                 if(other.frozen == 0)
529                 if(other.deadflag == DEAD_NO)
530                 if(SAME_TEAM(other, self))
531                 if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, other.absmin, other.absmax))
532                 {
533                         if(!o)
534                                 o = other;
535                         if(self.frozen == 1)
536                                 other.reviving = true;
537                         ++n;
538                 }
539         }
540
541         if(n && self.frozen == 1) // OK, there is at least one teammate reviving us
542         {
543                 self.revive_progress = bound(0, self.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
544                 self.health = max(1, self.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
545
546                 if(self.revive_progress >= 1)
547                 {
548                         freezetag_Unfreeze(self);
549                         freezetag_count_alive_players();
550
551                         if(n == -1)
552                         {
553                                 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_AUTO_REVIVED, autocvar_g_freezetag_frozen_maxtime);
554                                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_AUTO_REVIVED, self.netname, autocvar_g_freezetag_frozen_maxtime);
555                                 return 1;
556                         }
557
558                         // EVERY team mate nearby gets a point (even if multiple!)
559                         FOR_EACH_PLAYER(other)
560                         {
561                                 if(other.reviving)
562                                 {
563                                         PlayerScore_Add(other, SP_FREEZETAG_REVIVALS, +1);
564                                         PlayerScore_Add(other, SP_SCORE, +1);
565
566                                         nades_GiveBonus(other,autocvar_g_nades_bonus_score_low);
567                                 }
568                         }
569
570                         Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
571                         Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
572                         Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED, self.netname, o.netname);
573                 }
574
575                 FOR_EACH_PLAYER(other)
576                 {
577                         if(other.reviving)
578                         {
579                                 other.revive_progress = self.revive_progress;
580                                 other.reviving = false;
581                         }
582                 }
583         }
584         else if(!n && self.frozen == 1) // only if no teammate is nearby will we reset
585         {
586                 self.revive_progress = bound(0, self.revive_progress - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
587                 self.health = max(1, self.revive_progress * ((warmup_stage) ? warmup_start_health : start_health));
588         }
589         else if(!n && !self.frozen)
590         {
591                 self.revive_progress = 0; // thawing nobody
592         }
593
594         return 1;
595 }
596
597 MUTATOR_HOOKFUNCTION(ft, SetStartItems)
598 {
599         start_items &= ~IT_UNLIMITED_AMMO;
600         //start_health       = warmup_start_health       = cvar("g_lms_start_health");
601         //start_armorvalue   = warmup_start_armorvalue   = cvar("g_lms_start_armor");
602         start_ammo_shells  = warmup_start_ammo_shells  = cvar("g_lms_start_ammo_shells");
603         start_ammo_nails   = warmup_start_ammo_nails   = cvar("g_lms_start_ammo_nails");
604         start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
605         start_ammo_cells   = warmup_start_ammo_cells   = cvar("g_lms_start_ammo_cells");
606         start_ammo_plasma  = warmup_start_ammo_plasma  = cvar("g_lms_start_ammo_plasma");
607         start_ammo_fuel    = warmup_start_ammo_fuel    = cvar("g_lms_start_ammo_fuel");
608
609         return 0;
610 }
611
612 MUTATOR_HOOKFUNCTION(ft, HavocBot_ChooseRole)
613 {SELFPARAM();
614         if (!self.deadflag)
615         {
616                 if (random() < 0.5)
617                         self.havocbot_role = havocbot_role_ft_freeing;
618                 else
619                         self.havocbot_role = havocbot_role_ft_offense;
620         }
621
622         return true;
623 }
624
625 MUTATOR_HOOKFUNCTION(ft, GetTeamCount, CBC_ORDER_EXCLUSIVE)
626 {
627         ret_float = freezetag_teams;
628         return false;
629 }
630
631 MUTATOR_HOOKFUNCTION(ft, SetWeaponArena)
632 {
633         // most weapons arena
634         if(ret_string == "0" || ret_string == "")
635                 ret_string = "most";
636         return false;
637 }
638
639 void freezetag_Initialize()
640 {
641         freezetag_teams = autocvar_g_freezetag_teams_override;
642         if(freezetag_teams < 2)
643                 freezetag_teams = autocvar_g_freezetag_teams;
644         freezetag_teams = bound(2, freezetag_teams, 4);
645         freezetag_ScoreRules(freezetag_teams);
646
647         round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
648         round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
649
650         addstat(STAT_REDALIVE, AS_INT, redalive_stat);
651         addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
652         addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
653         addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
654
655         EliminatedPlayers_Init(freezetag_isEliminated);
656 }
657
658 #endif