1 /*QUAKED spawnfunc_tdm_team (0 .5 .8) (-16 -16 -24) (16 16 32)
2 Team declaration for TDM gameplay, this allows you to decide what team names and control point models are used in your map.
3 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.
5 "netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
6 "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
7 void spawnfunc_tdm_team()
9 if(!g_tdm) { remove(self); return; }
11 self.classname = "tdm_team";
12 self.team = self.cnt + 1;
15 // code from here on is just to support maps that don't have team entities
16 void tdm_SpawnTeam (string teamname, float teamcolor)
21 self.classname = "tdm_team";
22 self.netname = teamname;
30 void tdm_DelayedInit()
32 // if no teams are found, spawn defaults
33 if(find(world, classname, "tdm_team") == world)
35 print("No ""tdm_team"" entities found on this map, creating them anyway.\n");
37 float numteams = min(4, autocvar_g_tdm_teams_override);
39 if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
40 numteams = bound(2, numteams, 4);
43 for(i = 1; i <= numteams; ++i)
44 tdm_SpawnTeam(Team_ColorName(Team_NumberToTeam(i)), Team_NumberToTeam(i) - 1);
48 MUTATOR_HOOKFUNCTION(tdm_GetTeamCount)
50 ret_string = "tdm_team";
54 MUTATOR_DEFINITION(gamemode_tdm)
56 MUTATOR_HOOK(GetTeamCount, tdm_GetTeamCount, CBC_ORDER_ANY);
60 if(time > 1) // game loads at time 1
61 error("This is a game type and it cannot be added at runtime.");
62 InitializeEntity(world, tdm_DelayedInit, INITPRIO_GAMETYPE);
65 MUTATOR_ONROLLBACK_OR_REMOVE
67 // we actually cannot roll back tdm_Initialize here
68 // BUT: we don't need to! If this gets called, adding always
74 print("This is a game type and it cannot be removed at runtime.");