]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/gamemode_domination.qc
Move some race related stuff out of the main physics function
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_domination.qc
1 #include "gamemode_domination.qh"
2
3 #include "gamemode.qh"
4
5 #include "../teamplay.qh"
6
7 int autocvar_g_domination_default_teams;
8 bool autocvar_g_domination_disable_frags;
9 int autocvar_g_domination_point_amt;
10 bool autocvar_g_domination_point_fullbright;
11 int autocvar_g_domination_point_leadlimit;
12 bool autocvar_g_domination_roundbased;
13 int autocvar_g_domination_roundbased_point_limit;
14 float autocvar_g_domination_round_timelimit;
15 float autocvar_g_domination_warmup;
16 #define autocvar_g_domination_point_limit cvar("g_domination_point_limit")
17 float autocvar_g_domination_point_rate;
18 int autocvar_g_domination_teams_override;
19
20 void dom_EventLog(string mode, float team_before, entity actor) // use an alias for easy changing and quick editing later
21 {
22         if(autocvar_sv_eventlog)
23                 GameLogEcho(strcat(":dom:", mode, ":", ftos(team_before), ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
24 }
25
26 void set_dom_state(entity e)
27 {
28         e.dom_total_pps = total_pps;
29         e.dom_pps_red = pps_red;
30         e.dom_pps_blue = pps_blue;
31         if(domination_teams >= 3)
32                 e.dom_pps_yellow = pps_yellow;
33         if(domination_teams >= 4)
34                 e.dom_pps_pink = pps_pink;
35 }
36
37 void dompoint_captured ()
38 {SELFPARAM();
39         entity head;
40         float old_delay, old_team, real_team;
41
42         // now that the delay has expired, switch to the latest team to lay claim to this point
43         head = self.owner;
44
45         real_team = self.cnt;
46         self.cnt = -1;
47
48         dom_EventLog("taken", self.team, self.dmg_inflictor);
49         self.dmg_inflictor = world;
50
51         self.goalentity = head;
52         self.model = head.mdl;
53         self.modelindex = head.dmg;
54         self.skin = head.skin;
55
56         float points, wait_time;
57         if (autocvar_g_domination_point_amt)
58                 points = autocvar_g_domination_point_amt;
59         else
60                 points = self.frags;
61         if (autocvar_g_domination_point_rate)
62                 wait_time = autocvar_g_domination_point_rate;
63         else
64                 wait_time = self.wait;
65
66         if(domination_roundbased)
67                 bprint(sprintf("^3%s^3%s\n", head.netname, self.message));
68         else
69                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, self.message, points, wait_time);
70
71         if(self.enemy.playerid == self.enemy_playerid)
72                 PlayerScore_Add(self.enemy, SP_DOM_TAKES, 1);
73         else
74                 self.enemy = world;
75
76         if (head.noise != "")
77                 if(self.enemy)
78                         _sound(self.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
79                 else
80                         _sound(self, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
81         if (head.noise1 != "")
82                 play2all(head.noise1);
83
84         self.delay = time + wait_time;
85
86         // do trigger work
87         old_delay = self.delay;
88         old_team = self.team;
89         self.team = real_team;
90         self.delay = 0;
91         activator = self;
92         SUB_UseTargets ();
93         self.delay = old_delay;
94         self.team = old_team;
95
96         entity msg = WP_DomNeut;
97         switch(self.team)
98         {
99                 case NUM_TEAM_1: msg = WP_DomRed; break;
100                 case NUM_TEAM_2: msg = WP_DomBlue; break;
101                 case NUM_TEAM_3: msg = WP_DomYellow; break;
102                 case NUM_TEAM_4: msg = WP_DomPink; break;
103         }
104
105         WaypointSprite_UpdateSprites(self.sprite, msg, WP_Null, WP_Null);
106
107         total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
108         for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; )
109         {
110                 if (autocvar_g_domination_point_amt)
111                         points = autocvar_g_domination_point_amt;
112                 else
113                         points = head.frags;
114                 if (autocvar_g_domination_point_rate)
115                         wait_time = autocvar_g_domination_point_rate;
116                 else
117                         wait_time = head.wait;
118                 switch(head.goalentity.team)
119                 {
120                         case NUM_TEAM_1:
121                                 pps_red += points/wait_time;
122                                 break;
123                         case NUM_TEAM_2:
124                                 pps_blue += points/wait_time;
125                                 break;
126                         case NUM_TEAM_3:
127                                 pps_yellow += points/wait_time;
128                                 break;
129                         case NUM_TEAM_4:
130                                 pps_pink += points/wait_time;
131                                 break;
132                 }
133                 total_pps += points/wait_time;
134         }
135
136         WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0));
137         WaypointSprite_Ping(self.sprite);
138
139         self.captime = time;
140
141         FOR_EACH_REALCLIENT(head)
142                 set_dom_state(head);
143 }
144
145 void AnimateDomPoint()
146 {SELFPARAM();
147         if(self.pain_finished > time)
148                 return;
149         self.pain_finished = time + self.t_width;
150         if(self.nextthink > self.pain_finished)
151                 self.nextthink = self.pain_finished;
152
153         self.frame = self.frame + 1;
154         if(self.frame > self.t_length)
155                 self.frame = 0;
156 }
157
158 void dompointthink()
159 {SELFPARAM();
160         float fragamt;
161
162         self.nextthink = time + 0.1;
163
164         //self.frame = self.frame + 1;
165         //if(self.frame > 119)
166         //      self.frame = 0;
167         AnimateDomPoint();
168
169         // give points
170
171         if (gameover || self.delay > time || time < game_starttime)     // game has ended, don't keep giving points
172                 return;
173
174         if(autocvar_g_domination_point_rate)
175                 self.delay = time + autocvar_g_domination_point_rate;
176         else
177                 self.delay = time + self.wait;
178
179         // give credit to the team
180         // NOTE: this defaults to 0
181         if (!domination_roundbased)
182         if (self.goalentity.netname != "")
183         {
184                 if(autocvar_g_domination_point_amt)
185                         fragamt = autocvar_g_domination_point_amt;
186                 else
187                         fragamt = self.frags;
188                 TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
189                 TeamScore_AddToTeam(self.goalentity.team, ST_DOM_TICKS, fragamt);
190
191                 // give credit to the individual player, if he is still there
192                 if (self.enemy.playerid == self.enemy_playerid)
193                 {
194                         PlayerScore_Add(self.enemy, SP_SCORE, fragamt);
195                         PlayerScore_Add(self.enemy, SP_DOM_TICKS, fragamt);
196                 }
197                 else
198                         self.enemy = world;
199         }
200 }
201
202 void dompointtouch()
203 {SELFPARAM();
204         entity head;
205         if (!IS_PLAYER(other))
206                 return;
207         if (other.health < 1)
208                 return;
209
210         if(round_handler_IsActive() && !round_handler_IsRoundStarted())
211                 return;
212
213         if(time < self.captime + 0.3)
214                 return;
215
216         // only valid teams can claim it
217         head = find(world, classname, "dom_team");
218         while (head && head.team != other.team)
219                 head = find(head, classname, "dom_team");
220         if (!head || head.netname == "" || head == self.goalentity)
221                 return;
222
223         // delay capture
224
225         self.team = self.goalentity.team; // this stores the PREVIOUS team!
226
227         self.cnt = other.team;
228         self.owner = head; // team to switch to after the delay
229         self.dmg_inflictor = other;
230
231         // self.state = 1;
232         // self.delay = time + cvar("g_domination_point_capturetime");
233         //self.nextthink = time + cvar("g_domination_point_capturetime");
234         //self.think = dompoint_captured;
235
236         // go to neutral team in the mean time
237         head = find(world, classname, "dom_team");
238         while (head && head.netname != "")
239                 head = find(head, classname, "dom_team");
240         if(head == world)
241                 return;
242
243         WaypointSprite_UpdateSprites(self.sprite, WP_DomNeut, WP_Null, WP_Null);
244         WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1');
245         WaypointSprite_Ping(self.sprite);
246
247         self.goalentity = head;
248         self.model = head.mdl;
249         self.modelindex = head.dmg;
250         self.skin = head.skin;
251
252         self.enemy = other; // individual player scoring
253         self.enemy_playerid = other.playerid;
254         dompoint_captured();
255 }
256
257 void dom_controlpoint_setup()
258 {SELFPARAM();
259         entity head;
260         // find the spawnfunc_dom_team representing unclaimed points
261         head = find(world, classname, "dom_team");
262         while(head && head.netname != "")
263                 head = find(head, classname, "dom_team");
264         if (!head)
265                 objerror("no spawnfunc_dom_team with netname \"\" found\n");
266
267         // copy important properties from spawnfunc_dom_team entity
268         self.goalentity = head;
269         _setmodel(self, head.mdl); // precision already set
270         self.skin = head.skin;
271
272         self.cnt = -1;
273
274         if(self.message == "")
275                 self.message = " has captured a control point";
276
277         if(self.frags <= 0)
278                 self.frags = 1;
279         if(self.wait <= 0)
280                 self.wait = 5;
281
282         float points, waittime;
283         if (autocvar_g_domination_point_amt)
284                 points = autocvar_g_domination_point_amt;
285         else
286                 points = self.frags;
287         if (autocvar_g_domination_point_rate)
288                 waittime = autocvar_g_domination_point_rate;
289         else
290                 waittime = self.wait;
291
292         total_pps += points/waittime;
293
294         if(!self.t_width)
295                 self.t_width = 0.02; // frame animation rate
296         if(!self.t_length)
297                 self.t_length = 239; // maximum frame
298
299         self.think = dompointthink;
300         self.nextthink = time;
301         self.touch = dompointtouch;
302         self.solid = SOLID_TRIGGER;
303         self.flags = FL_ITEM;
304         setsize(self, '-32 -32 -32', '32 32 32');
305         setorigin(self, self.origin + '0 0 20');
306         droptofloor();
307
308         waypoint_spawnforitem(self);
309         WaypointSprite_SpawnFixed(WP_DomNeut, self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT);
310 }
311
312 float total_controlpoints;
313 void Domination_count_controlpoints()
314 {
315         entity e;
316         total_controlpoints = redowned = blueowned = yellowowned = pinkowned = 0;
317         for(e = world; (e = find(e, classname, "dom_controlpoint")) != world; )
318         {
319                 ++total_controlpoints;
320                 redowned += (e.goalentity.team == NUM_TEAM_1);
321                 blueowned += (e.goalentity.team == NUM_TEAM_2);
322                 yellowowned += (e.goalentity.team == NUM_TEAM_3);
323                 pinkowned += (e.goalentity.team == NUM_TEAM_4);
324         }
325 }
326
327 float Domination_GetWinnerTeam()
328 {
329         float winner_team = 0;
330         if(redowned == total_controlpoints)
331                 winner_team = NUM_TEAM_1;
332         if(blueowned == total_controlpoints)
333         {
334                 if(winner_team) return 0;
335                 winner_team = NUM_TEAM_2;
336         }
337         if(yellowowned == total_controlpoints)
338         {
339                 if(winner_team) return 0;
340                 winner_team = NUM_TEAM_3;
341         }
342         if(pinkowned == total_controlpoints)
343         {
344                 if(winner_team) return 0;
345                 winner_team = NUM_TEAM_4;
346         }
347         if(winner_team)
348                 return winner_team;
349         return -1; // no control points left?
350 }
351
352 #define DOM_OWNED_CONTROLPOINTS() ((redowned > 0) + (blueowned > 0) + (yellowowned > 0) + (pinkowned > 0))
353 #define DOM_OWNED_CONTROLPOINTS_OK() (DOM_OWNED_CONTROLPOINTS() < total_controlpoints)
354 float Domination_CheckWinner()
355 {
356         if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
357         {
358                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
359                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
360                 round_handler_Init(5, autocvar_g_domination_warmup, autocvar_g_domination_round_timelimit);
361                 return 1;
362         }
363
364         Domination_count_controlpoints();
365
366         float winner_team = Domination_GetWinnerTeam();
367
368         if(winner_team == -1)
369                 return 0;
370
371         if(winner_team > 0)
372         {
373                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_));
374                 Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_));
375                 TeamScore_AddToTeam(winner_team, ST_DOM_CAPS, +1);
376         }
377         else if(winner_team == -1)
378         {
379                 Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_TIED);
380                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_TIED);
381         }
382
383         round_handler_Init(5, autocvar_g_domination_warmup, autocvar_g_domination_round_timelimit);
384
385         return 1;
386 }
387
388 float Domination_CheckPlayers()
389 {
390         return 1;
391 }
392
393 void Domination_RoundStart()
394 {
395         entity e;
396         FOR_EACH_PLAYER(e)
397                 e.player_blocked = 0;
398 }
399
400 //go to best items, or control points you don't own
401 void havocbot_role_dom()
402 {SELFPARAM();
403         if(self.deadflag != DEAD_NO)
404                 return;
405
406         if (self.bot_strategytime < time)
407         {
408                 self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
409                 navigation_goalrating_start();
410                 havocbot_goalrating_controlpoints(10000, self.origin, 15000);
411                 havocbot_goalrating_items(8000, self.origin, 8000);
412                 //havocbot_goalrating_enemyplayers(3000, self.origin, 2000);
413                 //havocbot_goalrating_waypoints(1, self.origin, 1000);
414                 navigation_goalrating_end();
415         }
416 }
417
418 MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
419 {
420         // fallback?
421         ret_float = domination_teams;
422         ret_string = "dom_team";
423
424         entity head = find(world, classname, ret_string);
425         while(head)
426         {
427                 if(head.netname != "")
428                 {
429                         switch(head.team)
430                         {
431                                 case NUM_TEAM_1: c1 = 0; break;
432                                 case NUM_TEAM_2: c2 = 0; break;
433                                 case NUM_TEAM_3: c3 = 0; break;
434                                 case NUM_TEAM_4: c4 = 0; break;
435                         }
436                 }
437
438                 head = find(head, classname, ret_string);
439         }
440
441         ret_string = string_null;
442
443         return true;
444 }
445
446 MUTATOR_HOOKFUNCTION(dom, reset_map_players)
447 {SELFPARAM();
448         total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
449         entity e;
450         FOR_EACH_PLAYER(e)
451         {
452                 setself(e);
453                 PutClientInServer();
454                 self.player_blocked = 1;
455                 if(IS_REAL_CLIENT(self))
456                         set_dom_state(self);
457         }
458         return 1;
459 }
460
461 MUTATOR_HOOKFUNCTION(dom, PlayerSpawn)
462 {SELFPARAM();
463         if(domination_roundbased)
464         if(!round_handler_IsRoundStarted())
465                 self.player_blocked = 1;
466         else
467                 self.player_blocked = 0;
468         return false;
469 }
470
471 MUTATOR_HOOKFUNCTION(dom, ClientConnect)
472 {SELFPARAM();
473         set_dom_state(self);
474         return false;
475 }
476
477 MUTATOR_HOOKFUNCTION(dom, HavocBot_ChooseRole)
478 {SELFPARAM();
479         self.havocbot_role = havocbot_role_dom;
480         return true;
481 }
482
483 /*QUAKED spawnfunc_dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32)
484 Control point for Domination gameplay.
485 */
486 spawnfunc(dom_controlpoint)
487 {
488         if(!g_domination)
489         {
490                 remove(self);
491                 return;
492         }
493         self.think = dom_controlpoint_setup;
494         self.nextthink = time + 0.1;
495         self.reset = dom_controlpoint_setup;
496
497         if(!self.scale)
498                 self.scale = 0.6;
499
500         self.effects = self.effects | EF_LOWPRECISION;
501         if (autocvar_g_domination_point_fullbright)
502                 self.effects |= EF_FULLBRIGHT;
503 }
504
505 /*QUAKED spawnfunc_dom_team (0 .5 .8) (-32 -32 -24) (32 32 32)
506 Team declaration for Domination gameplay, this allows you to decide what team
507 names and control point models are used in your map.
508
509 Note: If you use spawnfunc_dom_team entities you must define at least 3 and only two
510 can have netname set!  The nameless team owns all control points at start.
511
512 Keys:
513 "netname"
514  Name of the team (for example Red Team, Blue Team, Green Team, Yellow Team, Life, Death, etc)
515 "cnt"
516  Scoreboard color of the team (for example 4 is red and 13 is blue)
517 "model"
518  Model to use for control points owned by this team (for example
519  "progs/b_g_key.mdl" is a gold keycard, and "progs/b_s_key.mdl" is a silver
520  keycard)
521 "skin"
522  Skin of the model to use (for team skins on a single model)
523 "noise"
524  Sound to play when this team captures a point.
525  (this is a localized sound, like a small alarm or other effect)
526 "noise1"
527  Narrator speech to play when this team captures a point.
528  (this is a global sound, like "Red team has captured a control point")
529 */
530
531 spawnfunc(dom_team)
532 {
533         if(!g_domination || autocvar_g_domination_teams_override >= 2)
534         {
535                 remove(self);
536                 return;
537         }
538         precache_model(self.model);
539         if (self.noise != "")
540                 precache_sound(self.noise);
541         if (self.noise1 != "")
542                 precache_sound(self.noise1);
543         self.classname = "dom_team";
544         _setmodel(self, self.model); // precision not needed
545         self.mdl = self.model;
546         self.dmg = self.modelindex;
547         self.model = "";
548         self.modelindex = 0;
549         // this would have to be changed if used in quakeworld
550         if(self.cnt)
551                 self.team = self.cnt + 1; // WHY are these different anyway?
552 }
553
554 // scoreboard setup
555 void ScoreRules_dom(float teams)
556 {
557         if(domination_roundbased)
558         {
559                 ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
560                 ScoreInfo_SetLabel_TeamScore  (ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
561                 ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
562                 ScoreRules_basics_end();
563         }
564         else
565         {
566                 float sp_domticks, sp_score;
567                 sp_score = sp_domticks = 0;
568                 if(autocvar_g_domination_disable_frags)
569                         sp_domticks = SFL_SORT_PRIO_PRIMARY;
570                 else
571                         sp_score = SFL_SORT_PRIO_PRIMARY;
572                 ScoreRules_basics(teams, sp_score, sp_score, true);
573                 ScoreInfo_SetLabel_TeamScore  (ST_DOM_TICKS,    "ticks",     sp_domticks);
574                 ScoreInfo_SetLabel_PlayerScore(SP_DOM_TICKS,    "ticks",     sp_domticks);
575                 ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES,    "takes",     0);
576                 ScoreRules_basics_end();
577         }
578 }
579
580 // code from here on is just to support maps that don't have control point and team entities
581 void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage)
582 {SELFPARAM();
583         setself(spawn());
584         self.classname = "dom_team";
585         self.netname = teamname;
586         self.cnt = teamcolor;
587         self.model = pointmodel;
588         self.skin = pointskin;
589         self.noise = capsound;
590         self.noise1 = capnarration;
591         self.message = capmessage;
592
593         // this code is identical to spawnfunc_dom_team
594         _setmodel(self, self.model); // precision not needed
595         self.mdl = self.model;
596         self.dmg = self.modelindex;
597         self.model = "";
598         self.modelindex = 0;
599         // this would have to be changed if used in quakeworld
600         self.team = self.cnt + 1;
601
602         //eprint(self);
603         setself(this);
604 }
605
606 void _spawnfunc_dom_controlpoint() { SELFPARAM(); spawnfunc_dom_controlpoint(self); }
607 void dom_spawnpoint(vector org)
608 {SELFPARAM();
609         setself(spawn());
610         self.classname = "dom_controlpoint";
611         self.think = _spawnfunc_dom_controlpoint;
612         self.nextthink = time;
613         setorigin(self, org);
614         spawnfunc_dom_controlpoint(this);
615         setself(this);
616 }
617
618 // spawn some default teams if the map is not set up for domination
619 void dom_spawnteams(float teams)
620 {
621         dom_spawnteam("Red", NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND(DOM_CLAIM), "", "Red team has captured a control point");
622         dom_spawnteam("Blue", NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND(DOM_CLAIM), "", "Blue team has captured a control point");
623         if(teams >= 3)
624                 dom_spawnteam("Yellow", NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND(DOM_CLAIM), "", "Yellow team has captured a control point");
625         if(teams >= 4)
626                 dom_spawnteam("Pink", NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND(DOM_CLAIM), "", "Pink team has captured a control point");
627         dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
628 }
629
630 void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
631 {
632         // if no teams are found, spawn defaults
633         if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
634         {
635                 LOG_INFO("No ""dom_team"" entities found on this map, creating them anyway.\n");
636                 domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
637                 dom_spawnteams(domination_teams);
638         }
639
640         CheckAllowedTeams(world);
641         domination_teams = ((c4>=0) ? 4 : (c3>=0) ? 3 : 2);
642
643         addstat(STAT_DOM_TOTAL_PPS, AS_FLOAT, dom_total_pps);
644         addstat(STAT_DOM_PPS_RED, AS_FLOAT, dom_pps_red);
645         addstat(STAT_DOM_PPS_BLUE, AS_FLOAT, dom_pps_blue);
646         if(domination_teams >= 3) addstat(STAT_DOM_PPS_YELLOW, AS_FLOAT, dom_pps_yellow);
647         if(domination_teams >= 4) addstat(STAT_DOM_PPS_PINK, AS_FLOAT, dom_pps_pink);
648
649         domination_roundbased = autocvar_g_domination_roundbased;
650
651         ScoreRules_dom(domination_teams);
652
653         if(domination_roundbased)
654         {
655                 round_handler_Spawn(Domination_CheckPlayers, Domination_CheckWinner, Domination_RoundStart);
656                 round_handler_Init(5, autocvar_g_domination_warmup, autocvar_g_domination_round_timelimit);
657         }
658 }
659
660 void dom_Initialize()
661 {
662         InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE);
663 }
664
665
666 REGISTER_MUTATOR(dom, g_domination)
667 {
668         int fraglimit_override = autocvar_g_domination_point_limit;
669         if(autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
670                 fraglimit_override = autocvar_g_domination_roundbased_point_limit;
671
672         ActivateTeamplay();
673         SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, -1, -1);
674         have_team_spawns = -1; // request team spawns
675
676         MUTATOR_ONADD
677         {
678                 if(time > 1) // game loads at time 1
679                         error("This is a game type and it cannot be added at runtime.");
680                 dom_Initialize();
681         }
682
683         MUTATOR_ONREMOVE
684         {
685                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
686                 return -1;
687         }
688
689         return 0;
690 }