4 int autocvar_g_tdm_point_limit;
5 int autocvar_g_tdm_point_leadlimit;
6 bool autocvar_g_tdm_team_spawns;
7 void tdm_DelayedInit();
9 REGISTER_MUTATOR(tdm, false)
13 if (time > 1) // game loads at time 1
14 error("This is a game type and it cannot be added at runtime.");
15 InitializeEntity(world, tdm_DelayedInit, INITPRIO_GAMETYPE);
18 SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, -1, -1);
19 if (autocvar_g_tdm_team_spawns)
20 have_team_spawns = -1; // request team spawns
23 MUTATOR_ONROLLBACK_OR_REMOVE
25 // we actually cannot roll back tdm_Initialize here
26 // BUT: we don't need to! If this gets called, adding always
32 LOG_INFO("This is a game type and it cannot be removed at runtime.");
42 int autocvar_g_tdm_teams;
43 int autocvar_g_tdm_teams_override;
45 /*QUAKED spawnfunc_tdm_team (0 .5 .8) (-16 -16 -24) (16 16 32)
46 Team declaration for TDM gameplay, this allows you to decide what team names and control point models are used in your map.
47 Note: If you use spawnfunc_tdm_team entities you must define at least 2! However, unlike domination, you don't need to make a blank one too.
49 "netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
50 "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
53 if(!g_tdm || !self.cnt) { remove(self); return; }
55 self.classname = "tdm_team";
56 self.team = self.cnt + 1;
59 // code from here on is just to support maps that don't have team entities
60 void tdm_SpawnTeam (string teamname, float teamcolor)
62 entity this = new(tdm_team);
63 this.netname = teamname;
65 this.spawnfunc_checked = true;
66 WITH(entity, self, this, spawnfunc_tdm_team(this));
69 void tdm_DelayedInit()
71 // if no teams are found, spawn defaults
72 if(find(world, classname, "tdm_team") == world)
74 LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.\n");
76 int numteams = min(4, autocvar_g_tdm_teams_override);
78 if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
79 numteams = bound(2, numteams, 4);
82 for(i = 1; i <= numteams; ++i)
83 tdm_SpawnTeam(Team_ColorName(Team_NumberToTeam(i)), Team_NumberToTeam(i) - 1);
87 MUTATOR_HOOKFUNCTION(tdm, GetTeamCount, CBC_ORDER_EXCLUSIVE)
89 ret_string = "tdm_team";
93 MUTATOR_HOOKFUNCTION(tdm, Scores_CountFragsRemaining)
95 // announce remaining frags