Xonotic
sv_domination.qc File Reference
+ Include dependency graph for sv_domination.qc:

Go to the source code of this file.

Functions

void AnimateDomPoint (entity this)
 
void dom_controlpoint_setup (entity this)
 
void dom_DelayedInit (entity this)
 
void dom_EventLog (string mode, float team_before, entity actor)
 
void dom_Initialize ()
 
void dom_spawnpoint (vector org)
 
void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
 
void dom_spawnteams (int teams)
 
bool Domination_CheckPlayers ()
 
bool Domination_CheckWinner ()
 
void Domination_count_controlpoints ()
 
void Domination_RoundStart ()
 
void dompoint_captured (entity this)
 
void dompointthink (entity this)
 
void dompointtouch (entity this, entity toucher)
 
void havocbot_goalrating_controlpoints (entity this, float ratingscale, vector org, float sradius)
 
void havocbot_role_dom (entity this)
 
 MUTATOR_HOOKFUNCTION (dom, TeamBalance_CheckAllowedTeams)
 
 MUTATOR_HOOKFUNCTION (dom, reset_map_players)
 
 MUTATOR_HOOKFUNCTION (dom, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION (dom, ClientConnect)
 
 MUTATOR_HOOKFUNCTION (dom, HavocBot_ChooseRole)
 
void ScoreRules_dom (int teams)
 
void set_dom_state (entity e)
 
 spawnfunc (dom_controlpoint)
 
 spawnfunc (dom_team)
 

Variables

int autocvar_g_domination_default_teams
 
bool autocvar_g_domination_disable_frags
 
int autocvar_g_domination_point_amt
 
bool autocvar_g_domination_point_fullbright
 
float autocvar_g_domination_point_rate
 
float autocvar_g_domination_round_timelimit
 
int autocvar_g_domination_teams_override
 
float autocvar_g_domination_warmup
 
bool g_domination
 
int total_control_points
 

Function Documentation

◆ AnimateDomPoint()

void AnimateDomPoint ( entity  this)

Definition at line 140 of file sv_domination.qc.

References frame, nextthink, pain_finished, t_length, t_width, and time.

Referenced by dompointthink().

141 {
142  if(this.pain_finished > time)
143  return;
144  this.pain_finished = time + this.t_width;
145  if(this.nextthink > this.pain_finished)
146  this.nextthink = this.pain_finished;
147 
148  this.frame = this.frame + 1;
149  if(this.frame > this.t_length)
150  this.frame = 0;
151 }
float nextthink
Definition: csprogsdefs.qc:121
float t_width
Definition: subs.qh:33
float pain_finished
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition: anim.qh:6
float t_length
Definition: subs.qh:33
float time
Definition: csprogsdefs.qc:16
+ Here is the caller graph for this function:

◆ dom_controlpoint_setup()

void dom_controlpoint_setup ( entity  this)

Definition at line 251 of file sv_domination.qc.

References autocvar_g_domination_point_amt, autocvar_g_domination_point_rate, classname, cnt, dompointthink(), dompointtouch(), droptofloor, entity(), find(), FL_ITEM, flags, frags, g_items, goalentity, IL_PUSH(), message, nextthink, NULL, objerror(), origin, setorigin(), setthink, skin, solid, SOLID_TRIGGER, sprite, t_length, t_width, time, total_pps, wait, and waypoint_spawnforitem().

Referenced by spawnfunc().

252 {
253  entity head;
254  // find the spawnfunc_dom_team representing unclaimed points
255  head = find(NULL, classname, "dom_team");
256  while(head && head.netname != "")
257  head = find(head, classname, "dom_team");
258  if (!head)
259  objerror(this, "no spawnfunc_dom_team with netname \"\" found\n");
260 
261  // copy important properties from spawnfunc_dom_team entity
262  this.goalentity = head;
263  _setmodel(this, head.mdl); // precision already set
264  this.skin = head.skin;
265 
266  this.cnt = -1;
267 
268  if(this.message == "")
269  this.message = " has captured a control point";
270 
271  if(this.frags <= 0)
272  this.frags = 1;
273  if(this.wait <= 0)
274  this.wait = 5;
275 
276  float points, waittime;
279  else
280  points = this.frags;
283  else
284  waittime = this.wait;
285 
286  total_pps += points/waittime;
287 
288  if(!this.t_width)
289  this.t_width = 0.02; // frame animation rate
290  if(!this.t_length)
291  this.t_length = 239; // maximum frame
292 
293  setthink(this, dompointthink);
294  this.nextthink = time;
295  settouch(this, dompointtouch);
296  this.solid = SOLID_TRIGGER;
297  if(!this.flags & FL_ITEM)
298  IL_PUSH(g_items, this);
299  this.flags = FL_ITEM;
300  setsize(this, '-32 -32 -32', '32 32 32');
301  setorigin(this, this.origin + '0 0 20');
302  droptofloor(this);
303 
304  waypoint_spawnforitem(this);
305  WaypointSprite_SpawnFixed(WP_DomNeut, this.origin + '0 0 32', this, sprite, RADARICON_DOMPOINT);
306 }
int autocvar_g_domination_point_amt
entity sprite
Definition: sv_assault.qc:11
skin
Definition: ent_cs.qc:143
entity() spawn
float autocvar_g_domination_point_rate
origin
Definition: ent_cs.qc:114
#define droptofloor
Definition: pre.qh:5
string classname
Definition: csprogsdefs.qc:107
float FL_ITEM
Definition: progsdefs.qc:239
float total_pps
float cnt
Definition: powerups.qc:24
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void dompointthink(entity this)
IntrusiveList g_items
Definition: items.qh:126
entity goalentity
Definition: progsdefs.qc:189
float wait
Definition: subs.qh:39
string message
Definition: powerups.qc:19
#define NULL
Definition: post.qh:17
frags
Definition: ent_cs.qc:151
float nextthink
Definition: csprogsdefs.qc:121
void dompointtouch(entity this, entity toucher)
float t_width
Definition: subs.qh:33
float flags
Definition: csprogsdefs.qc:129
const float SOLID_TRIGGER
Definition: csprogsdefs.qc:245
setorigin(ent, v)
#define setthink(e, f)
void waypoint_spawnforitem(entity e)
Definition: waypoints.qc:2007
float t_length
Definition: subs.qh:33
float time
Definition: csprogsdefs.qc:16
float solid
Definition: csprogsdefs.qc:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dom_DelayedInit()

void dom_DelayedInit ( entity  this)

Definition at line 608 of file sv_domination.qc.

References autocvar_g_domination_default_teams, autocvar_g_domination_round_timelimit, autocvar_g_domination_roundbased, autocvar_g_domination_teams_override, autocvar_g_domination_warmup, bound(), classname, dom_spawnteams(), Domination_CheckPlayers(), Domination_CheckWinner(), domination_roundbased, Domination_RoundStart(), domination_teams, entity(), find(), LOG_TRACE, NULL, round_handler_Init(), round_handler_Spawn(), ScoreRules_dom(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetAllowedTeams(), and teams.

Referenced by dom_Initialize().

609 {
610  // if no teams are found, spawn defaults
611  if(find(NULL, classname, "dom_team") == NULL || autocvar_g_domination_teams_override >= 2)
612  {
613  LOG_TRACE("No \"dom_team\" entities found on this map, creating them anyway.");
615  if (domination_teams < 2)
619  }
620 
622  int teams = TeamBalance_GetAllowedTeams(balance);
623  TeamBalance_Destroy(balance);
625 
627 
629 
631  {
634  }
635 }
void Domination_RoundStart()
float autocvar_g_domination_round_timelimit
void ScoreRules_dom(int teams)
void round_handler_Spawn(bool() canRoundStart_func, bool() canRoundEnd_func, void() roundStart_func)
bool autocvar_g_domination_roundbased
Definition: sv_domination.qh:5
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
Definition: teamplay.qc:627
entity() spawn
string classname
Definition: csprogsdefs.qc:107
int autocvar_g_domination_teams_override
entity teams
Definition: main.qh:44
float domination_teams
float domination_roundbased
int TeamBalance_GetAllowedTeams(entity balance)
Returns the bitmask of allowed teams.
Definition: teamplay.qc:640
#define NULL
Definition: post.qh:17
int autocvar_g_domination_default_teams
#define LOG_TRACE(...)
Definition: log.qh:81
float autocvar_g_domination_warmup
bool Domination_CheckWinner()
bool Domination_CheckPlayers()
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings...
Definition: teamplay.qc:487
void dom_spawnteams(int teams)
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dom_EventLog()

void dom_EventLog ( string  mode,
float  team_before,
entity  actor 
)

Definition at line 24 of file sv_domination.qc.

References autocvar_sv_eventlog, ftos(), GameLogEcho(), NULL, and strcat().

Referenced by dompoint_captured().

25 {
27  GameLogEcho(strcat(":dom:", mode, ":", ftos(team_before), ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
28 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define NULL
Definition: post.qh:17
void GameLogEcho(string s)
Definition: gamelog.qc:12
bool autocvar_sv_eventlog
Definition: gamelog.qh:3
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dom_Initialize()

void dom_Initialize ( )

Definition at line 637 of file sv_domination.qc.

References dom_DelayedInit(), g_domination, g_dompoints, IL_NEW, InitializeEntity(), and NULL.

Referenced by REGISTER_MUTATOR().

638 {
639  g_domination = true;
640  g_dompoints = IL_NEW();
641 
642  InitializeEntity(NULL, dom_DelayedInit, INITPRIO_GAMETYPE);
643 }
IntrusiveList g_dompoints
Definition: sv_domination.qh:9
#define IL_NEW()
bool g_domination
#define NULL
Definition: post.qh:17
void InitializeEntity(entity e, void(entity this) func, int order)
Definition: world.qc:2146
void dom_DelayedInit(entity this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dom_spawnpoint()

void dom_spawnpoint ( vector  org)

Definition at line 586 of file sv_domination.qc.

References entity(), setorigin(), setthink, spawn(), and time.

587 {
588  entity e = spawn();
589  setthink(e, spawnfunc_dom_controlpoint);
590  e.nextthink = time;
591  setorigin(e, org);
592  spawnfunc_dom_controlpoint(e);
593 }
entity() spawn
setorigin(ent, v)
#define setthink(e, f)
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:

◆ dom_spawnteam()

void dom_spawnteam ( string  teamname,
float  teamcolor,
string  pointmodel,
float  pointskin,
Sound  capsound,
string  capnarration,
string  capmessage 
)

Definition at line 562 of file sv_domination.qc.

References entity(), new_pure, Sound_fixpath, strzone(), and TC.

Referenced by dom_spawnteams().

563 {
564  TC(Sound, capsound);
565  entity e = new_pure(dom_team);
566  e.netname = strzone(teamname);
567  e.cnt = teamcolor;
568  e.model = pointmodel;
569  e.skin = pointskin;
570  e.noise = strzone(Sound_fixpath(capsound));
571  e.noise1 = strzone(capnarration);
572  e.message = strzone(capmessage);
573 
574  // this code is identical to spawnfunc_dom_team
575  _setmodel(e, e.model); // precision not needed
576  e.mdl = e.model;
577  e.dmg = e.modelindex;
578  e.model = "";
579  e.modelindex = 0;
580  // this would have to be changed if used in quakeworld
581  e.team = e.cnt + 1;
582 
583  //eprint(e);
584 }
#define Sound_fixpath(this)
Definition: sound.qh:141
entity() spawn
#define TC(T, sym)
Definition: _all.inc:82
Definition: sound.qh:119
#define new_pure(class)
purely logical entities (.origin doesn&#39;t work)
Definition: oo.qh:62
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dom_spawnteams()

void dom_spawnteams ( int  teams)

Definition at line 596 of file sv_domination.qc.

References dom_spawnteam(), NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, TC, and Team_ColoredFullName.

Referenced by dom_DelayedInit().

597 {
598  TC(int, teams);
599  dom_spawnteam(Team_ColoredFullName(NUM_TEAM_1), NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND_DOM_CLAIM, "", "Red team has captured a control point");
600  dom_spawnteam(Team_ColoredFullName(NUM_TEAM_2), NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND_DOM_CLAIM, "", "Blue team has captured a control point");
601  if(teams >= 3)
602  dom_spawnteam(Team_ColoredFullName(NUM_TEAM_3), NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND_DOM_CLAIM, "", "Yellow team has captured a control point");
603  if(teams >= 4)
604  dom_spawnteam(Team_ColoredFullName(NUM_TEAM_4), NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND_DOM_CLAIM, "", "Pink team has captured a control point");
605  dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
606 }
const int NUM_TEAM_2
Definition: teams.qh:19
entity teams
Definition: main.qh:44
#define TC(T, sym)
Definition: _all.inc:82
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
#define Team_ColoredFullName(teamid)
Definition: teams.qh:230
void dom_spawnteam(string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Domination_CheckPlayers()

bool Domination_CheckPlayers ( )

Definition at line 360 of file sv_domination.qc.

Referenced by dom_DelayedInit().

361 {
362  return true;
363 }
+ Here is the caller graph for this function:

◆ Domination_CheckWinner()

bool Domination_CheckWinner ( )

Definition at line 330 of file sv_domination.qc.

References APP_TEAM_NUM, autocvar_g_domination_round_timelimit, autocvar_g_domination_warmup, Domination_count_controlpoints(), NULL, round_handler_GetEndTime, round_handler_Init(), ST_DOM_CAPS, Team_GetWinnerTeam_WithOwnedItems(), TeamScore_AddToTeam(), time, and total_control_points.

Referenced by dom_DelayedInit().

331 {
333  {
334  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
335  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
336 
337  game_stopped = true;
339  return true;
340  }
341 
344  if (winner_team == -1)
345  return 0;
346 
347  if(winner_team > 0)
348  {
349  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
350  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
351  TeamScore_AddToTeam(winner_team, ST_DOM_CAPS, +1);
352  }
353 
354  game_stopped = true;
356 
357  return true;
358 }
int Team_GetWinnerTeam_WithOwnedItems(int min_control_points)
Returns the winner team.
Definition: teamplay.qc:123
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
float autocvar_g_domination_round_timelimit
void Domination_count_controlpoints()
const float ST_DOM_CAPS
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition: scores.qc:108
int total_control_points
#define NULL
Definition: post.qh:17
#define round_handler_GetEndTime()
float autocvar_g_domination_warmup
float time
Definition: csprogsdefs.qc:16
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Domination_count_controlpoints()

void Domination_count_controlpoints ( )

Definition at line 309 of file sv_domination.qc.

References entity(), Entity_GetTeam(), Entity_HasValidTeam(), g_dompoints, IL_EACH, NUM_TEAMS, Team_GetNumberOfOwnedItems(), Team_GetTeamFromIndex(), Team_SetNumberOfOwnedItems(), and total_control_points.

Referenced by Domination_CheckWinner().

310 {
312  for (int i = 1; i <= NUM_TEAMS; ++i)
313  {
315  }
316  IL_EACH(g_dompoints, true,
317  {
319  if (!Entity_HasValidTeam(it.goalentity))
320  {
321  continue;
322  }
323  entity team_ = Entity_GetTeam(it.goalentity);
324  int num_control_points = Team_GetNumberOfOwnedItems(team_);
325  ++num_control_points;
326  Team_SetNumberOfOwnedItems(team_, num_control_points);
327  });
328 }
const int NUM_TEAMS
Number of teams in the game.
Definition: teams.qh:3
#define IL_EACH(this, cond, body)
IntrusiveList g_dompoints
Definition: sv_domination.qh:9
entity() spawn
int total_control_points
int Team_GetNumberOfOwnedItems(entity team_ent)
Returns the number of items owned by a team.
Definition: teamplay.qc:138
entity Entity_GetTeam(entity this)
Returns the team entity of the given entity.
Definition: teamplay.qc:181
void Team_SetNumberOfOwnedItems(entity team_ent, int number)
Sets the number of items owned by a team.
Definition: teamplay.qc:143
bool Entity_HasValidTeam(entity this)
Returns whether the given entity belongs to a valid team.
Definition: teamplay.qc:171
entity Team_GetTeamFromIndex(int index)
Returns the global team entity at the given index.
Definition: teamplay.qc:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Domination_RoundStart()

void Domination_RoundStart ( )

Definition at line 365 of file sv_domination.qc.

References FOREACH_CLIENT, and IS_PLAYER.

Referenced by dom_DelayedInit().

366 {
367  FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; });
368 }
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the caller graph for this function:

◆ dompoint_captured()

void dompoint_captured ( entity  this)

Definition at line 41 of file sv_domination.qc.

References _sound, ATTEN_NORM, autocvar_g_domination_point_amt, autocvar_g_domination_point_rate, bprint(), captime, CH_TRIGGER, cnt, colormapPaletteColor, delay, dmg_inflictor, dom_EventLog(), domination_roundbased, enemy, entity(), FOREACH_CLIENT, frags, g_dompoints, GameRules_scoring_add, goalentity, IL_EACH, IS_REAL_CLIENT, model, modelindex, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, owner, pps_blue, pps_pink, pps_red, pps_yellow, set_dom_state(), skin, sprite, SUB_UseTargets(), team, time, total_pps, VOL_BASE, and wait.

Referenced by dompointtouch().

42 {
43  float old_delay, old_team, real_team;
44 
45  // now that the delay has expired, switch to the latest team to lay claim to this point
46  entity head = this.owner;
47 
48  real_team = this.cnt;
49  this.cnt = -1;
50 
51  dom_EventLog("taken", this.team, this.dmg_inflictor);
52  this.dmg_inflictor = NULL;
53 
54  this.goalentity = head;
55  this.model = head.mdl;
56  this.modelindex = head.dmg;
57  this.skin = head.skin;
58 
59  float points, wait_time;
62  else
63  points = this.frags;
66  else
67  wait_time = this.wait;
68 
70  bprint(sprintf("^3%s^3%s\n", head.netname, this.message));
71  else
72  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, this.message, points, wait_time);
73 
74  if(this.enemy.playerid == this.enemy_playerid)
75  GameRules_scoring_add(this.enemy, DOM_TAKES, 1);
76  else
77  this.enemy = NULL;
78 
79  if (head.noise != "")
80  {
81  if(this.enemy)
82  _sound(this.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
83  else
84  _sound(this, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
85  }
86  if (head.noise1 != "")
87  play2all(head.noise1);
88 
89  this.delay = time + wait_time;
90 
91  // do trigger work
92  old_delay = this.delay;
93  old_team = this.team;
94  this.team = real_team;
95  this.delay = 0;
96  SUB_UseTargets (this, this, NULL);
97  this.delay = old_delay;
98  this.team = old_team;
99 
100  entity msg = WP_DomNeut;
101  switch(real_team)
102  {
103  case NUM_TEAM_1: msg = WP_DomRed; break;
104  case NUM_TEAM_2: msg = WP_DomBlue; break;
105  case NUM_TEAM_3: msg = WP_DomYellow; break;
106  case NUM_TEAM_4: msg = WP_DomPink; break;
107  }
108 
109  WaypointSprite_UpdateSprites(this.sprite, msg, WP_Null, WP_Null);
110 
111  total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
112  IL_EACH(g_dompoints, true,
113  {
116  else
117  points = it.frags;
120  else
121  wait_time = it.wait;
122  switch(it.goalentity.team)
123  {
124  case NUM_TEAM_1: pps_red += points/wait_time; break;
125  case NUM_TEAM_2: pps_blue += points/wait_time; break;
126  case NUM_TEAM_3: pps_yellow += points/wait_time; break;
127  case NUM_TEAM_4: pps_pink += points/wait_time; break;
128  }
129  total_pps += points/wait_time;
130  });
131 
132  WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, colormapPaletteColor(this.goalentity.team - 1, 0));
133  WaypointSprite_Ping(this.sprite);
134 
135  this.captime = time;
136 
138 }
int autocvar_g_domination_point_amt
#define IL_EACH(this, cond, body)
entity sprite
Definition: sv_assault.qc:11
const int NUM_TEAM_2
Definition: teams.qh:19
skin
Definition: ent_cs.qc:143
IntrusiveList g_dompoints
Definition: sv_domination.qh:9
float modelindex
Definition: csprogsdefs.qc:91
int team
Definition: main.qh:157
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition: triggers.qc:366
float autocvar_g_domination_point_rate
float total_pps
entity owner
Definition: main.qh:73
string model
Definition: csprogsdefs.qc:108
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
float pps_yellow
float domination_roundbased
entity enemy
Definition: sv_ctf.qh:143
float cnt
Definition: powerups.qc:24
float pps_pink
entity dmg_inflictor
Definition: progsdefs.qc:200
void dom_EventLog(string mode, float team_before, entity actor)
const int CH_TRIGGER
Definition: sound.qh:12
entity goalentity
Definition: progsdefs.qc:189
float wait
Definition: subs.qh:39
float delay
Definition: subs.qh:38
#define NULL
Definition: post.qh:17
const float VOL_BASE
Definition: sound.qh:36
frags
Definition: ent_cs.qc:151
const float ATTEN_NORM
Definition: sound.qh:30
const int NUM_TEAM_4
Definition: teams.qh:21
float pps_red
#define _sound(e, c, s, v, a)
Definition: sound.qh:50
const int NUM_TEAM_1
Definition: teams.qh:18
float captime
void set_dom_state(entity e)
float time
Definition: csprogsdefs.qc:16
float pps_blue
#define colormapPaletteColor(c, isPants)
Definition: color.qh:5
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dompointthink()

void dompointthink ( entity  this)

Definition at line 153 of file sv_domination.qc.

References AnimateDomPoint(), autocvar_g_domination_point_amt, autocvar_g_domination_point_rate, delay, domination_roundbased, enemy, frags, GameRules_scoring_add, goalentity, nextthink, NULL, ST_DOM_TICKS, ST_SCORE, TeamScore_AddToTeam(), time, and wait.

Referenced by dom_controlpoint_setup().

154 {
155  float fragamt;
156 
157  this.nextthink = time + 0.1;
158 
159  //this.frame = this.frame + 1;
160  //if(this.frame > 119)
161  // this.frame = 0;
162  AnimateDomPoint(this);
163 
164  // give points
165 
166  if (game_stopped || this.delay > time || time < game_starttime) // game has ended, don't keep giving points
167  return;
168 
171  else
172  this.delay = time + this.wait;
173 
174  // give credit to the team
175  // NOTE: this defaults to 0
177  if (this.goalentity.netname != "")
178  {
181  else
182  fragamt = this.frags;
183  TeamScore_AddToTeam(this.goalentity.team, ST_SCORE, fragamt);
184  TeamScore_AddToTeam(this.goalentity.team, ST_DOM_TICKS, fragamt);
185 
186  // give credit to the individual player, if he is still there
187  if (this.enemy.playerid == this.enemy_playerid)
188  {
189  GameRules_scoring_add(this.enemy, SCORE, fragamt);
190  GameRules_scoring_add(this.enemy, DOM_TICKS, fragamt);
191  }
192  else
193  this.enemy = NULL;
194  }
195 }
int autocvar_g_domination_point_amt
const int ST_SCORE
Definition: scores.qh:151
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition: scores.qc:108
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
float autocvar_g_domination_point_rate
float domination_roundbased
entity enemy
Definition: sv_ctf.qh:143
entity goalentity
Definition: progsdefs.qc:189
float wait
Definition: subs.qh:39
float delay
Definition: subs.qh:38
#define NULL
Definition: post.qh:17
frags
Definition: ent_cs.qc:151
const float ST_DOM_TICKS
float nextthink
Definition: csprogsdefs.qc:121
float time
Definition: csprogsdefs.qc:16
void AnimateDomPoint(entity this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dompointtouch()

void dompointtouch ( entity  this,
entity  toucher 
)

Definition at line 197 of file sv_domination.qc.

References captime, classname, cnt, dmg_inflictor, dompoint_captured(), enemy, enemy_playerid, entity(), find(), GetResource(), goalentity, IS_PLAYER, model, modelindex, NULL, owner, RES_HEALTH, round_handler_IsActive, round_handler_IsRoundStarted, skin, sprite, team, and time.

Referenced by dom_controlpoint_setup().

198 {
199  if(!IS_PLAYER(toucher))
200  return;
201  if(GetResource(toucher, RES_HEALTH) < 1)
202  return;
203 
205  return;
206 
207  if(time < this.captime + 0.3)
208  return;
209 
210  // only valid teams can claim it
211  entity head = find(NULL, classname, "dom_team");
212  while (head && head.team != toucher.team)
213  head = find(head, classname, "dom_team");
214  if (!head || head.netname == "" || head == this.goalentity)
215  return;
216 
217  // delay capture
218 
219  this.team = this.goalentity.team; // this stores the PREVIOUS team!
220 
221  this.cnt = toucher.team;
222  this.owner = head; // team to switch to after the delay
223  this.dmg_inflictor = toucher;
224 
225  // this.state = 1;
226  // this.delay = time + cvar("g_domination_point_capturetime");
227  //this.nextthink = time + cvar("g_domination_point_capturetime");
228  //this.think = dompoint_captured;
229 
230  // go to neutral team in the mean time
231  head = find(NULL, classname, "dom_team");
232  while (head && head.netname != "")
233  head = find(head, classname, "dom_team");
234  if(head == NULL)
235  return;
236 
237  WaypointSprite_UpdateSprites(this.sprite, WP_DomNeut, WP_Null, WP_Null);
238  WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, '0 1 1');
239  WaypointSprite_Ping(this.sprite);
240 
241  this.goalentity = head;
242  this.model = head.mdl;
243  this.modelindex = head.dmg;
244  this.skin = head.skin;
245 
246  this.enemy = toucher; // individual player scoring
247  this.enemy_playerid = toucher.playerid;
248  dompoint_captured(this);
249 }
#define round_handler_IsActive()
entity sprite
Definition: sv_assault.qc:11
skin
Definition: ent_cs.qc:143
float modelindex
Definition: csprogsdefs.qc:91
int team
Definition: main.qh:157
entity() spawn
string classname
Definition: csprogsdefs.qc:107
#define round_handler_IsRoundStarted()
entity owner
Definition: main.qh:73
string model
Definition: csprogsdefs.qc:108
RES_HEALTH
Definition: ent_cs.qc:126
entity enemy
Definition: sv_ctf.qh:143
float cnt
Definition: powerups.qc:24
entity dmg_inflictor
Definition: progsdefs.qc:200
entity goalentity
Definition: progsdefs.qc:189
#define NULL
Definition: post.qh:17
void dompoint_captured(entity this)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
float captime
float enemy_playerid
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_goalrating_controlpoints()

void havocbot_goalrating_controlpoints ( entity  this,
float  ratingscale,
vector  org,
float  sradius 
)

Definition at line 371 of file sv_domination.qc.

References g_dompoints, IL_EACH, and vdist.

Referenced by havocbot_role_dom().

372 {
373  IL_EACH(g_dompoints, vdist((((it.absmin + it.absmax) * 0.5) - org), <, sradius),
374  {
375  if(it.cnt > -1) // this is just being fought
376  navigation_routerating(this, it, ratingscale, 5000);
377  else if(it.goalentity.cnt == 0) // unclaimed
378  navigation_routerating(this, it, ratingscale, 5000);
379  else if(it.goalentity.team != this.team) // other team's point
380  navigation_routerating(this, it, ratingscale, 5000);
381  });
382 }
#define IL_EACH(this, cond, body)
IntrusiveList g_dompoints
Definition: sv_domination.qh:9
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
+ Here is the caller graph for this function:

◆ havocbot_role_dom()

void havocbot_role_dom ( entity  this)

Definition at line 384 of file sv_domination.qc.

References havocbot_goalrating_controlpoints(), havocbot_goalrating_items(), havocbot_goalrating_waypoints(), IS_DEAD, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), and origin.

Referenced by MUTATOR_HOOKFUNCTION().

385 {
386  if(IS_DEAD(this))
387  return;
388 
390  {
392  havocbot_goalrating_controlpoints(this, 10000, this.origin, 15000);
393  havocbot_goalrating_items(this, 20000, this.origin, 8000);
394  //havocbot_goalrating_enemyplayers(this, 1500, this.origin, 2000);
395  havocbot_goalrating_waypoints(this, 1, this.origin, 3000);
397 
399  }
400 }
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:106
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
origin
Definition: ent_cs.qc:114
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius)
void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MUTATOR_HOOKFUNCTION() [1/5]

MUTATOR_HOOKFUNCTION ( dom  ,
TeamBalance_CheckAllowedTeams   
)

Definition at line 402 of file sv_domination.qc.

References classname, domination_teams, entity(), find(), M_ARGV, NULL, string_null, Team_IsValidTeam(), and Team_TeamToBit().

403 {
404  // fallback?
405  M_ARGV(0, float) = domination_teams;
406  string ret_string = "dom_team";
407 
408  entity head = find(NULL, classname, ret_string);
409  while(head)
410  {
411  if(head.netname != "")
412  {
413  if (Team_IsValidTeam(head.team))
414  {
415  M_ARGV(0, float) |= Team_TeamToBit(head.team);
416  }
417  }
418 
419  head = find(head, classname, ret_string);
420  }
421 
422  M_ARGV(1, string) = string_null;
423 
424  return true;
425 }
string string_null
Definition: nil.qh:9
entity() spawn
string classname
Definition: csprogsdefs.qc:107
float domination_teams
#define NULL
Definition: post.qh:17
#define M_ARGV(x, type)
Definition: events.qh:17
int Team_TeamToBit(int team_num)
Converts team value into bit value that is used in team bitmasks.
Definition: teams.qh:199
bool Team_IsValidTeam(int team_num)
Returns whether team value is valid.
Definition: teams.qh:133
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/5]

MUTATOR_HOOKFUNCTION ( dom  ,
reset_map_players   
)

Definition at line 427 of file sv_domination.qc.

References domination_roundbased, FOREACH_CLIENT, IS_PLAYER, IS_REAL_CLIENT, pps_blue, pps_pink, pps_red, pps_yellow, PutClientInServer(), set_dom_state(), and total_pps.

428 {
429  total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
431  PutClientInServer(it);
433  it.player_blocked = 1;
434  if(IS_REAL_CLIENT(it))
435  set_dom_state(it);
436  });
437  return true;
438 }
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
float total_pps
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
float pps_yellow
float domination_roundbased
float pps_pink
float pps_red
PutClientInServer(this)
void set_dom_state(entity e)
float pps_blue
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/5]

MUTATOR_HOOKFUNCTION ( dom  ,
PlayerSpawn   
)

Definition at line 440 of file sv_domination.qc.

References domination_roundbased, entity(), M_ARGV, and round_handler_IsRoundStarted.

441 {
442  entity player = M_ARGV(0, entity);
443 
445  player.player_blocked = !round_handler_IsRoundStarted();
446 }
entity() spawn
#define round_handler_IsRoundStarted()
float domination_roundbased
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [4/5]

MUTATOR_HOOKFUNCTION ( dom  ,
ClientConnect   
)

Definition at line 448 of file sv_domination.qc.

References entity(), M_ARGV, and set_dom_state().

449 {
450  entity player = M_ARGV(0, entity);
451 
452  set_dom_state(player);
453 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void set_dom_state(entity e)
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [5/5]

MUTATOR_HOOKFUNCTION ( dom  ,
HavocBot_ChooseRole   
)

Definition at line 455 of file sv_domination.qc.

References entity(), havocbot_role_dom(), and M_ARGV.

456 {
457  entity bot = M_ARGV(0, entity);
458 
459  bot.havocbot_role = havocbot_role_dom;
460  return true;
461 }
entity() spawn
void havocbot_role_dom(entity this)
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ ScoreRules_dom()

void ScoreRules_dom ( int  teams)

Definition at line 536 of file sv_domination.qc.

References autocvar_g_domination_disable_frags, domination_roundbased, GameRules_scoring, SFL_SORT_PRIO_PRIMARY, ST_DOM_CAPS, and ST_DOM_TICKS.

Referenced by dom_DelayedInit().

537 {
539  {
541  field_team(ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
542  field(SP_DOM_TAKES, "takes", 0);
543  });
544  }
545  else
546  {
547  float sp_domticks, sp_score;
548  sp_score = sp_domticks = 0;
550  sp_domticks = SFL_SORT_PRIO_PRIMARY;
551  else
552  sp_score = SFL_SORT_PRIO_PRIMARY;
553  GameRules_scoring(teams, sp_score, sp_score, {
554  field_team(ST_DOM_TICKS, "ticks", sp_domticks);
555  field(SP_DOM_TICKS, "ticks", sp_domticks);
556  field(SP_DOM_TAKES, "takes", 0);
557  });
558  }
559 }
bool autocvar_g_domination_disable_frags
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition: sv_rules.qh:53
const float ST_DOM_CAPS
const int SFL_SORT_PRIO_PRIMARY
Definition: scores.qh:127
entity teams
Definition: main.qh:44
float domination_roundbased
const float ST_DOM_TICKS
+ Here is the caller graph for this function:

◆ set_dom_state()

void set_dom_state ( entity  e)

Definition at line 30 of file sv_domination.qc.

References domination_teams, pps_blue, pps_pink, pps_red, pps_yellow, and total_pps.

Referenced by dompoint_captured(), and MUTATOR_HOOKFUNCTION().

31 {
32  STAT(DOM_TOTAL_PPS, e) = total_pps;
33  STAT(DOM_PPS_RED, e) = pps_red;
34  STAT(DOM_PPS_BLUE, e) = pps_blue;
35  if(domination_teams >= 3)
36  STAT(DOM_PPS_YELLOW, e) = pps_yellow;
37  if(domination_teams >= 4)
38  STAT(DOM_PPS_PINK, e) = pps_pink;
39 }
float total_pps
float pps_yellow
float domination_teams
float pps_pink
float pps_red
float pps_blue
+ Here is the caller graph for this function:

◆ spawnfunc() [1/2]

spawnfunc ( dom_controlpoint  )

Definition at line 466 of file sv_domination.qc.

References autocvar_g_domination_point_fullbright, dom_controlpoint_setup(), EF_FULLBRIGHT, EF_LOWPRECISION, effects, g_domination, g_dompoints, IL_PUSH(), nextthink, scale, setthink, and time.

467 {
468  if(!g_domination)
469  {
470  delete(this);
471  return;
472  }
474  this.nextthink = time + 0.1;
475  this.reset = dom_controlpoint_setup;
476 
477  if(!this.scale)
478  this.scale = 0.6;
479 
480  this.effects = this.effects | EF_LOWPRECISION;
482  this.effects |= EF_FULLBRIGHT;
483 
484  IL_PUSH(g_dompoints, this);
485 }
IntrusiveList g_dompoints
Definition: sv_domination.qh:9
bool autocvar_g_domination_point_fullbright
float effects
Definition: csprogsdefs.qc:111
bool g_domination
const float EF_FULLBRIGHT
Definition: csprogsdefs.qc:303
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float nextthink
Definition: csprogsdefs.qc:121
float scale
Definition: projectile.qc:14
#define setthink(e, f)
float time
Definition: csprogsdefs.qc:16
void dom_controlpoint_setup(entity this)
float EF_LOWPRECISION
+ Here is the call graph for this function:

◆ spawnfunc() [2/2]

spawnfunc ( dom_team  )

Definition at line 513 of file sv_domination.qc.

References autocvar_g_domination_teams_override, cnt, dmg, g_domination, model, modelindex, noise, noise1, precache_sound(), and team.

514 {
516  {
517  delete(this);
518  return;
519  }
520  precache_model(this.model);
521  if (this.noise != "")
522  precache_sound(this.noise);
523  if (this.noise1 != "")
524  precache_sound(this.noise1);
525  _setmodel(this, this.model); // precision not needed
526  this.mdl = this.model;
527  this.dmg = this.modelindex;
528  this.model = "";
529  this.modelindex = 0;
530  // this would have to be changed if used in quakeworld
531  if(this.cnt)
532  this.team = this.cnt + 1; // WHY are these different anyway?
533 }
string noise
Definition: progsdefs.qc:209
float modelindex
Definition: csprogsdefs.qc:91
int team
Definition: main.qh:157
float dmg
Definition: platforms.qh:6
int autocvar_g_domination_teams_override
string model
Definition: csprogsdefs.qc:108
bool g_domination
float cnt
Definition: powerups.qc:24
string noise1
Definition: progsdefs.qc:209
+ Here is the call graph for this function:

Variable Documentation

◆ autocvar_g_domination_default_teams

int autocvar_g_domination_default_teams

Definition at line 15 of file sv_domination.qc.

Referenced by dom_DelayedInit().

◆ autocvar_g_domination_disable_frags

bool autocvar_g_domination_disable_frags

Definition at line 16 of file sv_domination.qc.

Referenced by ScoreRules_dom().

◆ autocvar_g_domination_point_amt

int autocvar_g_domination_point_amt

Definition at line 17 of file sv_domination.qc.

Referenced by dom_controlpoint_setup(), dompoint_captured(), and dompointthink().

◆ autocvar_g_domination_point_fullbright

bool autocvar_g_domination_point_fullbright

Definition at line 18 of file sv_domination.qc.

Referenced by spawnfunc().

◆ autocvar_g_domination_point_rate

float autocvar_g_domination_point_rate

Definition at line 21 of file sv_domination.qc.

Referenced by dom_controlpoint_setup(), dompoint_captured(), and dompointthink().

◆ autocvar_g_domination_round_timelimit

float autocvar_g_domination_round_timelimit

Definition at line 19 of file sv_domination.qc.

Referenced by dom_DelayedInit(), and Domination_CheckWinner().

◆ autocvar_g_domination_teams_override

int autocvar_g_domination_teams_override

Definition at line 22 of file sv_domination.qc.

Referenced by dom_DelayedInit(), and spawnfunc().

◆ autocvar_g_domination_warmup

float autocvar_g_domination_warmup

Definition at line 20 of file sv_domination.qc.

Referenced by dom_DelayedInit(), and Domination_CheckWinner().

◆ g_domination

bool g_domination

Definition at line 13 of file sv_domination.qc.

Referenced by dom_Initialize(), and spawnfunc().

◆ total_control_points

int total_control_points

Definition at line 308 of file sv_domination.qc.

Referenced by Domination_CheckWinner(), and Domination_count_controlpoints().