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