Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_tdm.qc
Go to the documentation of this file.
1#include "sv_tdm.qh"
2
3// TODO? rename to teamdeathmatch
6
7/*QUAKED spawnfunc_tdm_team (0 .5 .8) (-16 -16 -24) (16 16 32)
8Team declaration for TDM gameplay, this allows you to decide what team names and control point models are used in your map.
9Note: 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.
10Keys:
11"netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
12"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
13spawnfunc(tdm_team)
14{
15 if(!g_tdm || !this.cnt) { delete(this); return; }
16
17 this.team = this.cnt + 1;
18}
19
20// code from here on is just to support maps that don't have team entities
21void tdm_SpawnTeam (string teamname, int teamcolor)
22{
23 entity this = new_pure(tdm_team);
24 this.netname = teamname;
25 this.cnt = teamcolor - 1;
26 this.team = teamcolor;
27 this.spawnfunc_checked = true;
28 //spawnfunc_tdm_team(this);
29}
30
32{
33 // if no teams are found, spawn defaults
34 if(find(NULL, classname, "tdm_team") == NULL)
35 {
36 LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.");
37
38 int numteams = autocvar_g_tdm_teams_override;
39 if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
40
41 int teams = BITS(bound(2, numteams, 4));
42 if(teams & BIT(0))
44 if(teams & BIT(1))
46 if(teams & BIT(2))
47 tdm_SpawnTeam("Yellow", NUM_TEAM_3);
48 if(teams & BIT(3))
50 }
51}
52
62
67
68MUTATOR_HOOKFUNCTION(tdm, Scores_CountFragsRemaining)
69{
70 // announce remaining frags
71 return true;
72}
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
const int CBC_ORDER_EXCLUSIVE
Definition base.qh:12
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITS(n)
Definition bits.qh:9
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string netname
Definition powerups.qc:20
float cnt
Definition powerups.qc:24
int team
Definition main.qh:188
entity teams
Definition main.qh:58
#define M_ARGV(x, type)
Definition events.qh:17
const int INITPRIO_GAMETYPE
Definition constants.qh:94
string classname
#define LOG_TRACE(...)
Definition log.qh:76
float bound(float min, float value, float max)
entity find(entity start,.string field, string match)
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define NULL
Definition post.qh:14
bool spawnfunc_checked
Definition spawnfunc.qh:8
#define spawnfunc(id)
Definition spawnfunc.qh:96
void GameRules_limit_score(int limit)
Definition sv_rules.qc:23
void GameRules_teams(bool value)
Definition sv_rules.qc:3
void GameRules_limit_lead(int limit)
Definition sv_rules.qc:33
#define GameRules_spawning_teams(value)
Used to disable team spawns in team modes.
Definition sv_rules.qh:35
int autocvar_g_tdm_teams
Definition sv_tdm.qc:4
void tdm_SpawnTeam(string teamname, int teamcolor)
Definition sv_tdm.qc:21
void tdm_DelayedInit(entity this)
Definition sv_tdm.qc:31
void tdm_Initialize()
Definition sv_tdm.qc:53
int autocvar_g_tdm_teams_override
Definition sv_tdm.qc:5
int autocvar_g_tdm_point_limit
Definition sv_tdm.qh:4
int autocvar_g_tdm_point_leadlimit
Definition sv_tdm.qh:5
bool autocvar_g_tdm_team_spawns
Definition sv_tdm.qh:6
#define g_tdm
Definition tdm.qh:54
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
Definition teamplay.qc:459
const int NUM_TEAM_2
Definition teams.qh:14
const int NUM_TEAM_4
Definition teams.qh:16
const int NUM_TEAM_3
Definition teams.qh:15
const int NUM_TEAM_1
Definition teams.qh:13
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2209