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