Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_domination.qc File Reference
Include dependency graph for sv_domination.qc:
This graph shows which files directly or indirectly include this file:

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, ClientConnect)
 MUTATOR_HOOKFUNCTION (dom, HavocBot_ChooseRole)
 MUTATOR_HOOKFUNCTION (dom, PlayerSpawn)
 MUTATOR_HOOKFUNCTION (dom, reset_map_players)
void ScoreRules_dom (int teams)
void set_dom_state (entity e)
 spawnfunc (dom_controlpoint)
 spawnfunc (dom_team)
 spawnfunc (team_dom_point)

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 143 of file sv_domination.qc.

144{
145 if(this.pain_finished > time)
146 return;
147 this.pain_finished = time + this.t_width;
148 if(this.nextthink > this.pain_finished)
149 this.nextthink = this.pain_finished;
150
151 ++this.frame;
152 if(this.frame > this.t_length)
153 this.frame = 0;
154}
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
float pain_finished
float time
float nextthink
float t_width
Definition subs.qh:33
float t_length
Definition subs.qh:33

References entity(), frame, nextthink, pain_finished, t_length, t_width, and time.

Referenced by dompointthink().

◆ dom_controlpoint_setup()

void dom_controlpoint_setup ( entity this)

Definition at line 256 of file sv_domination.qc.

257{
258 entity head;
259 // find the spawnfunc_dom_team representing unclaimed points
260 head = find(NULL, classname, "dom_team");
261 while(head && head.netname != "")
262 head = find(head, classname, "dom_team");
263 if (!head)
264 objerror(this, "no spawnfunc_dom_team with netname \"\" found\n");
265
266 // copy important properties from spawnfunc_dom_team entity
267 this.goalentity = head;
268 _setmodel(this, head.mdl); // precision already set
269 this.skin = head.skin;
270
271 this.cnt = -1;
272
273 if(this.message == "")
274 this.message = " has captured a control point";
275
276 if(this.frags <= 0)
277 this.frags = 1;
278 if(this.wait <= 0)
279 this.wait = 5;
280
281 float points, waittime;
284 else
285 points = this.frags;
288 else
289 waittime = this.wait;
290
291 total_pps += points/waittime;
292
293 if(!this.t_width)
294 this.t_width = 0.02; // frame animation rate
295 if(!this.t_length)
296 this.t_length = 239; // maximum frame
297
298 setthink(this, dompointthink);
299 this.nextthink = time;
300 settouch(this, dompointtouch);
301 this.solid = SOLID_TRIGGER;
302 if(!this.flags & FL_ITEM)
303 IL_PUSH(g_items, this);
304 this.flags = FL_ITEM;
305 setsize(this, '-48 -48 -32', '48 48 32'); // 0.8.6 used '-32 -32 -32', '32 32 32' with sv_legacy_bbox_expand 1 and FL_ITEM
306 setorigin(this, this.origin + '0 0 20');
308
310 WaypointSprite_SpawnFixed(WP_DomNeut, this.origin + '0 0 32', this, sprite, RADARICON_DOMPOINT);
311}
void waypoint_spawnforitem(entity e)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float cnt
Definition powerups.qc:24
string message
Definition powerups.qc:19
float wait
Definition items.qc:17
const int FL_ITEM
Definition constants.qh:69
string classname
float flags
const float SOLID_TRIGGER
vector origin
float solid
skin
Definition ent_cs.qc:168
int frags
Definition ent_cs.qh:67
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
entity goalentity
Definition viewloc.qh:16
entity find(entity start,.string field, string match)
#define NULL
Definition post.qh:14
#define objerror
Definition pre.qh:8
#define setthink(e, f)
#define settouch(e, f)
Definition self.qh:77
IntrusiveList g_items
Definition items.qh:119
entity sprite
Definition sv_assault.qc:11
int autocvar_g_domination_point_amt
void dompointtouch(entity this, entity toucher)
float autocvar_g_domination_point_rate
void dompointthink(entity this)
float total_pps
entity WaypointSprite_SpawnFixed(entity spr, vector ofs, entity own,.entity ownfield, entity icon)
void DropToFloor_QC_DelayedInit(entity this)
Definition world.qc:2425

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

Referenced by spawnfunc().

◆ dom_DelayedInit()

void dom_DelayedInit ( entity this)

Definition at line 608 of file sv_domination.qc.

609{
610 int domination_teams = 0;
611
613 {
614 entity head = findchain(classname, "dom_team");
615 while (head)
616 {
617 if (Team_IsValidTeam(head.team))
618 domination_teams |= Team_TeamToBit(head.team);
619 head = head.chain;
620 }
621 }
622 // if no teams are found, spawn defaults
623 if (!domination_teams)
624 {
625 LOG_TRACE("No \"dom_team\" entities found on this map, creating them anyway.");
627 domination_teams = BITS(bound(2, domination_teams, 4));
628 dom_spawnteams(domination_teams);
629 }
630
632
633 ScoreRules_dom(domination_teams);
634
636 {
639 }
640}
#define BITS(n)
Definition bits.qh:9
#define LOG_TRACE(...)
Definition log.qh:74
float bound(float min, float value, float max)
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
void round_handler_Spawn(bool() canRoundStart_func, bool() canRoundEnd_func, void() roundStart_func)
float autocvar_g_domination_round_timelimit
int autocvar_g_domination_default_teams
void Domination_RoundStart()
void dom_spawnteams(int teams)
bool Domination_CheckPlayers()
void ScoreRules_dom(int teams)
int autocvar_g_domination_teams_override
bool Domination_CheckWinner()
float autocvar_g_domination_warmup
float domination_roundbased
bool autocvar_g_domination_roundbased
bool Team_IsValidTeam(int team_num)
Returns whether team value is valid.
Definition teams.qh:133
int Team_TeamToBit(int team_num)
Converts team value into bit value that is used in team bitmasks.
Definition teams.qh:199

References autocvar_g_domination_default_teams, autocvar_g_domination_round_timelimit, autocvar_g_domination_roundbased, autocvar_g_domination_teams_override, autocvar_g_domination_warmup, BITS, bound(), classname, dom_spawnteams(), Domination_CheckPlayers(), Domination_CheckWinner(), domination_roundbased, Domination_RoundStart(), entity(), LOG_TRACE, round_handler_Init(), round_handler_Spawn(), ScoreRules_dom(), Team_IsValidTeam(), and Team_TeamToBit().

Referenced by dom_Initialize().

◆ dom_EventLog()

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

Definition at line 24 of file sv_domination.qc.

25{
27 GameLogEcho(strcat(":dom:", mode, ":", ftos(team_before), ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
28}
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

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

Referenced by dompoint_captured().

◆ dom_Initialize()

void dom_Initialize ( )

Definition at line 642 of file sv_domination.qc.

643{
644 g_domination = true;
646
648}
const int INITPRIO_GAMETYPE
Definition constants.qh:86
#define IL_NEW()
void dom_DelayedInit(entity this)
bool g_domination
IntrusiveList g_dompoints
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2227

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

Referenced by REGISTER_MUTATOR().

◆ dom_spawnpoint()

void dom_spawnpoint ( vector org)

Definition at line 586 of file sv_domination.qc.

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}
#define spawn
vector org
Definition self.qh:96

References entity(), org, setthink, spawn, time, and vector.

◆ 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.

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 TC(T, sym)
Definition _all.inc:82
string strzone(string s)
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:66
#define Sound_fixpath(this)
Definition sound.qh:141

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

Referenced by dom_spawnteams().

◆ dom_spawnteams()

void dom_spawnteams ( int teams)

Definition at line 596 of file sv_domination.qc.

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 & BIT(2))
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 & BIT(3))
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}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
entity teams
Definition main.qh:58
void dom_spawnteam(string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
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
#define Team_ColoredFullName(teamid)
Definition teams.qh:232
const int NUM_TEAM_1
Definition teams.qh:13

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

Referenced by dom_DelayedInit().

◆ Domination_CheckPlayers()

bool Domination_CheckPlayers ( )

Definition at line 365 of file sv_domination.qc.

366{
367 return true;
368}

Referenced by dom_DelayedInit().

◆ Domination_CheckWinner()

bool Domination_CheckWinner ( )

Definition at line 335 of file sv_domination.qc.

336{
338 {
339 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
340 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
341
342 game_stopped = true;
344 return true;
345 }
346
349 if (winner_team == -1)
350 return 0;
351
352 if(winner_team > 0)
353 {
354 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
355 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
356 TeamScore_AddToTeam(winner_team, ST_DOM_CAPS, +1);
357 }
358
359 game_stopped = true;
361
362 return true;
363}
float game_stopped
Definition stats.qh:81
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500
#define APP_TEAM_NUM(num, prefix)
Definition all.qh:88
#define round_handler_GetEndTime()
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition scores.qc:108
void Domination_count_controlpoints()
int total_control_points
const float ST_DOM_CAPS
int Team_GetWinnerTeam_WithOwnedItems(int min_control_points)
Returns the winner team.
Definition teamplay.qc:152

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

Referenced by dom_DelayedInit().

◆ Domination_count_controlpoints()

void Domination_count_controlpoints ( )

Definition at line 314 of file sv_domination.qc.

315{
317 for (int i = 1; i <= AVAILABLE_TEAMS; ++i)
318 {
320 }
321 IL_EACH(g_dompoints, true,
322 {
324 if (!Entity_HasValidTeam(it.goalentity))
325 {
326 continue;
327 }
328 entity team_ = Entity_GetTeam(it.goalentity);
329 int num_control_points = Team_GetNumberOfOwnedItems(team_);
330 ++num_control_points;
331 Team_SetNumberOfOwnedItems(team_, num_control_points);
332 });
333}
#define IL_EACH(this, cond, body)
#define AVAILABLE_TEAMS
Number of teams that exist currently.
entity Entity_GetTeam(entity this)
Returns the team entity of the given entity.
Definition teamplay.qc:215
void Team_SetNumberOfOwnedItems(entity team_ent, int number)
Sets the number of items owned by a team.
Definition teamplay.qc:172
int Team_GetNumberOfOwnedItems(entity team_ent)
Returns the number of items owned by a team.
Definition teamplay.qc:167
bool Entity_HasValidTeam(entity this)
Returns whether the given entity belongs to a valid team.
Definition teamplay.qc:205
entity Team_GetTeamFromIndex(int index)
Returns the global team entity at the given index.
Definition teamplay.qc:86

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

Referenced by Domination_CheckWinner().

◆ Domination_RoundStart()

void Domination_RoundStart ( )

Definition at line 370 of file sv_domination.qc.

371{
372 FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; });
373}
#define IS_PLAYER(s)
Definition player.qh:242
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References FOREACH_CLIENT, and IS_PLAYER.

Referenced by dom_DelayedInit().

◆ dompoint_captured()

void dompoint_captured ( entity this)

Definition at line 41 of file sv_domination.qc.

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 vector expcol = Team_ColorRGB(real_team);
112 Send_Effect_Core(EFFECT_DOM_CAPTURE, this.origin, '0 0 0', 1, expcol, expcol * 0.6 + '0.4 0.4 0.4', -1, -1, -1, NULL);
113
114 total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
115 IL_EACH(g_dompoints, true,
116 {
119 else
120 points = it.frags;
123 else
124 wait_time = it.wait;
125 switch(it.goalentity.team)
126 {
127 case NUM_TEAM_1: pps_red += points/wait_time; break;
128 case NUM_TEAM_2: pps_blue += points/wait_time; break;
129 case NUM_TEAM_3: pps_yellow += points/wait_time; break;
130 case NUM_TEAM_4: pps_pink += points/wait_time; break;
131 }
132 total_pps += points/wait_time;
133 });
134
135 WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, colormapPaletteColor(this.goalentity.team - 1, 0));
137
138 this.captime = time;
139
141}
float delay
Definition items.qc:17
entity owner
Definition main.qh:87
int team
Definition main.qh:188
#define colormapPaletteColor(c, isPants)
Definition color.qh:5
float modelindex
void Send_Effect_Core(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, vector eff_col_min, vector eff_col_max, float eff_alpha_min, float eff_alpha_max, float eff_alpha_fade, entity ignore)
Definition all.qc:74
model
Definition ent_cs.qc:164
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
void bprint(string text,...)
entity dmg_inflictor
Definition progsdefs.qc:200
vector
Definition self.qh:96
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
void play2all(string samp)
Definition all.qc:142
entity enemy
Definition sv_ctf.qh:152
void set_dom_state(entity e)
void dom_EventLog(string mode, float team_before, entity actor)
float pps_blue
float pps_yellow
float pps_pink
float pps_red
float captime
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
void WaypointSprite_UpdateTeamRadar(entity e, entity icon, vector col)
void WaypointSprite_UpdateSprites(entity e, entity _m1, entity _m2, entity _m3)
void WaypointSprite_Ping(entity e)

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, origin, owner, play2all(), pps_blue, pps_pink, pps_red, pps_yellow, Send_Effect_Core(), Send_Notification(), set_dom_state(), skin, sprite, SUB_UseTargets(), team, Team_ColorRGB(), time, total_pps, vector, VOL_BASE, wait, WaypointSprite_Ping(), WaypointSprite_UpdateSprites(), and WaypointSprite_UpdateTeamRadar().

Referenced by dompointtouch().

◆ dompointthink()

void dompointthink ( entity this)

Definition at line 156 of file sv_domination.qc.

157{
158 float fragamt;
159
160 this.nextthink = time + 0.1;
161
162 //++this.frame;
163 //if(this.frame > 119)
164 // this.frame = 0;
165 AnimateDomPoint(this);
166
167 // give points
168
169 if (game_stopped || this.delay > time || time < game_starttime) // game has ended, don't keep giving points
170 return;
171
174 else
175 this.delay = time + this.wait;
176
177 // give credit to the team
178 // NOTE: this defaults to 0
180 if (this.goalentity.netname != "")
181 {
184 else
185 fragamt = this.frags;
186 TeamScore_AddToTeam(this.goalentity.team, ST_SCORE, fragamt);
187 TeamScore_AddToTeam(this.goalentity.team, ST_DOM_TICKS, fragamt);
188
189 // give credit to the individual player, if they are still there
190 if (this.enemy.playerid == this.enemy_playerid)
191 {
192 GameRules_scoring_add(this.enemy, SCORE, fragamt);
193 GameRules_scoring_add(this.enemy, DOM_TICKS, fragamt);
194 }
195 else
196 this.enemy = NULL;
197 }
198}
const int ST_SCORE
Definition scores.qh:158
float game_starttime
Definition stats.qh:82
void AnimateDomPoint(entity this)
const float ST_DOM_TICKS

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

Referenced by dom_controlpoint_setup().

◆ dompointtouch()

void dompointtouch ( entity this,
entity toucher )

Definition at line 200 of file sv_domination.qc.

201{
202 if(!IS_PLAYER(toucher))
203 return;
204 if(IS_DEAD(toucher))
205 return;
207 return;
208
210 return;
211
212 if(time < this.captime + 0.3)
213 return;
214
215 // only valid teams can claim it
216 entity head = find(NULL, classname, "dom_team");
217 while (head && head.team != toucher.team)
218 head = find(head, classname, "dom_team");
219 if (!head || head.netname == "" || head == this.goalentity)
220 return;
221
222 // delay capture
223
224 this.team = this.goalentity.team; // this stores the PREVIOUS team!
225
226 this.cnt = toucher.team;
227 this.owner = head; // team to switch to after the delay
228 this.dmg_inflictor = toucher;
229
230 // this.state = 1;
231 // this.delay = time + cvar("g_domination_point_capturetime");
232 //this.nextthink = time + cvar("g_domination_point_capturetime");
233 //this.think = dompoint_captured;
234
235 // go to neutral team in the mean time
236 head = find(NULL, classname, "dom_team");
237 while (head && head.netname != "")
238 head = find(head, classname, "dom_team");
239 if(head == NULL)
240 return;
241
242 WaypointSprite_UpdateSprites(this.sprite, WP_DomNeut, WP_Null, WP_Null);
243 WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, '0 1 1');
245
246 this.goalentity = head;
247 this.model = head.mdl;
248 this.modelindex = head.dmg;
249 this.skin = head.skin;
250
251 this.enemy = toucher; // individual player scoring
252 this.enemy_playerid = toucher.playerid;
253 dompoint_captured(this);
254}
#define IS_DEAD(s)
Definition player.qh:244
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
entity entity toucher
Definition self.qh:76
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
void dompoint_captured(entity this)
float enemy_playerid

References captime, classname, cnt, dmg_inflictor, dompoint_captured(), enemy, enemy_playerid, entity(), find(), goalentity, IS_DEAD, IS_INDEPENDENT_PLAYER, IS_PLAYER, model, modelindex, NULL, owner, round_handler_IsActive, round_handler_IsRoundStarted, skin, sprite, team, time, toucher, WaypointSprite_Ping(), WaypointSprite_UpdateSprites(), and WaypointSprite_UpdateTeamRadar().

Referenced by dom_controlpoint_setup().

◆ havocbot_goalrating_controlpoints()

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

Definition at line 376 of file sv_domination.qc.

377{
378 IL_EACH(g_dompoints, vdist((((it.absmin + it.absmax) * 0.5) - org), <, sradius),
379 {
380 if(it.cnt > -1) // this is just being fought
381 navigation_routerating(this, it, ratingscale, 5000);
382 else if(it.goalentity.cnt == 0) // unclaimed
383 navigation_routerating(this, it, ratingscale, 5000);
384 else if(it.goalentity.team != this.team) // other team's point
385 navigation_routerating(this, it, ratingscale, 5000);
386 });
387}
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8

References entity(), g_dompoints, IL_EACH, org, vdist, and vector.

Referenced by havocbot_role_dom().

◆ havocbot_role_dom()

void havocbot_role_dom ( entity this)

Definition at line 389 of file sv_domination.qc.

390{
391 if(IS_DEAD(this))
392 return;
393
395 {
397 havocbot_goalrating_controlpoints(this, 10000, this.origin, 15000);
398 havocbot_goalrating_items(this, 20000, this.origin, 8000);
399 //havocbot_goalrating_enemyplayers(this, 1500, this.origin, 2000);
400 havocbot_goalrating_waypoints(this, 1, this.origin, 3000);
402
404 }
405}
void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
Definition roles.qc:16
void navigation_goalrating_start(entity this)
void navigation_goalrating_timeout_set(entity this)
Definition navigation.qc:20
bool navigation_goalrating_timeout(entity this)
Definition navigation.qc:44
void navigation_goalrating_end(entity this)
void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius)
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition roles.qc:106

References entity(), 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().

◆ MUTATOR_HOOKFUNCTION() [1/4]

MUTATOR_HOOKFUNCTION ( dom ,
ClientConnect  )

Definition at line 431 of file sv_domination.qc.

432{
433 entity player = M_ARGV(0, entity);
434
435 set_dom_state(player);
436}
#define M_ARGV(x, type)
Definition events.qh:17

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

◆ MUTATOR_HOOKFUNCTION() [2/4]

MUTATOR_HOOKFUNCTION ( dom ,
HavocBot_ChooseRole  )

Definition at line 438 of file sv_domination.qc.

439{
440 entity bot = M_ARGV(0, entity);
441
442 bot.havocbot_role = havocbot_role_dom;
443 return true;
444}
void havocbot_role_dom(entity this)

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

◆ MUTATOR_HOOKFUNCTION() [3/4]

MUTATOR_HOOKFUNCTION ( dom ,
PlayerSpawn  )

Definition at line 423 of file sv_domination.qc.

424{
425 entity player = M_ARGV(0, entity);
426
428 player.player_blocked = !round_handler_IsRoundStarted();
429}

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

◆ MUTATOR_HOOKFUNCTION() [4/4]

MUTATOR_HOOKFUNCTION ( dom ,
reset_map_players  )

Definition at line 407 of file sv_domination.qc.

408{
409 total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
410 FOREACH_CLIENT(true, {
411 if (IS_PLAYER(it))
412 {
415 it.player_blocked = 1;
416 }
417 if(IS_REAL_CLIENT(it))
418 set_dom_state(it);
419 });
420 return true;
421}
#define PutClientInServer
Definition _all.inc:250

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.

◆ ScoreRules_dom()

void ScoreRules_dom ( int teams)

Definition at line 536 of file sv_domination.qc.

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}
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
bool autocvar_g_domination_disable_frags
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition sv_rules.qh:58

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

Referenced by dom_DelayedInit().

◆ set_dom_state()

void set_dom_state ( entity e)

Definition at line 30 of file sv_domination.qc.

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(teamplay_bitmask & BIT(2))
36 STAT(DOM_PPS_YELLOW, e) = pps_yellow;
37 if(teamplay_bitmask & BIT(3))
38 STAT(DOM_PPS_PINK, e) = pps_pink;
39}
#define STAT(...)
Definition stats.qh:94
int teamplay_bitmask
The set of currently available teams (AVAILABLE_TEAMS is the number of them).
Definition teamplay.qh:18

References BIT, entity(), pps_blue, pps_pink, pps_red, pps_yellow, STAT, teamplay_bitmask, and total_pps.

Referenced by dompoint_captured(), MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ spawnfunc() [1/3]

spawnfunc ( dom_controlpoint )

Definition at line 449 of file sv_domination.qc.

450{
451 if(!g_domination)
452 {
453 delete(this);
454 return;
455 }
457 this.nextthink = time + 0.1;
458 this.reset = dom_controlpoint_setup;
459
460 if(!this.scale)
461 this.scale = 0.6;
462
463 this.effects |= EF_LOWPRECISION;
465 this.effects |= EF_FULLBRIGHT;
466
467 IL_PUSH(g_dompoints, this);
468}
const float EF_FULLBRIGHT
float effects
float EF_LOWPRECISION
float scale
Definition projectile.qc:14
void dom_controlpoint_setup(entity this)
bool autocvar_g_domination_point_fullbright

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.

◆ spawnfunc() [2/3]

spawnfunc ( dom_team )

Definition at line 513 of file sv_domination.qc.

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 != "")
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}
float dmg
Definition breakable.qc:12
string mdl
Definition item.qh:89
string precache_sound(string sample)
string noise
Definition subs.qh:83
string noise1
Definition subs.qh:83

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

◆ spawnfunc() [3/3]

spawnfunc ( team_dom_point )

Definition at line 482 of file sv_domination.qc.

483{
484 spawnfunc_dom_controlpoint(this);
485}

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(), spawnfunc(), and spawnfunc().

◆ total_control_points

int total_control_points

Definition at line 313 of file sv_domination.qc.

Referenced by Domination_CheckWinner(), and Domination_count_controlpoints().