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

Go to the source code of this file.

Macros

#define X(s, b)

Functions

void ctf_CalculatePassVelocity (entity flag, vector to, vector from, float turnrate)
void ctf_CaptureRecord (entity flag, entity player)
bool ctf_CaptureShield_CheckStatus (entity p)
bool ctf_CaptureShield_Customize (entity this, entity client)
void ctf_CaptureShield_Spawn (entity flag)
void ctf_CaptureShield_Touch (entity this, entity toucher)
void ctf_CaptureShield_Update (entity player, bool wanted_status)
void ctf_CheckFlagReturn (entity flag, int returntype)
bool ctf_CheckPassDirection (vector head_center, vector passer_center, vector passer_angle, vector nearest_to_passer)
void ctf_CheckStalemate ()
void ctf_DelayedFlagSetup (entity this)
void ctf_DelayedInit (entity this)
void ctf_EventLog (string mode, int flagteam, entity actor)
void ctf_FakeTimeLimit (entity e, float t)
bool ctf_FlagBase_Customize (entity this, entity client)
void ctf_FlagcarrierWaypoints (entity player)
void ctf_FlagDamage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void ctf_FlagSetup (int teamnum, entity flag)
void ctf_FlagThink (entity this)
void ctf_Handle_Capture (entity flag, entity toucher, int capturetype)
void ctf_Handle_Drop (entity flag, entity player, int droptype)
void ctf_Handle_Pickup (entity flag, entity player, int pickuptype)
void ctf_Handle_Retrieve (entity flag, entity player)
void ctf_Handle_Return (entity flag, entity player)
void ctf_Handle_Throw (entity player, entity receiver, int droptype)
bool ctf_Immediate_Return_Allowed (entity flag, entity toucher)
void ctf_Initialize ()
void ctf_RemovePlayer (entity player)
void ctf_Reset (entity this)
void ctf_RespawnFlag (entity flag)
bool ctf_Return_Customize (entity this, entity client)
void ctf_ScoreRules (int teams)
bool ctf_Stalemate_Customize (entity this, entity client)
void havocbot_ctf_calculate_middlepoint ()
entity havocbot_ctf_find_enemy_flag (entity bot)
entity havocbot_ctf_find_flag (entity bot)
bool havocbot_ctf_is_basewaypoint (entity item)
void havocbot_ctf_reset_role (entity this)
int havocbot_ctf_teamcount (entity bot, vector org, float tc_radius)
void havocbot_goalrating_ctf_droppedflags (entity this, float ratingscale, vector org, float df_radius)
void havocbot_goalrating_ctf_enemybase (entity this, float ratingscale)
void havocbot_goalrating_ctf_enemyflag (entity this, float ratingscale)
void havocbot_goalrating_ctf_ourbase (entity this, float ratingscale)
void havocbot_goalrating_ctf_ourstolenflag (entity this, float ratingscale)
void havocbot_role_ctf_carrier (entity this)
void havocbot_role_ctf_defense (entity this)
void havocbot_role_ctf_escort (entity this)
void havocbot_role_ctf_middle (entity this)
void havocbot_role_ctf_offense (entity this)
void havocbot_role_ctf_retriever (entity this)
void havocbot_role_ctf_setrole (entity bot, int role)
 if (frag_attacker.flagcarried)
else if (frag_target.flagcarried &&!IS_DEAD(frag_target) &&CTF_DIFFTEAM(frag_target, frag_attacker))
 MUTATOR_HOOKFUNCTION (ctf, AbortSpeedrun)
 MUTATOR_HOOKFUNCTION (ctf, ClientConnect)
 MUTATOR_HOOKFUNCTION (ctf, ClientDisconnect)
 MUTATOR_HOOKFUNCTION (ctf, DropSpecialItems)
 MUTATOR_HOOKFUNCTION (ctf, GetPressedKeys)
 MUTATOR_HOOKFUNCTION (ctf, GetRecords)
 MUTATOR_HOOKFUNCTION (ctf, GiveFragsForKill)
 MUTATOR_HOOKFUNCTION (ctf, HavocBot_ChooseRole)
 MUTATOR_HOOKFUNCTION (ctf, HelpMePing)
 MUTATOR_HOOKFUNCTION (ctf, LogDeath_AppendItemCodes)
 MUTATOR_HOOKFUNCTION (ctf, MakePlayerObserver)
 MUTATOR_HOOKFUNCTION (ctf, MatchEnd)
 MUTATOR_HOOKFUNCTION (ctf, PlayerDies)
 MUTATOR_HOOKFUNCTION (ctf, PlayerPreThink)
 MUTATOR_HOOKFUNCTION (ctf, PlayerUseKey)
 MUTATOR_HOOKFUNCTION (ctf, PortalTeleport)
 MUTATOR_HOOKFUNCTION (ctf, PreferPlayerScore_Clear)
 MUTATOR_HOOKFUNCTION (ctf, SV_ParseClientCommand)
 MUTATOR_HOOKFUNCTION (ctf, VehicleEnter)
 MUTATOR_HOOKFUNCTION (ctf, VehicleExit)
void nades_GiveBonus (entity player, float score)
 spawnfunc (ctf_team)
 spawnfunc (info_player_team1)
 spawnfunc (info_player_team2)
 spawnfunc (item_flag_neutral)
 spawnfunc (item_flag_team1)
 spawnfunc (item_flag_team2)
 spawnfunc (item_flag_team3)
 spawnfunc (item_flag_team4)
 spawnfunc (team_blueplayer)
 spawnfunc (team_CTF_blueflag)
 spawnfunc (team_CTF_blueplayer)
 spawnfunc (team_CTF_bluespawn)
 spawnfunc (team_CTF_neutralflag)
 spawnfunc (team_CTF_redflag)
 spawnfunc (team_CTF_redplayer)
 spawnfunc (team_CTF_redspawn)
 spawnfunc (team_CTL_bluelolly)
 spawnfunc (team_ctl_bluelolly)
 spawnfunc (team_CTL_redlolly)
 spawnfunc (team_ctl_redlolly)
 spawnfunc (team_neutralobelisk)
 spawnfunc (team_redplayer)
void superspec_msg (string _center_title, string _con_title, entity _to, string _msg, float _spamlevel)
bool superspec_Spectate (entity this, entity targ)

Variables

bool autocvar_g_ctf_allow_monster_touch
bool autocvar_g_ctf_allow_vehicle_carry
bool autocvar_g_ctf_allow_vehicle_touch
float autocvar_g_ctf_drop_velocity_side
float autocvar_g_ctf_drop_velocity_up
float autocvar_g_ctf_dropped_capture_delay
float autocvar_g_ctf_dropped_capture_radius
bool autocvar_g_ctf_dynamiclights
float autocvar_g_ctf_flag_collect_delay
float autocvar_g_ctf_flag_damageforcescale
bool autocvar_g_ctf_flag_dropped_floatinwater
bool autocvar_g_ctf_flag_dropped_waypoint
bool autocvar_g_ctf_flag_glowtrails
float autocvar_g_ctf_flag_health
bool autocvar_g_ctf_flag_return
float autocvar_g_ctf_flag_return_carried_radius
bool autocvar_g_ctf_flag_return_carrying
float autocvar_g_ctf_flag_return_damage
float autocvar_g_ctf_flag_return_damage_delay
float autocvar_g_ctf_flag_return_dropped
float autocvar_g_ctf_flag_return_time
bool autocvar_g_ctf_flag_return_when_unreachable
bool autocvar_g_ctf_flag_stay
bool autocvar_g_ctf_flag_waypoint = true
float autocvar_g_ctf_flag_waypoint_maxdistance
float autocvar_g_ctf_flagcarrier_auto_helpme_damage
float autocvar_g_ctf_flagcarrier_auto_helpme_time
float autocvar_g_ctf_flagcarrier_damagefactor
float autocvar_g_ctf_flagcarrier_forcefactor
float autocvar_g_ctf_flagcarrier_selfdamagefactor
float autocvar_g_ctf_flagcarrier_selfforcefactor
bool autocvar_g_ctf_fullbrightflags
bool autocvar_g_ctf_ignore_frags
bool autocvar_g_ctf_oneflag_reverse
bool autocvar_g_ctf_pass
float autocvar_g_ctf_pass_arc
float autocvar_g_ctf_pass_arc_max
float autocvar_g_ctf_pass_directional_max
float autocvar_g_ctf_pass_directional_min
float autocvar_g_ctf_pass_radius
bool autocvar_g_ctf_pass_request
float autocvar_g_ctf_pass_timelimit
float autocvar_g_ctf_pass_turnrate
float autocvar_g_ctf_pass_velocity
float autocvar_g_ctf_pass_wait
bool autocvar_g_ctf_portalteleport
bool autocvar_g_ctf_reverse
int autocvar_g_ctf_score_capture
int autocvar_g_ctf_score_capture_assist
bool autocvar_g_ctf_score_ignore_fields
int autocvar_g_ctf_score_kill
int autocvar_g_ctf_score_penalty_drop
int autocvar_g_ctf_score_penalty_returned
int autocvar_g_ctf_score_pickup_base
int autocvar_g_ctf_score_pickup_dropped_early
int autocvar_g_ctf_score_pickup_dropped_late
int autocvar_g_ctf_score_return
float autocvar_g_ctf_shield_force
float autocvar_g_ctf_shield_max_ratio
int autocvar_g_ctf_shield_min_negscore
bool autocvar_g_ctf_stalemate
int autocvar_g_ctf_stalemate_endcondition
float autocvar_g_ctf_stalemate_time
bool autocvar_g_ctf_throw
float autocvar_g_ctf_throw_angle_max
float autocvar_g_ctf_throw_angle_min
int autocvar_g_ctf_throw_punish_count
float autocvar_g_ctf_throw_punish_delay
float autocvar_g_ctf_throw_punish_time
float autocvar_g_ctf_throw_strengthmultiplier
float autocvar_g_ctf_throw_velocity_forward
float autocvar_g_ctf_throw_velocity_up
float frag_damage = M_ARGV(4, float)
vector frag_force = M_ARGV(6, vector)
entity frag_target = M_ARGV(2, entity)
bool pushable

Macro Definition Documentation

◆ X

#define X ( s,
b )
Value:
if(flag.s == "") flag.s = b; \
precache_sound(flag.s);

Referenced by ctf_FlagSetup().

Function Documentation

◆ ctf_CalculatePassVelocity()

void ctf_CalculatePassVelocity ( entity flag,
vector to,
vector from,
float turnrate )

Definition at line 202 of file sv_ctf.qc.

203{
204 float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
205 float initial_height = min(autocvar_g_ctf_pass_arc_max, (flag.pass_distance * tanh(autocvar_g_ctf_pass_arc)));
206 float current_height = (initial_height * min(1, (current_distance / flag.pass_distance)));
207 //print("current_height = ", ftos(current_height), ", initial_height = ", ftos(initial_height), ".\n");
208
209 vector targpos;
210 if(current_height) // make sure we can actually do this arcing path
211 {
212 targpos = (to + ('0 0 1' * current_height));
213 WarpZone_TraceLine(flag.origin, targpos, MOVE_NOMONSTERS, flag);
214 if(trace_fraction < 1)
215 {
216 //print("normal arc line failed, trying to find new pos...");
217 WarpZone_TraceLine(to, targpos, MOVE_NOMONSTERS, flag);
218 targpos = (trace_endpos + eZ * FLAG_PASS_ARC_OFFSET_Z);
219 WarpZone_TraceLine(flag.origin, targpos, MOVE_NOMONSTERS, flag);
220 if(trace_fraction < 1) { targpos = to; /* print(" ^1FAILURE^7, reverting to original direction.\n"); */ }
221 /*else { print(" ^3SUCCESS^7, using new arc line.\n"); } */
222 }
223 }
224 else { targpos = to; }
225
226 //flag.angles = normalize(('0 1 0' * to_y) - ('0 1 0' * from_y));
227
228 vector desired_direction = normalize(targpos - from);
229 if(turnrate) { flag.velocity = (normalize(normalize(flag.velocity) + (desired_direction * autocvar_g_ctf_pass_turnrate)) * autocvar_g_ctf_pass_velocity); }
230 else { flag.velocity = (desired_direction * autocvar_g_ctf_pass_velocity); }
231}
const float MOVE_NOMONSTERS
vector trace_endpos
float trace_fraction
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
Definition common.qc:328
float tanh(float e)
Definition mathlib.qc:65
float vlen(vector v)
float min(float f,...)
vector normalize(vector v)
vector
Definition self.qh:96
float autocvar_g_ctf_pass_arc_max
Definition sv_ctf.qc:39
float autocvar_g_ctf_pass_turnrate
Definition sv_ctf.qc:45
float autocvar_g_ctf_pass_velocity
Definition sv_ctf.qc:47
float autocvar_g_ctf_pass_arc
Definition sv_ctf.qc:38
const int FLAG_PASS_ARC_OFFSET_Z
Definition sv_ctf.qh:62
const vector eZ
Definition vector.qh:45

References autocvar_g_ctf_pass_arc, autocvar_g_ctf_pass_arc_max, autocvar_g_ctf_pass_turnrate, autocvar_g_ctf_pass_velocity, entity(), eZ, FLAG_PASS_ARC_OFFSET_Z, min(), MOVE_NOMONSTERS, normalize(), tanh(), trace_endpos, trace_fraction, vector, vlen(), and WarpZone_TraceLine().

Referenced by ctf_FlagThink(), and ctf_Handle_Throw().

◆ ctf_CaptureRecord()

void ctf_CaptureRecord ( entity flag,
entity player )

Definition at line 113 of file sv_ctf.qc.

114{
115 float cap_record = ctf_captimerecord;
116 float cap_time = (time - flag.ctf_pickuptime);
117 string refername = db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"));
118 bool valid_record = (cap_time > 0.01);
119
120 // notify about shit
121 if(ctf_oneflag)
122 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CTF_CAPTURE_NEUTRAL, player.netname);
123 else if(!ctf_captimerecord || !valid_record)
124 Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_TIME), player.netname, TIME_ENCODE(cap_time));
125 else if(cap_time < cap_record)
126 Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_BROKEN), player.netname, refername, TIME_ENCODE(cap_time), TIME_ENCODE(cap_record));
127 else
128 Send_Notification(NOTIF_ALL, NULL, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_CAPTURE_UNBROKEN), player.netname, refername, TIME_ENCODE(cap_time), TIME_ENCODE(cap_record));
129
130 // write that shit in the database
131 if(!ctf_oneflag && valid_record) // but not in 1-flag mode
132 if((!ctf_captimerecord) || (cap_time < cap_record))
133 {
134 ctf_captimerecord = cap_time;
135 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time"), ftos(cap_time));
136 db_put(ServerProgsDB, strcat(GetMapname(), "/captimerecord/netname"), player.netname);
137 write_recordmarker(player, flag.ctf_pickuptime, cap_time);
138 }
139
140 if(autocvar_g_ctf_leaderboard && !ctf_oneflag && valid_record)
141 race_setTime(GetMapname(), TIME_ENCODE(cap_time), player.crypto_idfp, player.netname, player, false);
142}
bool autocvar_g_ctf_leaderboard
Definition stats.qh:148
#define TIME_ENCODE(t)
Definition util.qh:100
float time
string GetMapname()
ERASEABLE string db_get(int db, string key)
Definition map.qh:93
ERASEABLE void db_put(int db, string key, string value)
Definition map.qh:103
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
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 NULL
Definition post.qh:14
void write_recordmarker(entity pl, float tstart, float dt)
Definition race.qc:57
void race_setTime(string map, float t, string myuid, string mynetname, entity e, bool showmessage)
Definition race.qc:373
bool ctf_oneflag
Definition sv_ctf.qh:169
float ctf_captimerecord
Definition sv_ctf.qh:144
float ServerProgsDB
Definition world.qh:128

References APP_TEAM_NUM, autocvar_g_ctf_leaderboard, ctf_captimerecord, ctf_oneflag, db_get(), db_put(), entity(), ftos(), GetMapname(), NULL, race_setTime(), Send_Notification(), ServerProgsDB, strcat(), time, TIME_ENCODE, and write_recordmarker().

Referenced by ctf_Handle_Capture().

◆ ctf_CaptureShield_CheckStatus()

bool ctf_CaptureShield_CheckStatus ( entity p)

Definition at line 267 of file sv_ctf.qc.

268{
269 int s, s2, s3, s4, se, se2, se3, se4, sr, ser;
270 int players_worseeq, players_total;
271
273 return false;
274
275 s = GameRules_scoring_add(p, CTF_CAPS, 0);
276 s2 = GameRules_scoring_add(p, CTF_PICKUPS, 0);
277 s3 = GameRules_scoring_add(p, CTF_RETURNS, 0);
278 s4 = GameRules_scoring_add(p, CTF_FCKILLS, 0);
279
280 sr = ((s - s2) + (s3 + s4));
281
283 return false;
284
285 players_total = players_worseeq = 0;
287 if(DIFF_TEAM(it, p))
288 continue;
289 se = GameRules_scoring_add(it, CTF_CAPS, 0);
290 se2 = GameRules_scoring_add(it, CTF_PICKUPS, 0);
291 se3 = GameRules_scoring_add(it, CTF_RETURNS, 0);
292 se4 = GameRules_scoring_add(it, CTF_FCKILLS, 0);
293
294 ser = ((se - se2) + (se3 + se4));
295
296 if(ser <= sr)
297 ++players_worseeq;
298 ++players_total;
299 });
300
301 // player is in the worse half, if >= half the players are better than him, or consequently, if < half of the players are worse
302 // use this rule here
303
304 if(players_worseeq >= players_total * ctf_captureshield_max_ratio)
305 return false;
306
307 return true;
308}
#define IS_PLAYER(s)
Definition player.qh:242
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points s1 s2
Definition all.inc:475
float ctf_captureshield_min_negscore
Definition sv_ctf.qh:164
float ctf_captureshield_max_ratio
Definition sv_ctf.qh:165
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85
#define DIFF_TEAM(a, b)
Definition teams.qh:242
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

References ctf_captureshield_max_ratio, ctf_captureshield_min_negscore, DIFF_TEAM, entity(), FOREACH_CLIENT, GameRules_scoring_add, IS_PLAYER, and s2.

Referenced by ctf_CaptureShield_Update().

◆ ctf_CaptureShield_Customize()

bool ctf_CaptureShield_Customize ( entity this,
entity client )

Definition at line 320 of file sv_ctf.qc.

321{
322 if(!client.ctf_captureshielded) { return false; }
323 if(CTF_SAMETEAM(this, client)) { return false; }
324
325 return true;
326}
#define CTF_SAMETEAM(a, b)
Definition sv_ctf.qh:185

References CTF_SAMETEAM, and entity().

Referenced by ctf_CaptureShield_Spawn().

◆ ctf_CaptureShield_Spawn()

void ctf_CaptureShield_Spawn ( entity flag)

Definition at line 340 of file sv_ctf.qc.

341{
342 entity shield = new(ctf_captureshield);
343
344 shield.enemy = flag;
345 shield.team = flag.team;
348 shield.effects = EF_ADDITIVE;
350 shield.solid = SOLID_TRIGGER;
351 shield.avelocity = '7 0 11';
352 shield.scale = 0.5;
353
354 setorigin(shield, flag.origin);
355 setmodel(shield, MDL_CTF_SHIELD);
356 setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
357}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define setmodel(this, m)
Definition model.qh:26
const float SOLID_TRIGGER
const float EF_ADDITIVE
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NOCLIP
Definition movetypes.qh:141
#define setcefc(e, f)
#define settouch(e, f)
Definition self.qh:77
bool ctf_CaptureShield_Customize(entity this, entity client)
Definition sv_ctf.qc:320
void ctf_CaptureShield_Touch(entity this, entity toucher)
Definition sv_ctf.qc:328

References ctf_CaptureShield_Customize(), ctf_CaptureShield_Touch(), EF_ADDITIVE, entity(), MOVETYPE_NOCLIP, set_movetype(), setcefc, setmodel, settouch, and SOLID_TRIGGER.

Referenced by ctf_DelayedFlagSetup().

◆ ctf_CaptureShield_Touch()

void ctf_CaptureShield_Touch ( entity this,
entity toucher )

Definition at line 328 of file sv_ctf.qc.

329{
330 if(!toucher.ctf_captureshielded) { return; }
331 if(CTF_SAMETEAM(this, toucher)) { return; }
332
333 vector mymid = (this.absmin + this.absmax) * 0.5;
334 vector theirmid = (toucher.absmin + toucher.absmax) * 0.5;
335
336 Damage(toucher, this, this, 0, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, mymid, normalize(theirmid - mymid) * ctf_captureshield_force);
337 if(IS_REAL_CLIENT(toucher)) { Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_CTF_CAPTURESHIELD_SHIELDED); }
338}
vector absmax
vector absmin
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:483
#define DMG_NOWEP
Definition damage.qh:104
entity entity toucher
Definition self.qh:76
float ctf_captureshield_force
Definition sv_ctf.qh:166
#define IS_REAL_CLIENT(v)
Definition utils.qh:17

References absmax, absmin, ctf_captureshield_force, CTF_SAMETEAM, Damage(), DMG_NOWEP, entity(), IS_REAL_CLIENT, normalize(), Send_Notification(), toucher, and vector.

Referenced by ctf_CaptureShield_Spawn().

◆ ctf_CaptureShield_Update()

void ctf_CaptureShield_Update ( entity player,
bool wanted_status )

Definition at line 310 of file sv_ctf.qc.

311{
312 bool updated_status = ctf_CaptureShield_CheckStatus(player);
313 if((wanted_status == player.ctf_captureshielded) && (updated_status != wanted_status)) // 0: shield only, 1: unshield only
314 {
315 Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((updated_status) ? CENTER_CTF_CAPTURESHIELD_SHIELDED : CENTER_CTF_CAPTURESHIELD_FREE));
316 player.ctf_captureshielded = updated_status;
317 }
318}
bool ctf_CaptureShield_CheckStatus(entity p)
Definition sv_ctf.qc:267

References ctf_CaptureShield_CheckStatus(), entity(), and Send_Notification().

Referenced by ctf_Handle_Return(), and ctf_Handle_Throw().

◆ ctf_CheckFlagReturn()

void ctf_CheckFlagReturn ( entity flag,
int returntype )

Definition at line 852 of file sv_ctf.qc.

853{
854 if((flag.ctf_status == FLAG_DROPPED) || (flag.ctf_status == FLAG_PASSING))
855 {
856 if (flag.wps_flagdropped
858 {
859 WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(flag, RES_HEALTH));
860 }
861
862 if((GetResource(flag, RES_HEALTH) <= 0)
864 {
865 switch(returntype)
866 {
867 case RETURN_DROPPED:
868 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_DROPPED)); break;
869 case RETURN_DAMAGE:
870 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_DAMAGED)); break;
871 case RETURN_SPEEDRUN:
872 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_SPEEDRUN), TIME_ENCODE(ctf_captimerecord)); break;
873 case RETURN_NEEDKILL:
874 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_NEEDKILL)); break;
875 default:
876 case RETURN_TIMEOUT:
877 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_FLAGRETURN_TIMEOUT)); break;
878 }
879 _sound(flag, CH_TRIGGER, flag.snd_flag_respawn, VOL_BASE, ATTEN_NONE);
880 ctf_EventLog("returned", flag.team, NULL);
881 flag.enemy = NULL;
882 ctf_RespawnFlag(flag);
883 }
884 }
885}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define APP_NUM(num, prefix)
Definition all.qh:89
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NONE
Definition sound.qh:27
#define _sound(e, c, s, v, a)
Definition sound.qh:43
void ctf_RespawnFlag(entity flag)
Definition sv_ctf.qc:1237
void ctf_EventLog(string mode, int flagteam, entity actor)
Definition sv_ctf.qc:106
float autocvar_g_ctf_flag_return_damage
Definition sv_ctf.qc:60
float autocvar_g_ctf_flag_return_time
Definition sv_ctf.qc:58
const int RETURN_DAMAGE
Definition sv_ctf.qh:133
const int FLAG_DROPPED
Definition sv_ctf.qh:116
const int FLAG_PASSING
Definition sv_ctf.qh:118
const int RETURN_SPEEDRUN
Definition sv_ctf.qh:134
const int RETURN_DROPPED
Definition sv_ctf.qh:132
const int RETURN_NEEDKILL
Definition sv_ctf.qh:135
const int RETURN_TIMEOUT
Definition sv_ctf.qh:131
void WaypointSprite_UpdateHealth(entity e, float f)

References _sound, APP_NUM, ATTEN_NONE, autocvar_g_ctf_flag_return_damage, autocvar_g_ctf_flag_return_time, CH_TRIGGER, ctf_captimerecord, ctf_EventLog(), ctf_RespawnFlag(), entity(), FLAG_DROPPED, FLAG_PASSING, GetResource(), NULL, RETURN_DAMAGE, RETURN_DROPPED, RETURN_NEEDKILL, RETURN_SPEEDRUN, RETURN_TIMEOUT, Send_Notification(), time, TIME_ENCODE, VOL_BASE, and WaypointSprite_UpdateHealth().

Referenced by ctf_FlagDamage(), and ctf_FlagThink().

◆ ctf_CheckPassDirection()

bool ctf_CheckPassDirection ( vector head_center,
vector passer_center,
vector passer_angle,
vector nearest_to_passer )

Definition at line 233 of file sv_ctf.qc.

234{
236 {
237 // directional tracing only
238 float spreadlimit;
239 makevectors(passer_angle);
240
241 // find the closest point on the enemy to the center of the attack
242 float h; // hypotenuse, which is the distance between attacker to head
243 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
244
245 h = vlen(head_center - passer_center);
246 a = h * (normalize(head_center - passer_center) * v_forward);
247
248 vector nearest_on_line = (passer_center + a * v_forward);
249 float distance_from_line = vlen(nearest_to_passer - nearest_on_line);
250
251 spreadlimit = (autocvar_g_ctf_pass_radius ? min(1, (vlen(passer_center - nearest_on_line) / autocvar_g_ctf_pass_radius)) : 1);
252 spreadlimit = (autocvar_g_ctf_pass_directional_min * (1 - spreadlimit) + autocvar_g_ctf_pass_directional_max * spreadlimit);
253
254 if(spreadlimit && (distance_from_line <= spreadlimit) && ((vlen(normalize(head_center - passer_center) - v_forward) * RAD2DEG) <= 90))
255 { return true; }
256 else
257 { return false; }
258 }
259 else { return true; }
260}
float RAD2DEG
vector v_forward
#define makevectors
Definition post.qh:21
float autocvar_g_ctf_pass_radius
Definition sv_ctf.qc:42
float autocvar_g_ctf_pass_directional_min
Definition sv_ctf.qc:41
float autocvar_g_ctf_pass_directional_max
Definition sv_ctf.qc:40

References autocvar_g_ctf_pass_directional_max, autocvar_g_ctf_pass_directional_min, autocvar_g_ctf_pass_radius, makevectors, min(), normalize(), RAD2DEG, v_forward, vector, and vlen().

Referenced by MUTATOR_HOOKFUNCTION().

◆ ctf_CheckStalemate()

void ctf_CheckStalemate ( )

Definition at line 903 of file sv_ctf.qc.

904{
905 // declarations
906 int stale_flags = 0, stale_red_flags = 0, stale_blue_flags = 0, stale_yellow_flags = 0, stale_pink_flags = 0, stale_neutral_flags = 0;
907 entity ctf_staleflaglist = NULL; // reset the list, we need to build the list each time this function runs
908
909 // build list of stale flags
910 IL_EACH(g_flags, true,
911 {
913 if(it.ctf_status != FLAG_BASE)
914 if(time >= it.ctf_pickuptime + autocvar_g_ctf_stalemate_time || !it.team) // instant stalemate in oneflag
915 {
916 it.ctf_staleflagnext = ctf_staleflaglist; // link flag into staleflaglist
917 ctf_staleflaglist = it;
918
919 switch(it.team)
920 {
921 case NUM_TEAM_1: ++stale_red_flags; break;
922 case NUM_TEAM_2: ++stale_blue_flags; break;
923 case NUM_TEAM_3: ++stale_yellow_flags; break;
924 case NUM_TEAM_4: ++stale_pink_flags; break;
925 default: ++stale_neutral_flags; break;
926 }
927 }
928 });
929
930 if(ctf_oneflag)
931 stale_flags = (stale_neutral_flags >= 1);
932 else
933 stale_flags = (stale_red_flags >= 1) + (stale_blue_flags >= 1) + (stale_yellow_flags >= 1) + (stale_pink_flags >= 1);
934
935 if(ctf_oneflag && stale_flags == 1)
936 ctf_stalemate = true;
937 else if(stale_flags >= 2)
938 ctf_stalemate = true;
939 else if(stale_flags == 0 && autocvar_g_ctf_stalemate_endcondition == 2)
940 { ctf_stalemate = false; wpforenemy_announced = false; }
941 else if(stale_flags < 2 && autocvar_g_ctf_stalemate_endcondition == 1)
942 { ctf_stalemate = false; wpforenemy_announced = false; }
943
944 // if sufficient stalemate, then set up the waypointsprite and announce the stalemate if necessary
945 if(ctf_stalemate)
946 {
947 for(entity tmp_entity = ctf_staleflaglist; tmp_entity; tmp_entity = tmp_entity.ctf_staleflagnext)
948 {
949 if((tmp_entity.owner) && (!tmp_entity.owner.wps_enemyflagcarrier))
950 {
951 entity base_wp = WP_FlagCarrier;
952 if (!ctf_oneflag)
953 {
954 switch (tmp_entity.owner.team)
955 {
956 case NUM_TEAM_1: base_wp = WP_FlagCarrierEnemyRed; break;
957 case NUM_TEAM_2: base_wp = WP_FlagCarrierEnemyBlue; break;
958 case NUM_TEAM_3: base_wp = WP_FlagCarrierEnemyYellow; break;
959 case NUM_TEAM_4: base_wp = WP_FlagCarrierEnemyPink; break;
960 default: base_wp = WP_FlagCarrierEnemyNeutral; break;
961 }
962 }
963 entity wp = WaypointSprite_Spawn(base_wp, 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, NULL,
964 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG);
965 wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team);
966 setcefc(tmp_entity.owner.wps_enemyflagcarrier, ctf_Stalemate_Customize);
967 }
968 }
969
971 {
972 FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { Send_Notification(NOTIF_ONE, it, MSG_CENTER, ((it.flagcarried) ? CENTER_CTF_STALEMATE_CARRIER : CENTER_CTF_STALEMATE_OTHER)); });
973
975 }
976 }
977}
#define IL_EACH(this, cond, body)
float autocvar_g_ctf_stalemate_time
Definition sv_ctf.qc:90
bool ctf_Stalemate_Customize(entity this, entity client)
Definition sv_ctf.qc:887
int autocvar_g_ctf_stalemate_endcondition
Definition sv_ctf.qc:89
bool autocvar_g_ctf_stalemate
Definition sv_ctf.qc:88
IntrusiveList g_flags
Definition sv_ctf.qh:12
entity wps_enemyflagcarrier
Definition sv_ctf.qh:109
bool ctf_stalemate
Definition sv_ctf.qh:143
const vector FLAG_WAYPOINT_OFFSET
Definition sv_ctf.qh:60
const int FLAG_BASE
Definition sv_ctf.qh:115
bool wpforenemy_announced
Definition sv_ctf.qh:111
#define WPCOLOR_ENEMYFC(t)
Definition sv_ctf.qh:70
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
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)

References autocvar_g_ctf_stalemate, autocvar_g_ctf_stalemate_endcondition, autocvar_g_ctf_stalemate_time, ctf_oneflag, ctf_stalemate, ctf_Stalemate_Customize(), entity(), FLAG_BASE, FLAG_WAYPOINT_OFFSET, FOREACH_CLIENT, g_flags, IL_EACH, IS_PLAYER, IS_REAL_CLIENT, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, Send_Notification(), setcefc, time, WaypointSprite_Spawn(), WPCOLOR_ENEMYFC, wpforenemy_announced, and wps_enemyflagcarrier.

Referenced by ctf_FlagThink(), and ctf_RespawnFlag().

◆ ctf_DelayedFlagSetup()

void ctf_DelayedFlagSetup ( entity this)

Definition at line 1319 of file sv_ctf.qc.

1320{
1321 // bot waypoints
1323 navigation_dynamicgoal_init(this, true);
1324
1325 // waypointsprites
1326 entity basename;
1327 switch (this.team)
1328 {
1329 case NUM_TEAM_1: basename = WP_FlagBaseRed; break;
1330 case NUM_TEAM_2: basename = WP_FlagBaseBlue; break;
1331 case NUM_TEAM_3: basename = WP_FlagBaseYellow; break;
1332 case NUM_TEAM_4: basename = WP_FlagBasePink; break;
1333 default: basename = WP_FlagBaseNeutral; break;
1334 }
1335
1337 {
1338 entity wp = WaypointSprite_SpawnFixed(basename, this.origin + FLAG_WAYPOINT_OFFSET, this, wps_flagbase, RADARICON_FLAG);
1339 wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 1 1');
1341 WaypointSprite_UpdateTeamRadar(this.wps_flagbase, RADARICON_FLAG, ((this.team) ? colormapPaletteColor(this.team - 1, false) : '1 1 1'));
1343 }
1344
1345 // captureshield setup
1347}
void navigation_dynamicgoal_init(entity this, bool initially_static)
Definition navigation.qc:77
void waypoint_spawnforitem_force(entity e, vector org)
int team
Definition main.qh:188
#define colormapPaletteColor(c, isPants)
Definition color.qh:5
vector origin
void ctf_CaptureShield_Spawn(entity flag)
Definition sv_ctf.qc:340
float autocvar_g_ctf_flag_waypoint_maxdistance
Definition sv_ctf.qc:65
bool autocvar_g_ctf_flag_waypoint
Definition sv_ctf.qc:64
bool ctf_FlagBase_Customize(entity this, entity client)
Definition sv_ctf.qc:1307
entity wps_flagbase
Definition sv_ctf.qh:105
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
void WaypointSprite_UpdateTeamRadar(entity e, entity icon, vector col)
entity WaypointSprite_SpawnFixed(entity spr, vector ofs, entity own,.entity ownfield, entity icon)

References autocvar_g_ctf_flag_waypoint, autocvar_g_ctf_flag_waypoint_maxdistance, colormapPaletteColor, ctf_CaptureShield_Spawn(), ctf_FlagBase_Customize(), entity(), FLAG_WAYPOINT_OFFSET, navigation_dynamicgoal_init(), NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, origin, setcefc, team, Team_ColorRGB(), waypoint_spawnforitem_force(), WaypointSprite_SpawnFixed(), WaypointSprite_UpdateTeamRadar(), and wps_flagbase.

Referenced by ctf_FlagSetup().

◆ ctf_DelayedInit()

void ctf_DelayedInit ( entity this)

Definition at line 2862 of file sv_ctf.qc.

2863{
2864 int ctf_teams = 0;
2865
2866 IL_EACH(g_flags, true,
2867 {
2868 //if(it.team == NUM_TEAM_3) { ctf_teams = max(3, ctf_teams); }
2869 //if(it.team == NUM_TEAM_4) { ctf_teams = max(4, ctf_teams); }
2870
2871 switch(it.team)
2872 {
2873 case NUM_TEAM_1: BITSET_ASSIGN(ctf_teams, BIT(0)); break;
2874 case NUM_TEAM_2: BITSET_ASSIGN(ctf_teams, BIT(1)); break;
2875 case NUM_TEAM_3: BITSET_ASSIGN(ctf_teams, BIT(2)); break;
2876 case NUM_TEAM_4: BITSET_ASSIGN(ctf_teams, BIT(3)); break;
2877 }
2878 if(it.team == 0) { ctf_oneflag = true; }
2879 });
2880
2882
2883 if(NumTeams(ctf_teams) < 2) // somehow, there's not enough flags!
2884 {
2885 ctf_teams = 0; // so set the default red and blue teams
2886 BITSET_ASSIGN(ctf_teams, BIT(0));
2887 BITSET_ASSIGN(ctf_teams, BIT(1));
2888 }
2889
2890 //ctf_teams = bound(2, ctf_teams, 4);
2891
2892 // if no teams are found, spawn defaults
2893 Team_MapEnts_FindOrSpawn("ctf_team", ctf_teams);
2894
2895 ctf_ScoreRules(ctf_teams);
2896}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITSET_ASSIGN(a, b)
Definition common.qh:107
int NumTeams(int teams)
void havocbot_ctf_calculate_middlepoint()
Definition sv_ctf.qc:1480
void ctf_ScoreRules(int teams)
Definition sv_ctf.qc:2849
int Team_MapEnts_FindOrSpawn(string ent_classname, int defaultmask)
Finds any team map entities and returns their bitmask, else spawns them.
Definition teamplay.qc:56

References BIT, BITSET_ASSIGN, ctf_oneflag, ctf_ScoreRules(), entity(), g_flags, havocbot_ctf_calculate_middlepoint(), IL_EACH, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, NumTeams(), and Team_MapEnts_FindOrSpawn().

Referenced by ctf_Initialize().

◆ ctf_EventLog()

void ctf_EventLog ( string mode,
int flagteam,
entity actor )

Definition at line 106 of file sv_ctf.qc.

107{
109 GameLogEcho(sprintf(":ctf:%s:%d:%d:%s", mode, flagteam, actor.team, ((actor != NULL) ? ftos(actor.playerid) : "")));
110 //GameLogEcho(strcat(":ctf:", mode, ":", ftos(flagteam), ((actor != NULL) ? (strcat(":", ftos(actor.playerid))) : "")));
111}
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3

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

Referenced by ctf_CheckFlagReturn(), ctf_Handle_Capture(), ctf_Handle_Drop(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Handle_Return(), and ctf_Handle_Throw().

◆ ctf_FakeTimeLimit()

void ctf_FakeTimeLimit ( entity e,
float t )

Definition at line 95 of file sv_ctf.qc.

96{
97 msg_entity = e;
98 WriteByte(MSG_ONE, 3); // svc_updatestat
99 WriteByte(MSG_ONE, 236); // STAT_TIMELIMIT
100 if(t < 0)
102 else
103 WriteCoord(MSG_ONE, (t + 1) / 60);
104}
#define autocvar_timelimit
Definition stats.qh:92
WriteByte(chan, ent.angles.y/DEC_FACTOR)
float MSG_ONE
Definition menudefs.qc:56
void WriteCoord(float data, float dest, float desto)
entity msg_entity
Definition progsdefs.qc:63

References autocvar_timelimit, entity(), msg_entity, MSG_ONE, WriteByte(), and WriteCoord().

Referenced by ctf_Handle_Capture(), ctf_Handle_Pickup(), and ctf_RespawnFlag().

◆ ctf_FlagBase_Customize()

bool ctf_FlagBase_Customize ( entity this,
entity client )

Definition at line 1307 of file sv_ctf.qc.

1308{
1310 entity wp_owner = this.owner;
1311 entity flag = e.flagcarried;
1312 if(flag && CTF_SAMETEAM(e, flag))
1313 return false;
1314 if(flag && (flag.cnt || wp_owner.cnt) && wp_owner.cnt != flag.cnt)
1315 return false;
1316 return true;
1317}
entity owner
Definition main.qh:87
entity WaypointSprite_getviewentity(entity e)

References CTF_SAMETEAM, entity(), owner, and WaypointSprite_getviewentity().

Referenced by ctf_DelayedFlagSetup().

◆ ctf_FlagcarrierWaypoints()

void ctf_FlagcarrierWaypoints ( entity player)

Definition at line 160 of file sv_ctf.qc.

161{
162 WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, NULL, player.team, player, wps_flagcarrier, true, RADARICON_FLAG);
164 WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResource(player, RES_HEALTH), GetResource(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
165 WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team));
166
167 if(player.flagcarried && CTF_SAMETEAM(player, player.flagcarried))
168 {
169 if(!player.wps_enemyflagcarrier)
170 {
171 entity base_wp = WP_FlagCarrier;
172 if (!ctf_oneflag)
173 {
174 switch (player.team)
175 {
176 case NUM_TEAM_1: base_wp = WP_FlagCarrierEnemyRed; break;
177 case NUM_TEAM_2: base_wp = WP_FlagCarrierEnemyBlue; break;
178 case NUM_TEAM_3: base_wp = WP_FlagCarrierEnemyYellow; break;
179 case NUM_TEAM_4: base_wp = WP_FlagCarrierEnemyPink; break;
180 default: base_wp = WP_FlagCarrierEnemyNeutral; break;
181 }
182 }
183 entity wp = WaypointSprite_Spawn(base_wp, 0, 0, player, FLAG_WAYPOINT_OFFSET, NULL,
184 0, player, wps_enemyflagcarrier, true, RADARICON_FLAG);
185 wp.colormod = WPCOLOR_ENEMYFC(player.team);
187
188 if(IS_REAL_CLIENT(player) && !ctf_stalemate)
189 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_VISIBLE);
190 }
191
192 if(!player.wps_flagreturn)
193 {
194 entity owp = WaypointSprite_SpawnFixed(WP_FlagReturn, player.flagcarried.ctf_spawnorigin + FLAG_WAYPOINT_OFFSET, player, wps_flagreturn, RADARICON_FLAG);
195 owp.colormod = '0 0.8 0.8';
196 //WaypointSprite_UpdateTeamRadar(player.wps_flagreturn, RADARICON_FLAG, ((player.team) ? colormapPaletteColor(player.team - 1, false) : '1 1 1'));
198 }
199 }
200}
vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype)
Definition util.qc:1389
float autocvar_g_balance_armor_blockpercent
Definition damage.qh:21
RES_ARMOR
Definition ent_cs.qc:155
bool ctf_Return_Customize(entity this, entity client)
Definition sv_ctf.qc:154
entity wps_flagreturn
Definition sv_ctf.qh:108
entity wps_flagcarrier
Definition sv_ctf.qh:106
#define WPCOLOR_FLAGCARRIER(t)
Definition sv_ctf.qh:71
void WaypointSprite_UpdateMaxHealth(entity e, float f)
float start_armorvalue
Definition world.qh:97
float start_health
Definition world.qh:96

References autocvar_g_balance_armor_blockpercent, ctf_oneflag, ctf_Return_Customize(), CTF_SAMETEAM, ctf_stalemate, ctf_Stalemate_Customize(), entity(), FLAG_WAYPOINT_OFFSET, GetResource(), healtharmor_maxdamage(), IS_REAL_CLIENT, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, RES_ARMOR, Send_Notification(), setcefc, start_armorvalue, start_health, WaypointSprite_Spawn(), WaypointSprite_SpawnFixed(), WaypointSprite_UpdateHealth(), WaypointSprite_UpdateMaxHealth(), WaypointSprite_UpdateTeamRadar(), WPCOLOR_ENEMYFC, WPCOLOR_FLAGCARRIER, wps_enemyflagcarrier, wps_flagcarrier, and wps_flagreturn.

Referenced by ctf_Handle_Pickup(), and ctf_Handle_Retrieve().

◆ ctf_FlagDamage()

void ctf_FlagDamage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 979 of file sv_ctf.qc.

980{
981 if(ITEM_DAMAGE_NEEDKILL(deathtype))
982 {
984 this.ctf_flagdamaged_byworld = true;
985 else
986 {
987 SetResourceExplicit(this, RES_HEALTH, 0);
989 }
990 return;
991 }
993 {
994 // reduce health and check if it should be returned
995 TakeResource(this, RES_HEALTH, damage);
997 return;
998 }
999}
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
#define ITEM_DAMAGE_NEEDKILL(dt)
Definition items.qh:123
void ctf_CheckFlagReturn(entity flag, int returntype)
Definition sv_ctf.qc:852
float autocvar_g_ctf_flag_return_damage_delay
Definition sv_ctf.qc:61
bool ctf_flagdamaged_byworld
Definition sv_ctf.qh:151

References autocvar_g_ctf_flag_return_damage, autocvar_g_ctf_flag_return_damage_delay, ctf_CheckFlagReturn(), ctf_flagdamaged_byworld, entity(), ITEM_DAMAGE_NEEDKILL, RETURN_DAMAGE, RETURN_NEEDKILL, SetResourceExplicit(), TakeResource(), and vector.

Referenced by ctf_FlagSetup().

◆ ctf_FlagSetup()

void ctf_FlagSetup ( int teamnum,
entity flag )

Definition at line 1351 of file sv_ctf.qc.

1352{
1353 // main setup
1354 IL_PUSH(g_flags, flag);
1355
1356 setattachment(flag, NULL, "");
1357
1358 flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnum), Team_ColorName_Upper(teamnum)));
1359 flag.team = teamnum;
1360 flag.classname = "item_flag_team";
1361 flag.target = "###item###"; // for finding the nearest item using findnearest
1362 flag.flags = FL_ITEM | FL_NOTARGET;
1363 IL_PUSH(g_items, flag);
1364 flag.solid = SOLID_TRIGGER;
1365 flag.takedamage = DAMAGE_NO;
1366 flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
1367
1369 SetResourceExplicit(flag, RES_HEALTH, flag.max_health);
1370
1371 flag.event_damage = ctf_FlagDamage;
1372 flag.pushable = true;
1373 flag.teleportable = TELEPORT_NORMAL;
1374 flag.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP;
1375 flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable;
1376 flag.damagedbycontents = false; // can be damaged by contents only when dropped
1377
1378 flag.velocity = '0 0 0';
1379 flag.mangle = flag.angles;
1380 flag.reset = ctf_Reset;
1381 settouch(flag, ctf_FlagTouch);
1382 setthink(flag, ctf_FlagThink);
1383 flag.nextthink = time + FLAG_THINKRATE;
1384 flag.ctf_status = FLAG_BASE;
1385
1386 // set correct team colors
1387 flag.glowmod = Team_ColorRGB(teamnum);
1388 flag.colormap = (teamnum) ? (teamnum - 1) * 0x11 : 0x00;
1389 flag.colormap |= BIT(10); // RENDER_COLORMAPPED
1390
1391 // crudely force them all to 0
1393 flag.cnt = flag.score_assist = flag.score_team_capture = flag.score_capture = flag.score_drop = flag.score_pickup = flag.score_return = 0;
1394
1395 string teamname = Static_Team_ColorName_Lower(teamnum);
1396 // appearence
1397 if(!flag.scale) { flag.scale = FLAG_SCALE; }
1398 if(flag.skin == 0) { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); }
1399 if(flag.model == "") { flag.model = cvar_string(sprintf("g_ctf_flag_%s_model", teamname)); }
1400 if (flag.toucheffect == "") { flag.toucheffect = EFFECT_FLAG_TOUCH(teamnum).eent_eff_name; }
1401 if (flag.passeffect == "") { flag.passeffect = EFFECT_PASS(teamnum).eent_eff_name; }
1402 if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnum).eent_eff_name; }
1403
1404 // sounds
1405#define X(s,b) \
1406 if(flag.s == "") flag.s = b; \
1407 precache_sound(flag.s);
1408
1409 X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnum))))
1410 X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnum))))
1411 X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnum))))
1412 X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnum))))
1413 X(snd_flag_respawn, strzone(SND(CTF_RESPAWN)))
1414 X(snd_flag_touch, strzone(SND(CTF_TOUCH)))
1415 X(snd_flag_pass, strzone(SND(CTF_PASS)))
1416#undef X
1417
1418 // precache
1419 precache_model(flag.model);
1420
1421 // appearence
1422 _setmodel(flag, flag.model); // precision set below
1423 setsize(flag, vrint(CTF_FLAG.m_mins * flag.scale), vrint(CTF_FLAG.m_maxs * flag.scale));
1424 flag.m_mins = flag.mins; // store these for squash checks
1425 flag.m_maxs = flag.maxs;
1426 setorigin(flag, (flag.origin + FLAG_SPAWN_OFFSET));
1427
1429 {
1430 switch(teamnum)
1431 {
1432 case NUM_TEAM_1: flag.glow_color = 251; break;
1433 case NUM_TEAM_2: flag.glow_color = 210; break;
1434 case NUM_TEAM_3: flag.glow_color = 110; break;
1435 case NUM_TEAM_4: flag.glow_color = 145; break;
1436 default: flag.glow_color = 254; break;
1437 }
1438 flag.glow_size = 25;
1439 flag.glow_trail = 1;
1440 }
1441
1442 flag.effects |= EF_LOWPRECISION;
1443 if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; }
1445 {
1446 switch(teamnum)
1447 {
1448 case NUM_TEAM_1: flag.effects |= EF_RED; break;
1449 case NUM_TEAM_2: flag.effects |= EF_BLUE; break;
1450 case NUM_TEAM_3: flag.effects |= EF_DIMLIGHT; break;
1451 case NUM_TEAM_4: flag.effects |= EF_RED; break;
1452 default: flag.effects |= EF_DIMLIGHT; break;
1453 }
1454 }
1455
1456 // flag placement
1457 if((flag.spawnflags & 1) || flag.noalign) // don't drop to floor, just stay at fixed location
1458 {
1459 flag.dropped_origin = flag.origin;
1460 flag.noalign = true;
1462 }
1463 else // drop to floor, automatically find a platform and set that as spawn origin
1464 {
1465 flag.noalign = false;
1468 }
1469
1471}
const int INITPRIO_SETLOCATION
Definition constants.qh:98
const int FL_NOTARGET
Definition constants.qh:76
const int FL_ITEM
Definition constants.qh:77
float DPCONTENTS_SOLID
const float EF_RED
const float EF_FULLBRIGHT
float DPCONTENTS_PLAYERCLIP
const float EF_BLUE
const int EF_DIMLIGHT
float EF_LOWPRECISION
entity EFFECT_CAP(int teamid)
Definition all.inc:193
entity EFFECT_PASS(int teamid)
Definition all.inc:177
entity EFFECT_FLAG_TOUCH(int teamid)
Definition all.inc:161
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float cvar(string name)
const string cvar_string(string name)
string strzone(string s)
const int MOVETYPE_NONE
Definition movetypes.qh:133
#define setthink(e, f)
IntrusiveList g_items
Definition items.qh:119
#define SND(id)
Definition all.qh:35
const int DAMAGE_NO
Definition subs.qh:79
bool autocvar_g_ctf_flag_glowtrails
Definition sv_ctf.qc:53
bool autocvar_g_ctf_flag_return_when_unreachable
Definition sv_ctf.qc:59
bool autocvar_g_ctf_fullbrightflags
Definition sv_ctf.qc:73
bool autocvar_g_ctf_score_ignore_fields
Definition sv_ctf.qc:75
#define X(s, b)
void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition sv_ctf.qc:979
float autocvar_g_ctf_flag_damageforcescale
Definition sv_ctf.qc:50
void ctf_FlagThink(entity this)
Definition sv_ctf.qc:1001
float autocvar_g_ctf_flag_health
Definition sv_ctf.qc:54
bool autocvar_g_ctf_dynamiclights
Definition sv_ctf.qc:48
void ctf_DelayedFlagSetup(entity this)
Definition sv_ctf.qc:1319
void ctf_Reset(entity this)
Definition sv_ctf.qc:1298
#define snd_flag_returned
Definition sv_ctf.qh:77
const float FLAG_SCALE
Definition sv_ctf.qh:51
void ctf_FlagTouch(entity this, entity toucher)
Definition sv_ctf.qh:67
string snd_flag_touch
Definition sv_ctf.qh:81
#define snd_flag_capture
Definition sv_ctf.qh:78
#define snd_flag_respawn
Definition sv_ctf.qh:79
#define FLAG_SPAWN_OFFSET
Definition sv_ctf.qh:59
Flag CTF_FLAG
Definition sv_ctf.qh:47
string snd_flag_pass
Definition sv_ctf.qh:82
const float FLAG_THINKRATE
Definition sv_ctf.qh:53
#define snd_flag_taken
Definition sv_ctf.qh:76
string snd_flag_dropped
Definition sv_ctf.qh:80
#define Static_Team_ColorName_Lower(teamid)
Definition teams.qh:226
#define Team_ColorName_Upper(teamid)
Definition teams.qh:223
string Team_ColorCode(int teamid)
Definition teams.qh:63
const int TELEPORT_NORMAL
ERASEABLE vector vrint(vector v)
Definition vector.qh:224
void DropToFloor_QC_DelayedInit(entity this)
Definition world.qc:2427
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2229

References autocvar_g_ctf_dynamiclights, autocvar_g_ctf_flag_damageforcescale, autocvar_g_ctf_flag_glowtrails, autocvar_g_ctf_flag_health, autocvar_g_ctf_flag_return_damage, autocvar_g_ctf_flag_return_when_unreachable, autocvar_g_ctf_fullbrightflags, autocvar_g_ctf_score_ignore_fields, BIT, ctf_DelayedFlagSetup(), CTF_FLAG, ctf_FlagDamage(), ctf_FlagThink(), ctf_FlagTouch(), ctf_Reset(), cvar(), cvar_string(), DAMAGE_NO, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, DropToFloor_QC_DelayedInit(), EF_BLUE, EF_DIMLIGHT, EF_FULLBRIGHT, EF_LOWPRECISION, EF_RED, EFFECT_CAP(), EFFECT_FLAG_TOUCH(), EFFECT_PASS(), entity(), FL_ITEM, FL_NOTARGET, FLAG_BASE, FLAG_SCALE, FLAG_SPAWN_OFFSET, FLAG_THINKRATE, g_flags, g_items, IL_PUSH(), InitializeEntity(), INITPRIO_SETLOCATION, MOVETYPE_NONE, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, set_movetype(), SetResourceExplicit(), setthink, settouch, SND, snd_flag_capture, snd_flag_dropped, snd_flag_pass, snd_flag_respawn, snd_flag_returned, snd_flag_taken, snd_flag_touch, SOLID_TRIGGER, Static_Team_ColorName_Lower, strzone(), Team_ColorCode(), Team_ColorName_Upper, Team_ColorRGB(), TELEPORT_NORMAL, time, vrint(), and X.

Referenced by spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), and spawnfunc().

◆ ctf_FlagThink()

void ctf_FlagThink ( entity this)

Definition at line 1001 of file sv_ctf.qc.

1002{
1003 this.nextthink = time + FLAG_THINKRATE; // only 5 fps, more is unnecessary.
1004
1005 // sanity checks
1006 if(this.mins != this.m_mins || this.maxs != this.m_maxs) { // reset the flag boundaries in case it got squished
1007 tracebox(this.origin, this.m_mins, this.m_maxs, this.origin, MOVE_NOMONSTERS, this);
1008 if(!trace_startsolid || this.noalign) // can we resize it without getting stuck?
1009 setsize(this, this.m_mins, this.m_maxs);
1010 }
1011
1012 // main think method
1013 switch(this.ctf_status)
1014 {
1015 case FLAG_BASE:
1016 {
1018 {
1019 IL_EACH(g_flags, true,
1020 {
1021 if(it.ctf_status == FLAG_DROPPED)
1022 if(vdist(this.origin - it.origin, <, autocvar_g_ctf_dropped_capture_radius))
1023 if((this.noalign || it.ctf_landtime) && time > ((this.noalign) ? it.ctf_droptime : it.ctf_landtime) + autocvar_g_ctf_dropped_capture_delay)
1025 });
1026 }
1027 return;
1028 }
1029
1030 case FLAG_DROPPED:
1031 {
1032 this.angles = '0 0 0'; // reset flag angles in case warpzones adjust it
1033 if(IS_ONGROUND(this) && !this.ctf_landtime)
1034 this.ctf_landtime = time; // landtime is reset when thrown, and we don't want to restart the timer if the flag is pushed
1035
1037 {
1038 vector midpoint = ((this.absmin + this.absmax) * 0.5);
1039 if(pointcontents(midpoint) == CONTENT_WATER)
1040 {
1041 this.velocity *= 0.5;
1042
1043 if (pointcontents(midpoint + eZ * FLAG_FLOAT_OFFSET_Z) == CONTENT_WATER)
1044 { this.velocity_z = autocvar_g_ctf_flag_dropped_floatinwater; }
1045 else
1046 { set_movetype(this, MOVETYPE_FLY); }
1047 }
1048 else if(this.move_movetype == MOVETYPE_FLY) { set_movetype(this, MOVETYPE_TOSS); }
1049 }
1051 {
1053 {
1054 SetResourceExplicit(this, RES_HEALTH, 0);
1056 return;
1057 }
1058 }
1060 {
1063 return;
1064 }
1066 {
1069 return;
1070 }
1071 return;
1072 }
1073
1074 case FLAG_CARRY:
1075 {
1077 {
1078 SetResourceExplicit(this, RES_HEALTH, 0);
1080
1081 CS(this.owner).impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
1082 ImpulseCommands(this.owner);
1083 }
1085 {
1087 {
1089 wpforenemy_nextthink = time + WPFE_THINKRATE; // waypoint for enemy think rate (to reduce unnecessary spam of this check)
1090 }
1091 }
1092 if(CTF_SAMETEAM(this, this.owner) && this.team)
1093 {
1094 if(autocvar_g_ctf_flag_return) // drop the flag if reverse status has changed
1096 else if(vdist(this.owner.origin - this.ctf_spawnorigin, <=, autocvar_g_ctf_flag_return_carried_radius))
1097 ctf_Handle_Return(this, this.owner);
1098 }
1099 return;
1100 }
1101
1102 case FLAG_PASSING:
1103 {
1104 vector targ_origin = ((this.pass_target.absmin + this.pass_target.absmax) * 0.5);
1105 targ_origin = WarpZone_RefSys_TransformOrigin(this.pass_target, this, targ_origin); // origin of target as seen by the flag (us)
1106 WarpZone_TraceLine(this.origin, targ_origin, MOVE_NOMONSTERS, this);
1107
1108 if((this.pass_target == NULL)
1109 || (IS_DEAD(this.pass_target))
1110 || (this.pass_target.flagcarried)
1111 || (vdist(this.origin - targ_origin, >, autocvar_g_ctf_pass_radius))
1112 || ((trace_fraction < 1) && (trace_ent != this.pass_target))
1114 {
1115 // give up, pass failed
1117 }
1118 else
1119 {
1120 // still a viable target, go for it
1121 ctf_CalculatePassVelocity(this, targ_origin, this.origin, true);
1122 }
1123 return;
1124 }
1125
1126 default: // this should never happen
1127 {
1128 LOG_TRACE("ctf_FlagThink(): Flag exists with no status?");
1129 return;
1130 }
1131 }
1132}
bool speedrunning
Definition cheats.qh:22
float max_health
vector m_mins
Definition items.qc:18
vector m_maxs
Definition items.qc:18
#define IS_DEAD(s)
Definition player.qh:244
entity trace_ent
vector mins
vector velocity
const float CONTENT_WATER
float trace_startsolid
vector maxs
float nextthink
ent angles
Definition ent_cs.qc:146
vector WarpZone_RefSys_TransformOrigin(entity from, entity to, vector org)
Definition common.qc:739
#define LOG_TRACE(...)
Definition log.qh:74
float move_movetype
Definition movetypes.qh:80
const int MOVETYPE_FLY
Definition movetypes.qh:138
const int MOVETYPE_TOSS
Definition movetypes.qh:139
#define IS_ONGROUND(s)
Definition movetypes.qh:16
void ImpulseCommands(entity this)
Definition impulse.qc:371
bool noalign
Definition items.qh:37
ClientState CS(Client this)
Definition state.qh:47
void ctf_CalculatePassVelocity(entity flag, vector to, vector from, float turnrate)
Definition sv_ctf.qc:202
void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
Definition sv_ctf.qc:605
float autocvar_g_ctf_pass_timelimit
Definition sv_ctf.qc:46
void ctf_Handle_Drop(entity flag, entity player, int droptype)
Definition sv_ctf.qc:364
float autocvar_g_ctf_dropped_capture_delay
Definition sv_ctf.qc:92
void ctf_Handle_Return(entity flag, entity player)
Definition sv_ctf.qc:683
bool autocvar_g_ctf_flag_dropped_floatinwater
Definition sv_ctf.qc:52
float autocvar_g_ctf_flag_return_dropped
Definition sv_ctf.qc:62
float autocvar_g_ctf_flag_return_carried_radius
Definition sv_ctf.qc:57
void ctf_Handle_Throw(entity player, entity receiver, int droptype)
Definition sv_ctf.qc:479
void ctf_CheckStalemate()
Definition sv_ctf.qc:903
float autocvar_g_ctf_dropped_capture_radius
Definition sv_ctf.qc:93
bool autocvar_g_ctf_flag_return
Definition sv_ctf.qc:55
float wpforenemy_nextthink
Definition sv_ctf.qh:112
float ctf_landtime
Definition sv_ctf.qh:147
const int FLAG_FLOAT_OFFSET_Z
Definition sv_ctf.qh:61
const int CAPTURE_DROPPED
Definition sv_ctf.qh:129
#define ctf_spawnorigin
Definition sv_ctf.qh:142
int ctf_status
Definition sv_ctf.qh:148
const int DROP_PASS
Definition sv_ctf.qh:122
const float WPFE_THINKRATE
Definition sv_ctf.qh:55
entity pass_target
Definition sv_ctf.qh:157
float ctf_pickuptime
Definition sv_ctf.qh:145
const int DROP_THROW
Definition sv_ctf.qh:121
float ctf_droptime
Definition sv_ctf.qh:146
const int FLAG_CARRY
Definition sv_ctf.qh:117
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8

References absmax, absmin, angles, autocvar_g_ctf_dropped_capture_delay, autocvar_g_ctf_dropped_capture_radius, autocvar_g_ctf_flag_dropped_floatinwater, autocvar_g_ctf_flag_return, autocvar_g_ctf_flag_return_carried_radius, autocvar_g_ctf_flag_return_damage_delay, autocvar_g_ctf_flag_return_dropped, autocvar_g_ctf_flag_return_time, autocvar_g_ctf_pass_radius, autocvar_g_ctf_pass_timelimit, autocvar_g_ctf_stalemate, CAPTURE_DROPPED, CONTENT_WATER, CS(), ctf_CalculatePassVelocity(), ctf_captimerecord, ctf_CheckFlagReturn(), ctf_CheckStalemate(), ctf_droptime, ctf_flagdamaged_byworld, ctf_Handle_Capture(), ctf_Handle_Drop(), ctf_Handle_Return(), ctf_Handle_Throw(), ctf_landtime, ctf_pickuptime, CTF_SAMETEAM, ctf_spawnorigin, ctf_status, DROP_PASS, DROP_THROW, entity(), eZ, FLAG_BASE, FLAG_CARRY, FLAG_DROPPED, FLAG_FLOAT_OFFSET_Z, FLAG_PASSING, FLAG_THINKRATE, g_flags, IL_EACH, ImpulseCommands(), IS_DEAD, IS_ONGROUND, LOG_TRACE, m_maxs, m_mins, max_health, maxs, mins, move_movetype, MOVE_NOMONSTERS, MOVETYPE_FLY, MOVETYPE_TOSS, nextthink, noalign, NULL, origin, owner, pass_target, RETURN_DROPPED, RETURN_NEEDKILL, RETURN_SPEEDRUN, RETURN_TIMEOUT, set_movetype(), SetResourceExplicit(), speedrunning, TakeResource(), team, time, trace_ent, trace_fraction, trace_startsolid, vdist, vector, velocity, WarpZone_RefSys_TransformOrigin(), WarpZone_TraceLine(), WPFE_THINKRATE, and wpforenemy_nextthink.

Referenced by ctf_FlagSetup().

◆ ctf_Handle_Capture()

void ctf_Handle_Capture ( entity flag,
entity toucher,
int capturetype )

Definition at line 605 of file sv_ctf.qc.

606{
607 entity enemy_flag = ((capturetype == CAPTURE_NORMAL) ? toucher.flagcarried : toucher);
608 entity player = ((capturetype == CAPTURE_NORMAL) ? toucher : enemy_flag.ctf_dropper);
609 entity player_team_flag = NULL, tmp_entity;
610 float old_time, new_time;
611
612 if(!player) { return; } // without someone to give the reward to, we can't possibly cap
613 if(CTF_DIFFTEAM(player, flag)) { return; }
614 if((flag.cnt || enemy_flag.cnt) && flag.cnt != enemy_flag.cnt) { return; } // this should catch some edge cases (capturing grouped flag at ungrouped flag disallowed etc)
615
616 if (toucher.goalentity == flag.bot_basewaypoint)
617 toucher.goalentity_lock_timeout = 0;
618
619 if(ctf_oneflag)
620 {
621 IL_EACH(g_flags, SAME_TEAM(it, player),
622 {
623 player_team_flag = it;
624 break;
625 });
626 }
627
629
630 player.throw_prevtime = time;
631 player.throw_count = 0;
632
633 // messages and sounds
634 Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_NUM(enemy_flag.team, CENTER_CTF_CAPTURE));
635 ctf_CaptureRecord(enemy_flag, player);
636 _sound(player, CH_TRIGGER, ((ctf_oneflag) ? player_team_flag.snd_flag_capture : ((DIFF_TEAM(player, flag)) ? enemy_flag.snd_flag_capture : flag.snd_flag_capture)), VOL_BASE, ATTEN_NONE);
637
638 switch(capturetype)
639 {
640 case CAPTURE_NORMAL: ctf_EventLog("capture", enemy_flag.team, player); break;
641 case CAPTURE_DROPPED: ctf_EventLog("droppedcapture", enemy_flag.team, player); break;
642 default: break;
643 }
644
645 // scoring
646 float pscore = 0;
647 if(enemy_flag.score_capture || flag.score_capture)
648 pscore = floor((max(1, enemy_flag.score_capture) + max(1, flag.score_capture)) * 0.5);
649 GameRules_scoring_add_team(player, SCORE, ((pscore) ? pscore : autocvar_g_ctf_score_capture));
650 float capscore = 0;
651 if(enemy_flag.score_team_capture || flag.score_team_capture)
652 capscore = floor((max(1, enemy_flag.score_team_capture) + max(1, flag.score_team_capture)) * 0.5);
653 GameRules_scoring_add_team(player, CTF_CAPS, ((capscore) ? capscore : 1));
654
655 old_time = GameRules_scoring_add(player, CTF_CAPTIME, 0);
656 new_time = TIME_ENCODE(time - enemy_flag.ctf_pickuptime);
657 if(!old_time || new_time < old_time)
658 GameRules_scoring_add(player, CTF_CAPTIME, new_time - old_time);
659
660 // effects
661 Send_Effect_(flag.capeffect, flag.origin, '0 0 0', 1);
662#if 0
663 shockwave_spawn("models/ctf/shockwavetransring.md3", flag.origin - '0 0 15', -0.8, 0, 1);
664#endif
665
666 // other
667 if(capturetype == CAPTURE_NORMAL)
668 {
669 WaypointSprite_Kill(player.wps_flagcarrier);
670 if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); }
671
672 if((enemy_flag.ctf_dropper) && (player != enemy_flag.ctf_dropper))
673 { GameRules_scoring_add_team(enemy_flag.ctf_dropper, SCORE, ((enemy_flag.score_assist) ? enemy_flag.score_assist : autocvar_g_ctf_score_capture_assist)); }
674 }
675
676 flag.enemy = toucher;
677
678 // reset the flag
679 player.next_take_time = time + autocvar_g_ctf_flag_collect_delay;
680 ctf_RespawnFlag(enemy_flag);
681}
void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:125
float floor(float f)
float max(float f,...)
int autocvar_g_ctf_score_capture
Definition sv_ctf.qc:76
void nades_GiveBonus(entity player, float score)
Definition sv_nades.qc:445
void ctf_FakeTimeLimit(entity e, float t)
Definition sv_ctf.qc:95
float autocvar_g_ctf_flag_collect_delay
Definition sv_ctf.qc:49
void ctf_CaptureRecord(entity flag, entity player)
Definition sv_ctf.qc:113
int autocvar_g_ctf_score_capture_assist
Definition sv_ctf.qc:77
const int CAPTURE_NORMAL
Definition sv_ctf.qh:128
#define CTF_DIFFTEAM(a, b)
Definition sv_ctf.qh:186
int autocvar_g_nades_bonus_score_high
Definition sv_nades.qh:38
#define GameRules_scoring_add_team(client, fld, value)
Definition sv_rules.qh:89
#define SAME_TEAM(a, b)
Definition teams.qh:241
void WaypointSprite_Kill(entity wp)

References _sound, APP_NUM, ATTEN_NONE, autocvar_g_ctf_flag_collect_delay, autocvar_g_ctf_score_capture, autocvar_g_ctf_score_capture_assist, autocvar_g_nades_bonus_score_high, CAPTURE_DROPPED, CAPTURE_NORMAL, CH_TRIGGER, ctf_CaptureRecord(), CTF_DIFFTEAM, ctf_EventLog(), ctf_FakeTimeLimit(), ctf_oneflag, ctf_RespawnFlag(), DIFF_TEAM, entity(), floor(), g_flags, GameRules_scoring_add, GameRules_scoring_add_team, IL_EACH, max(), nades_GiveBonus(), NULL, SAME_TEAM, Send_Effect_(), Send_Notification(), time, TIME_ENCODE, toucher, VOL_BASE, and WaypointSprite_Kill().

Referenced by ctf_FlagThink().

◆ ctf_Handle_Drop()

void ctf_Handle_Drop ( entity flag,
entity player,
int droptype )

Definition at line 364 of file sv_ctf.qc.

365{
366 // declarations
367 player = (player ? player : flag.pass_sender);
368
369 // main
371 flag.takedamage = DAMAGE_YES;
372 flag.angles = '0 0 0';
373
375 SetResourceExplicit(flag, RES_HEALTH, flag.max_health);
376
377 flag.ctf_droptime = time;
378 flag.ctf_landtime = 0;
379 flag.ctf_dropper = player;
380 flag.ctf_status = FLAG_DROPPED;
381
382 flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable;
383 if(flag.damagedbycontents)
385
386 // messages and sounds
387 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_LOST), player.netname);
388 _sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE);
389 ctf_EventLog("dropped", player.team, player);
390
391 // scoring
392 GameRules_scoring_add_team(player, SCORE, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop));
393 GameRules_scoring_add(player, CTF_DROPS, 1);
394
395 // waypoints
397 entity base_wp;
398 switch (flag.team)
399 {
400 case NUM_TEAM_1: base_wp = WP_FlagDroppedRed; break;
401 case NUM_TEAM_2: base_wp = WP_FlagDroppedBlue; break;
402 case NUM_TEAM_3: base_wp = WP_FlagDroppedYellow; break;
403 case NUM_TEAM_4: base_wp = WP_FlagDroppedPink; break;
404 default: base_wp = WP_FlagDroppedNeutral; break;
405 }
406 int wp_team = ((autocvar_g_ctf_flag_dropped_waypoint == 2) ? 0 : player.team);
407 entity wp = WaypointSprite_Spawn(base_wp, 0, 0, flag, FLAG_WAYPOINT_OFFSET, NULL,
408 wp_team, flag, wps_flagdropped, true, RADARICON_FLAG);
409 wp.colormod = WPCOLOR_DROPPEDFLAG(flag.team);
410 }
411
413 {
414 WaypointSprite_UpdateMaxHealth(flag.wps_flagdropped, flag.max_health);
415 WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(flag, RES_HEALTH));
416 }
417
418 player.throw_antispam = time + autocvar_g_ctf_pass_wait;
419
420 if(droptype == DROP_PASS)
421 {
422 flag.pass_distance = 0;
423 flag.pass_sender = NULL;
424 flag.pass_target = NULL;
425 }
426}
IntrusiveList g_damagedbycontents
Definition damage.qh:143
const int DAMAGE_YES
Definition subs.qh:80
bool autocvar_g_ctf_flag_dropped_waypoint
Definition sv_ctf.qc:51
float autocvar_g_ctf_pass_wait
Definition sv_ctf.qc:43
int autocvar_g_ctf_score_penalty_drop
Definition sv_ctf.qc:79
entity wps_flagdropped
Definition sv_ctf.qh:107
#define WPCOLOR_DROPPEDFLAG(t)
Definition sv_ctf.qh:73

References _sound, APP_NUM, ATTEN_NONE, autocvar_g_ctf_flag_dropped_waypoint, autocvar_g_ctf_flag_health, autocvar_g_ctf_flag_return_damage, autocvar_g_ctf_flag_return_time, autocvar_g_ctf_flag_return_when_unreachable, autocvar_g_ctf_pass_wait, autocvar_g_ctf_score_penalty_drop, CH_TRIGGER, ctf_EventLog(), DAMAGE_YES, DROP_PASS, entity(), FLAG_DROPPED, FLAG_WAYPOINT_OFFSET, g_damagedbycontents, GameRules_scoring_add, GameRules_scoring_add_team, GetResource(), IL_PUSH(), MOVETYPE_TOSS, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, Send_Notification(), set_movetype(), SetResourceExplicit(), time, VOL_BASE, WaypointSprite_Spawn(), WaypointSprite_UpdateHealth(), WaypointSprite_UpdateMaxHealth(), WPCOLOR_DROPPEDFLAG, and wps_flagdropped.

Referenced by ctf_FlagThink(), and ctf_Handle_Throw().

◆ ctf_Handle_Pickup()

void ctf_Handle_Pickup ( entity flag,
entity player,
int pickuptype )

Definition at line 726 of file sv_ctf.qc.

727{
728 // declarations
729 float pickup_dropped_score; // used to calculate dropped pickup score
730
731 if(autocvar_g_ctf_flag_stay && pickuptype == PICKUP_BASE)
732 {
733 entity newflag = spawn();
734 copyentity_qc(flag, newflag);
735 newflag.classname = "phantomflag"; // identifier for other code
736 IL_PUSH(g_moveables, newflag); // cleared by copyentity_qc
737 IL_PUSH(g_flags, newflag);
738 // uncomment for "ghostly" phantom flag appearance (may look bad)
739 //newflag.effects |= EF_ADDITIVE;
740 flag = newflag;
741 }
742
743 // attach the flag to the player
744 flag.owner = player;
745 player.flagcarried = flag;
746 GameRules_scoring_vip(player, true);
747 flag.solid = SOLID_NOT; // before setorigin to prevent area grid linking
748 if(player.vehicle)
749 {
750 setattachment(flag, player.vehicle, "");
751 setorigin(flag, VEHICLE_FLAG_OFFSET);
752 flag.scale = VEHICLE_FLAG_SCALE;
753 }
754 else
755 {
756 setattachment(flag, player, "");
757 setorigin(flag, FLAG_CARRY_OFFSET);
758 }
759
760 // flag setup
762 flag.takedamage = DAMAGE_NO;
763 flag.angles = '0 0 0';
764 flag.ctf_status = FLAG_CARRY;
765
766 flag.damagedbycontents = false;
769
771
772 switch(pickuptype)
773 {
774 case PICKUP_BASE: flag.ctf_pickuptime = time; break; // used for timing runs
775 case PICKUP_DROPPED: SetResourceExplicit(flag, RES_HEALTH, flag.max_health); break; // reset health/return timelimit
776 default: break;
777 }
778
779 // messages and sounds
780 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_PICKUP), player.netname);
781 if(ctf_stalemate)
782 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER);
783 if(!flag.team)
784 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL);
785 else if(CTF_DIFFTEAM(player, flag))
786 Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_NUM(flag.team, CENTER_CTF_PICKUP));
787 else
788 Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_RETURN : CENTER_CTF_PICKUP_RETURN_ENEMY), Team_ColorCode(flag.team));
789
790 Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
791
792 if(!flag.team)
793 FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), { Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); });
794
795 if(flag.team)
796 FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
797 if(CTF_SAMETEAM(flag, it))
798 Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
799 else if(DIFF_TEAM(player, it))
800 Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_ENEMY_OTHER), Team_ColorCode(player.team), player.netname);
801 });
802
803 _sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
804
805 // scoring
806 GameRules_scoring_add(player, CTF_PICKUPS, 1);
808 switch(pickuptype)
809 {
810 case PICKUP_BASE:
811 {
812 GameRules_scoring_add_team(player, SCORE, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base));
813 ctf_EventLog("steal", flag.team, player);
814 break;
815 }
816
817 case PICKUP_DROPPED:
818 {
819 pickup_dropped_score = (autocvar_g_ctf_flag_return_time > 0 ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_return_time) - time) / autocvar_g_ctf_flag_return_time, 1) : 1);
820 pickup_dropped_score = floor((autocvar_g_ctf_score_pickup_dropped_late * (1 - pickup_dropped_score) + autocvar_g_ctf_score_pickup_dropped_early * pickup_dropped_score) + 0.5);
821 LOG_TRACE("pickup_dropped_score is ", ftos(pickup_dropped_score));
822 GameRules_scoring_add_team(player, SCORE, pickup_dropped_score);
823 ctf_EventLog("pickup", flag.team, player);
824 break;
825 }
826
827 default: break;
828 }
829
830 // speedrunning
831 if(pickuptype == PICKUP_BASE)
832 {
833 flag.speedrunning = player.speedrunning; // if speedrunning, flag will flag-return and teleport the owner back after the record
834 if((player.speedrunning) && (ctf_captimerecord))
836 }
837
838 // effects
839 Send_Effect_(flag.toucheffect, player.origin, '0 0 0', 1);
840
841 // waypoints
842 if(pickuptype == PICKUP_DROPPED) { WaypointSprite_Kill(flag.wps_flagdropped); }
844 WaypointSprite_Ping(player.wps_flagcarrier);
845}
const float SOLID_NOT
#define spawn
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
float bound(float min, float value, float max)
@ STATUSEFFECT_REMOVE_CLEAR
Effect is being forcibly removed without calling any additional mechanics.
Definition all.qh:30
void copyentity_qc(entity src, entity dst)
Definition oo.qh:88
void StatusEffects_removeall(entity actor, int removal_type)
int autocvar_g_ctf_score_pickup_dropped_late
Definition sv_ctf.qc:83
int autocvar_g_ctf_score_pickup_dropped_early
Definition sv_ctf.qc:82
void ctf_FlagcarrierWaypoints(entity player)
Definition sv_ctf.qc:160
int autocvar_g_ctf_score_pickup_base
Definition sv_ctf.qc:81
bool autocvar_g_ctf_flag_stay
Definition sv_ctf.qc:63
const int PICKUP_BASE
Definition sv_ctf.qh:125
const vector VEHICLE_FLAG_OFFSET
Definition sv_ctf.qh:64
const int PICKUP_DROPPED
Definition sv_ctf.qh:126
const float VEHICLE_FLAG_SCALE
Definition sv_ctf.qh:65
const vector FLAG_CARRY_OFFSET
Definition sv_ctf.qh:58
int autocvar_g_nades_bonus_score_minor
Definition sv_nades.qh:36
#define GameRules_scoring_vip(player, value)
Definition sv_rules.qh:78
void WaypointSprite_Ping(entity e)
IntrusiveList g_moveables
Definition world.qh:157

References _sound, APP_NUM, APP_TEAM_NUM, ATTEN_NONE, autocvar_g_ctf_flag_return_time, autocvar_g_ctf_flag_stay, autocvar_g_ctf_score_pickup_base, autocvar_g_ctf_score_pickup_dropped_early, autocvar_g_ctf_score_pickup_dropped_late, autocvar_g_nades_bonus_score_minor, bound(), CH_TRIGGER, copyentity_qc(), ctf_captimerecord, CTF_DIFFTEAM, ctf_EventLog(), ctf_FakeTimeLimit(), ctf_FlagcarrierWaypoints(), CTF_SAMETEAM, ctf_stalemate, DAMAGE_NO, DIFF_TEAM, entity(), FLAG_CARRY, FLAG_CARRY_OFFSET, floor(), FOREACH_CLIENT, ftos(), g_damagedbycontents, g_flags, g_moveables, GameRules_scoring_add, GameRules_scoring_add_team, GameRules_scoring_vip, IL_CONTAINS(), IL_PUSH(), IL_REMOVE(), IS_PLAYER, LOG_TRACE, MOVETYPE_NONE, nades_GiveBonus(), NULL, PICKUP_BASE, PICKUP_DROPPED, SAME_TEAM, Send_Effect_(), Send_Notification(), set_movetype(), SetResourceExplicit(), SOLID_NOT, spawn, STATUSEFFECT_REMOVE_CLEAR, StatusEffects_removeall(), Team_ColorCode(), time, VEHICLE_FLAG_OFFSET, VEHICLE_FLAG_SCALE, VOL_BASE, WaypointSprite_Kill(), and WaypointSprite_Ping().

◆ ctf_Handle_Retrieve()

void ctf_Handle_Retrieve ( entity flag,
entity player )

Definition at line 428 of file sv_ctf.qc.

429{
430 entity sender = flag.pass_sender;
431
432 // transfer flag to player
433 flag.owner = player;
434 flag.owner.flagcarried = flag;
435 GameRules_scoring_vip(player, true);
436
437 // reset flag
438 flag.solid = SOLID_NOT; // before setorigin to prevent area grid linking
439 if(player.vehicle)
440 {
441 setattachment(flag, player.vehicle, "");
442 setorigin(flag, VEHICLE_FLAG_OFFSET);
443 flag.scale = VEHICLE_FLAG_SCALE;
444 }
445 else
446 {
447 setattachment(flag, player, "");
448 setorigin(flag, FLAG_CARRY_OFFSET);
449 }
451 flag.takedamage = DAMAGE_NO;
452 flag.angles = '0 0 0';
453 flag.ctf_status = FLAG_CARRY;
454
455 // messages and sounds
456 _sound(player, CH_TRIGGER, flag.snd_flag_pass, VOL_BASE, ATTEN_NORM);
457 ctf_EventLog("receive", flag.team, player);
458
460 if(it == sender)
461 Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_SENT), player.netname);
462 else if(it == player)
463 Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_RECEIVED), sender.netname);
464 else if(SAME_TEAM(it, sender))
465 Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_NUM(flag.team, CENTER_CTF_PASS_OTHER), sender.netname, player.netname);
466 });
467
468 // create new waypoint
470
471 sender.throw_antispam = time + autocvar_g_ctf_pass_wait;
472 player.throw_antispam = sender.throw_antispam;
473
474 flag.pass_distance = 0;
475 flag.pass_sender = NULL;
476 flag.pass_target = NULL;
477}
const float ATTEN_NORM
Definition sound.qh:30

References _sound, APP_NUM, ATTEN_NORM, autocvar_g_ctf_pass_wait, CH_TRIGGER, ctf_EventLog(), ctf_FlagcarrierWaypoints(), DAMAGE_NO, entity(), FLAG_CARRY, FLAG_CARRY_OFFSET, FOREACH_CLIENT, GameRules_scoring_vip, IS_PLAYER, IS_REAL_CLIENT, MOVETYPE_NONE, NULL, SAME_TEAM, Send_Notification(), set_movetype(), SOLID_NOT, time, VEHICLE_FLAG_OFFSET, VEHICLE_FLAG_SCALE, and VOL_BASE.

◆ ctf_Handle_Return()

void ctf_Handle_Return ( entity flag,
entity player )

Definition at line 683 of file sv_ctf.qc.

684{
685 // messages and sounds
686 if(IS_MONSTER(player))
687 {
688 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(flag.team, INFO_CTF_RETURN_MONSTER), player.m_name);
689 }
690 else if(flag.team)
691 {
692 Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_NUM(flag.team, CENTER_CTF_RETURN));
693 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(flag.team, INFO_CTF_RETURN), player.netname);
694 }
695 _sound(player, CH_TRIGGER, flag.snd_flag_returned, VOL_BASE, ATTEN_NONE);
696 ctf_EventLog("return", flag.team, player);
697
698 // scoring
699 if(IS_PLAYER(player))
700 {
701 GameRules_scoring_add_team(player, SCORE, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return
702 GameRules_scoring_add(player, CTF_RETURNS, 1); // add to count of returns
703
705 }
706
707 TeamScore_AddToTeam(flag.team, ST_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the team who was last carrying it
708
709 if(flag.ctf_dropper)
710 {
711 GameRules_scoring_add(flag.ctf_dropper, SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the player who dropped the flag
712 ctf_CaptureShield_Update(flag.ctf_dropper, 0); // shield player from picking up flag
713 flag.ctf_dropper.next_take_time = time + autocvar_g_ctf_flag_collect_delay; // set next take time
714 }
715
716 // other
717 if(player.flagcarried == flag)
718 WaypointSprite_Kill(player.wps_flagcarrier);
719
720 flag.enemy = player;
721
722 // reset the flag
723 ctf_RespawnFlag(flag);
724}
const int ST_SCORE
Definition scores.qh:158
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition scores.qc:108
void ctf_CaptureShield_Update(entity player, bool wanted_status)
Definition sv_ctf.qc:310
int autocvar_g_ctf_score_return
Definition sv_ctf.qc:84
int autocvar_g_ctf_score_penalty_returned
Definition sv_ctf.qc:80
int autocvar_g_nades_bonus_score_medium
Definition sv_nades.qh:39
#define IS_MONSTER(v)
Definition utils.qh:23

References _sound, APP_TEAM_NUM, ATTEN_NONE, autocvar_g_ctf_flag_collect_delay, autocvar_g_ctf_score_penalty_returned, autocvar_g_ctf_score_return, autocvar_g_nades_bonus_score_medium, CH_TRIGGER, ctf_CaptureShield_Update(), ctf_EventLog(), ctf_RespawnFlag(), entity(), GameRules_scoring_add, GameRules_scoring_add_team, IS_MONSTER, IS_PLAYER, nades_GiveBonus(), NULL, Send_Notification(), ST_SCORE, TeamScore_AddToTeam(), time, VOL_BASE, and WaypointSprite_Kill().

Referenced by ctf_FlagThink().

◆ ctf_Handle_Throw()

void ctf_Handle_Throw ( entity player,
entity receiver,
int droptype )

Definition at line 479 of file sv_ctf.qc.

480{
481 entity flag = player.flagcarried;
482 vector targ_origin, flag_velocity;
483
484 if(!flag) { return; }
485 if((droptype == DROP_PASS) && !receiver) { return; }
486
487 if(flag.speedrunning || flag.classname == "phantomflag")
488 {
489 // ensure old waypoints are removed before resetting the flag
490 WaypointSprite_Kill(player.wps_flagcarrier);
491
492 if(player.wps_enemyflagcarrier)
493 WaypointSprite_Kill(player.wps_enemyflagcarrier);
494
495 if(player.wps_flagreturn)
496 WaypointSprite_Kill(player.wps_flagreturn);
497 ctf_RespawnFlag(flag);
498 return;
499 }
500
501 // reset the flag
502 setattachment(flag, NULL, "");
503 tracebox(player.origin + vec3(0, 0, player.mins.z - flag.m_mins.z), // same bbox floor height as player
504 flag.m_mins, flag.m_maxs, player.origin + FLAG_DROP_OFFSET, MOVE_NOMONSTERS, flag);
505 flag.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking
506 setorigin(flag, trace_endpos);
507 if (trace_startsolid && !nudgeoutofsolid_OrFallback(flag)) // TODO: trace_allsolid would perform better but isn't 100% reliable yet
508 {
509 // the flag's bbox doesn't fit but we can assume the player's current bbox does
510 tracebox(player.origin, player.mins, player.maxs, player.origin + FLAG_DROP_OFFSET, MOVE_NOMONSTERS, flag);
511 flag.origin = trace_endpos;
512 setsize(flag, player.mins, player.maxs); // this allows physics to move the flag somewhere its think func can resize it
513 }
514 flag.owner.flagcarried = NULL;
515 GameRules_scoring_vip(flag.owner, false);
516 flag.owner = NULL;
517 flag.ctf_dropper = player;
518 flag.ctf_droptime = time;
519 flag.ctf_landtime = 0;
520
521 flag.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND for MOVETYPE_TOSS
522
523 switch(droptype)
524 {
525 case DROP_PASS:
526 {
527 // warpzone support:
528 // for the examples, we assume player -> wz1 -> ... -> wzn -> receiver
529 // findradius has already put wzn ... wz1 into receiver's warpzone parameters!
530 WarpZone_RefSys_Copy(flag, receiver);
531 WarpZone_RefSys_AddInverse(flag, receiver); // wz1^-1 ... wzn^-1 receiver
532 targ_origin = WarpZone_RefSys_TransformOrigin(receiver, flag, (0.5 * (receiver.absmin + receiver.absmax))); // this is target origin as seen by the flag
533
534 flag.pass_distance = vlen((('1 0 0' * targ_origin.x) + ('0 1 0' * targ_origin.y)) - (('1 0 0' * player.origin.x) + ('0 1 0' * player.origin.y))); // for the sake of this check, exclude Z axis
535 ctf_CalculatePassVelocity(flag, targ_origin, player.origin, false);
536
537 // main
539 flag.takedamage = DAMAGE_NO;
540 flag.pass_sender = player;
541 flag.pass_target = receiver;
542 flag.ctf_status = FLAG_PASSING;
543
544 // other
545 _sound(player, CH_TRIGGER, flag.snd_flag_touch, VOL_BASE, ATTEN_NORM);
546 WarpZone_TrailParticles(NULL, _particleeffectnum(flag.passeffect), player.origin, targ_origin);
547 ctf_EventLog("pass", flag.team, player);
548 break;
549 }
550
551 case DROP_THROW:
552 {
553 makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
554
556 flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, flag_velocity, false);
557 ctf_Handle_Drop(flag, player, droptype);
558 navigation_dynamicgoal_set(flag, player);
559 break;
560 }
561
562 case DROP_RESET:
563 {
564 flag.velocity = '0 0 0'; // do nothing
565 break;
566 }
567
568 default:
569 case DROP_NORMAL:
570 {
571 flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
572 ctf_Handle_Drop(flag, player, droptype);
573 navigation_dynamicgoal_set(flag, player);
574 break;
575 }
576 }
577
578 // kill old waypointsprite
579 WaypointSprite_Ping(player.wps_flagcarrier);
580 WaypointSprite_Kill(player.wps_flagcarrier);
581
582 if(player.wps_enemyflagcarrier)
583 WaypointSprite_Kill(player.wps_enemyflagcarrier);
584
585 if(player.wps_flagreturn)
586 WaypointSprite_Kill(player.wps_flagreturn);
587
588 // captureshield
589 ctf_CaptureShield_Update(player, 0); // shield player from picking up flag
590}
void navigation_dynamicgoal_set(entity this, entity dropper)
Definition navigation.qc:87
void WarpZone_TrailParticles(entity own, float eff, vector org, vector end)
Definition common.qc:451
void WarpZone_RefSys_AddInverse(entity me, entity wz)
Definition common.qc:717
void WarpZone_RefSys_Copy(entity me, entity from)
Definition common.qc:771
#define crandom()
Returns a random number between -1.0 and 1.0.
Definition random.qh:32
bool StatusEffects_active(StatusEffect this, entity actor)
float autocvar_g_ctf_throw_velocity_forward
Definition sv_ctf.qc:31
float autocvar_g_ctf_throw_velocity_up
Definition sv_ctf.qc:32
float autocvar_g_ctf_drop_velocity_up
Definition sv_ctf.qc:33
float autocvar_g_ctf_throw_strengthmultiplier
Definition sv_ctf.qc:30
float autocvar_g_ctf_throw_angle_min
Definition sv_ctf.qc:26
float autocvar_g_ctf_drop_velocity_side
Definition sv_ctf.qc:34
float autocvar_g_ctf_throw_angle_max
Definition sv_ctf.qc:25
const int DROP_NORMAL
Definition sv_ctf.qh:120
const int DROP_RESET
Definition sv_ctf.qh:123
const vector FLAG_DROP_OFFSET
Definition sv_ctf.qh:57
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition tracing.qc:174
#define vec3(_x, _y, _z)
Definition vector.qh:100

References _sound, ATTEN_NORM, autocvar_g_ctf_drop_velocity_side, autocvar_g_ctf_drop_velocity_up, autocvar_g_ctf_throw_angle_max, autocvar_g_ctf_throw_angle_min, autocvar_g_ctf_throw_strengthmultiplier, autocvar_g_ctf_throw_velocity_forward, autocvar_g_ctf_throw_velocity_up, bound(), CH_TRIGGER, crandom, ctf_CalculatePassVelocity(), ctf_CaptureShield_Update(), ctf_EventLog(), ctf_Handle_Drop(), ctf_RespawnFlag(), DAMAGE_NO, DROP_NORMAL, DROP_PASS, DROP_RESET, DROP_THROW, entity(), FL_ITEM, FL_NOTARGET, FLAG_DROP_OFFSET, FLAG_PASSING, GameRules_scoring_vip, makevectors, MOVE_NOMONSTERS, MOVETYPE_FLY, navigation_dynamicgoal_set(), NULL, set_movetype(), SOLID_TRIGGER, StatusEffects_active(), time, trace_endpos, trace_startsolid, v_forward, vec3, vector, vlen(), VOL_BASE, W_CalculateProjectileVelocity(), WarpZone_RefSys_AddInverse(), WarpZone_RefSys_Copy(), WarpZone_RefSys_TransformOrigin(), WarpZone_TrailParticles(), WaypointSprite_Kill(), and WaypointSprite_Ping().

Referenced by ctf_FlagThink(), ctf_RemovePlayer(), ctf_Reset(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ ctf_Immediate_Return_Allowed()

bool ctf_Immediate_Return_Allowed ( entity flag,
entity toucher )

Definition at line 144 of file sv_ctf.qc.

145{
146 int num_perteam = 0;
147 FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(toucher, it), { ++num_perteam; });
148
149 // automatically return if there's only 1 player on the team
150 return ((autocvar_g_ctf_flag_return || num_perteam <= 1 || (autocvar_g_ctf_flag_return_carrying && toucher.flagcarried))
151 && flag.team);
152}
bool autocvar_g_ctf_flag_return_carrying
Definition sv_ctf.qc:56

References autocvar_g_ctf_flag_return, autocvar_g_ctf_flag_return_carrying, entity(), FOREACH_CLIENT, IS_PLAYER, SAME_TEAM, and toucher.

◆ ctf_Initialize()

void ctf_Initialize ( )

Definition at line 2898 of file sv_ctf.qc.

2899{
2900 CTF_FLAG = NEW(Flag);
2902 ctf_captimerecord = stof(db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time")));
2903
2907
2909}
Definition sv_ctf.qh:37
#define CTF_RECORD
Definition util.qh:99
const int INITPRIO_GAMETYPE
Definition constants.qh:94
float stof(string val,...)
#define NEW(cname,...)
Definition oo.qh:120
int autocvar_g_ctf_shield_min_negscore
Definition sv_ctf.qc:87
float autocvar_g_ctf_shield_max_ratio
Definition sv_ctf.qc:86
float autocvar_g_ctf_shield_force
Definition sv_ctf.qc:85
void ctf_DelayedInit(entity this)
Definition sv_ctf.qc:2862
string record_type
Definition world.qh:55

References autocvar_g_ctf_shield_force, autocvar_g_ctf_shield_max_ratio, autocvar_g_ctf_shield_min_negscore, ctf_captimerecord, ctf_captureshield_force, ctf_captureshield_max_ratio, ctf_captureshield_min_negscore, ctf_DelayedInit(), CTF_FLAG, CTF_RECORD, db_get(), GetMapname(), InitializeEntity(), INITPRIO_GAMETYPE, NEW, NULL, record_type, ServerProgsDB, stof(), and strcat().

Referenced by REGISTER_MUTATOR().

◆ ctf_RemovePlayer()

void ctf_RemovePlayer ( entity player)

Definition at line 2372 of file sv_ctf.qc.

2373{
2374 if(player.flagcarried)
2375 { ctf_Handle_Throw(player, NULL, DROP_NORMAL); }
2376
2377 IL_EACH(g_flags, true,
2378 {
2379 if(it.pass_sender == player) { it.pass_sender = NULL; }
2380 if(it.pass_target == player) { it.pass_target = NULL; }
2381 if(it.ctf_dropper == player) { it.ctf_dropper = NULL; }
2382 });
2383}

References ctf_Handle_Throw(), DROP_NORMAL, entity(), g_flags, IL_EACH, and NULL.

Referenced by MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ ctf_Reset()

void ctf_Reset ( entity this)

Definition at line 1298 of file sv_ctf.qc.

1299{
1300 if(this.owner && IS_PLAYER(this.owner))
1302
1303 this.enemy = NULL;
1304 ctf_RespawnFlag(this);
1305}
entity enemy
Definition sv_ctf.qh:152

References ctf_Handle_Throw(), ctf_RespawnFlag(), DROP_RESET, enemy, entity(), IS_PLAYER, NULL, and owner.

Referenced by ctf_FlagSetup().

◆ ctf_RespawnFlag()

void ctf_RespawnFlag ( entity flag)

Definition at line 1237 of file sv_ctf.qc.

1238{
1239 flag.watertype = CONTENT_EMPTY; // TODO: it is unclear why this workaround is needed, likely many other potential breakage points!!
1240
1241 // reset the player (if there is one)
1242 if((flag.owner) && (flag.owner.flagcarried == flag))
1243 {
1244 WaypointSprite_Kill(flag.owner.wps_enemyflagcarrier);
1245 WaypointSprite_Kill(flag.owner.wps_flagreturn);
1246 WaypointSprite_Kill(flag.wps_flagcarrier);
1247
1248 flag.owner.flagcarried = NULL;
1249 GameRules_scoring_vip(flag.owner, false);
1250
1251 if(flag.speedrunning)
1252 ctf_FakeTimeLimit(flag.owner, -1);
1253 }
1254
1255 if((flag.owner) && (flag.owner.vehicle))
1256 flag.scale = FLAG_SCALE;
1257
1258 if(flag.ctf_status == FLAG_DROPPED)
1259 { WaypointSprite_Kill(flag.wps_flagdropped); }
1260
1261 // reset the flag
1262 setattachment(flag, NULL, "");
1263 flag.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking
1264 setorigin(flag, flag.ctf_spawnorigin);
1265
1266 //set_movetype(flag, ((flag.noalign) ? MOVETYPE_NONE : MOVETYPE_TOSS)); // would be desired, except maps that want floating flags have it set to fall!
1267 set_movetype(flag, MOVETYPE_NONE); // match the initial setup handling (flag doesn't move when spawned)
1268 flag.takedamage = DAMAGE_NO;
1269 SetResourceExplicit(flag, RES_HEALTH, flag.max_health);
1270 flag.velocity = '0 0 0';
1271 flag.angles = flag.mangle;
1272 flag.flags = FL_ITEM | FL_NOTARGET;
1273
1274 flag.damagedbycontents = false;
1277
1279
1280 flag.ctf_status = FLAG_BASE;
1281 flag.owner = NULL;
1282 flag.pass_distance = 0;
1283 flag.pass_sender = NULL;
1284 flag.pass_target = NULL;
1285 flag.ctf_dropper = NULL;
1286 flag.ctf_pickuptime = 0;
1287 flag.ctf_droptime = 0;
1288 flag.ctf_landtime = 0;
1289 flag.ctf_flagdamaged_byworld = false;
1291
1293
1294 if(flag.classname == "phantomflag")
1295 delete(flag);
1296}
void navigation_dynamicgoal_unset(entity this)
Definition navigation.qc:96
const float CONTENT_EMPTY

References CONTENT_EMPTY, ctf_CheckStalemate(), ctf_FakeTimeLimit(), DAMAGE_NO, entity(), FL_ITEM, FL_NOTARGET, FLAG_BASE, FLAG_DROPPED, FLAG_SCALE, g_damagedbycontents, GameRules_scoring_vip, IL_CONTAINS(), IL_REMOVE(), MOVETYPE_NONE, navigation_dynamicgoal_unset(), NULL, set_movetype(), SetResourceExplicit(), SOLID_TRIGGER, STATUSEFFECT_REMOVE_CLEAR, StatusEffects_removeall(), and WaypointSprite_Kill().

Referenced by ctf_CheckFlagReturn(), ctf_Handle_Capture(), ctf_Handle_Return(), ctf_Handle_Throw(), ctf_Reset(), and MUTATOR_HOOKFUNCTION().

◆ ctf_Return_Customize()

bool ctf_Return_Customize ( entity this,
entity client )

Definition at line 154 of file sv_ctf.qc.

155{
156 // only to the carrier
157 return boolean(client == this.owner);
158}
#define boolean(value)
Definition bool.qh:9

References boolean, entity(), and owner.

Referenced by ctf_FlagcarrierWaypoints().

◆ ctf_ScoreRules()

void ctf_ScoreRules ( int teams)

Definition at line 2849 of file sv_ctf.qc.

2850{
2852 field_team(ST_CTF_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
2853 field(SP_CTF_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
2854 field(SP_CTF_CAPTIME, "captime", SFL_LOWER_IS_BETTER | SFL_TIME);
2855 field(SP_CTF_PICKUPS, "pickups", 0);
2856 field(SP_CTF_FCKILLS, "fckills", 0);
2857 field(SP_CTF_RETURNS, "returns", 0);
2858 field(SP_CTF_DROPS, "drops", SFL_LOWER_IS_BETTER);
2859 });
2860}
entity teams
Definition main.qh:58
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition scores.qh:102
const int SFL_TIME
Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!...
Definition scores.qh:122
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
const int ST_CTF_CAPS
Definition sv_ctf.qh:33
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition sv_rules.qh:58

References GameRules_scoring, SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, SFL_TIME, ST_CTF_CAPS, and teams.

Referenced by ctf_DelayedInit().

◆ ctf_Stalemate_Customize()

bool ctf_Stalemate_Customize ( entity this,
entity client )

Definition at line 887 of file sv_ctf.qc.

888{
889 // make spectators see what the player would see
891 entity wp_owner = this.owner;
892
893 // team waypoints
894 //if(CTF_SAMETEAM(wp_owner.flagcarried, wp_owner)) { return false; }
895 if(SAME_TEAM(wp_owner, e) || !IS_PLAYER(e))
896 return false;
897 if(IS_INVISIBLE(wp_owner))
898 return false; // hide the waypointsprite if the owner is invisible
899
900 return true;
901}
#define IS_INVISIBLE(v)
Definition utils.qh:29

References entity(), IS_INVISIBLE, IS_PLAYER, owner, SAME_TEAM, and WaypointSprite_getviewentity().

Referenced by ctf_CheckStalemate(), and ctf_FlagcarrierWaypoints().

◆ havocbot_ctf_calculate_middlepoint()

void havocbot_ctf_calculate_middlepoint ( )

Definition at line 1480 of file sv_ctf.qc.

1481{
1482 vector s = '0 0 0';
1483 vector fo = '0 0 0';
1484 int n = 0;
1485
1486 entity f1 = NULL, f2 = NULL;
1487
1488 IL_EACH(g_flags, it.classname != "phantomflag",
1489 {
1490 // save base flags incase symmetry is checked
1491 if(!f1 && it.team == NUM_TEAM_1)
1492 f1 = it;
1493 else if(!f2 && it.team == NUM_TEAM_2)
1494 f2 = it;
1495 fo = it.origin;
1496 s += fo;
1497 ++n;
1498 });
1499 if(!n)
1500 return;
1501
1502 // TODO: Consider changing this back to `s / n` after https://github.com/graphitemaster/gmqcc/issues/210.
1503 havocbot_middlepoint = s * (1 / n);
1505
1508 if(n == 2)
1509 {
1510 // for symmetrical editing of waypoints
1511 float m = -(f1.origin.y - f2.origin.y) / (max(f1.origin.x - f2.origin.x, FLOAT_EPSILON));
1512 float q = havocbot_middlepoint.y - m * havocbot_middlepoint.x;
1515 }
1517}
float havocbot_symmetry_axis_q
Definition api.qh:94
float havocbot_symmetry_axis_m
Definition api.qh:93
vector havocbot_middlepoint
Definition api.qh:91
float havocbot_symmetry_origin_order
Definition api.qh:95
float havocbot_middlepoint_radius
Definition api.qh:92
const float FLOAT_EPSILON
Definition float.qh:4
spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 spree_inf s1 s2 s3loc s2 s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2loc s1 s2 f1points f2
Definition all.inc:370
f1
Definition all.inc:567

References entity(), f1, f2, FLOAT_EPSILON, g_flags, havocbot_middlepoint, havocbot_middlepoint_radius, havocbot_symmetry_axis_m, havocbot_symmetry_axis_q, havocbot_symmetry_origin_order, IL_EACH, max(), NULL, vector, and vlen().

Referenced by ctf_DelayedInit().

◆ havocbot_ctf_find_enemy_flag()

entity havocbot_ctf_find_enemy_flag ( entity bot)

Definition at line 1529 of file sv_ctf.qc.

1530{
1531 IL_EACH(g_flags, true,
1532 {
1533 if(ctf_oneflag)
1534 {
1535 if(CTF_DIFFTEAM(bot, it))
1536 {
1537 if(it.team)
1538 {
1539 if(bot.flagcarried)
1540 return it;
1541 }
1542 else if(!bot.flagcarried)
1543 return it;
1544 }
1545 }
1546 else if (CTF_DIFFTEAM(bot, it))
1547 return it;
1548 });
1549 return NULL;
1550}

References CTF_DIFFTEAM, ctf_oneflag, entity(), g_flags, IL_EACH, and NULL.

Referenced by havocbot_ctf_reset_role(), havocbot_goalrating_ctf_enemybase(), havocbot_role_ctf_escort(), havocbot_role_ctf_offense(), and havocbot_role_ctf_retriever().

◆ havocbot_ctf_find_flag()

◆ havocbot_ctf_is_basewaypoint()

bool havocbot_ctf_is_basewaypoint ( entity item)

Definition at line 1776 of file sv_ctf.qc.

1777{
1778 if (item.classname != "waypoint")
1779 return false;
1780
1781 IL_EACH(g_flags, item == it.bot_basewaypoint,
1782 {
1783 return true;
1784 });
1785 return false;
1786}

References entity(), g_flags, and IL_EACH.

Referenced by havocbot_role_ctf_carrier(), and havocbot_role_ctf_middle().

◆ havocbot_ctf_reset_role()

void havocbot_ctf_reset_role ( entity this)

Definition at line 1697 of file sv_ctf.qc.

1698{
1699 float cdefense, cmiddle, coffense;
1700 entity mf, ef;
1701
1702 if(IS_DEAD(this))
1703 return;
1704
1705 // Check ctf flags
1706 if (this.flagcarried)
1707 {
1709 return;
1710 }
1711
1712 mf = havocbot_ctf_find_flag(this);
1714
1715 // Retrieve stolen flag
1716 if(mf.ctf_status!=FLAG_BASE)
1717 {
1719 return;
1720 }
1721
1722 // If enemy flag is taken go to the middle to intercept pursuers
1723 if(ef.ctf_status!=FLAG_BASE)
1724 {
1726 return;
1727 }
1728
1729 // if there is no one else on the team switch to offense
1730 int count = 0;
1731 // don't check if this bot is a player since it isn't true when the bot is added to the server
1732 FOREACH_CLIENT(it != this && IS_PLAYER(it) && SAME_TEAM(it, this), { ++count; });
1733
1734 if (count == 0)
1735 {
1737 return;
1738 }
1739 else if (time < CS(this).jointime + 1)
1740 {
1741 // if bots spawn all at once set good default roles
1742 if (count == 1)
1743 {
1745 return;
1746 }
1747 else if (count == 2)
1748 {
1750 return;
1751 }
1752 }
1753
1754 // Evaluate best position to take
1755 // Count mates on middle position
1757
1758 // Count mates on defense position
1759 cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_middlepoint_radius * 0.5);
1760
1761 // Count mates on offense position
1762 coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_middlepoint_radius);
1763
1764 if(cdefense<=coffense)
1766 else if(coffense<=cmiddle)
1768 else
1770
1771 // if bots spawn all at once assign them a more appropriated role after a while
1772 if (time < CS(this).jointime + 1 && count > 2)
1773 this.havocbot_role_timeout = time + 10 + random() * 10;
1774}
float havocbot_role_timeout
Definition api.qh:46
float count
Definition powerups.qc:22
float random(void)
float jointime
Definition client.qh:66
entity havocbot_ctf_find_enemy_flag(entity bot)
Definition sv_ctf.qc:1529
int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius)
Definition sv_ctf.qc:1552
entity havocbot_ctf_find_flag(entity bot)
Definition sv_ctf.qc:1520
void havocbot_role_ctf_setrole(entity bot, int role)
Definition sv_ctf.qc:2171
const int HAVOCBOT_CTF_ROLE_RETRIEVER
Definition sv_ctf.qh:177
const int HAVOCBOT_CTF_ROLE_DEFENSE
Definition sv_ctf.qh:173
const int HAVOCBOT_CTF_ROLE_MIDDLE
Definition sv_ctf.qh:174
entity flagcarried
Definition sv_ctf.qh:93
const int HAVOCBOT_CTF_ROLE_OFFENSE
Definition sv_ctf.qh:175
const int HAVOCBOT_CTF_ROLE_CARRIER
Definition sv_ctf.qh:176

References count, CS(), entity(), FLAG_BASE, flagcarried, FOREACH_CLIENT, havocbot_ctf_find_enemy_flag(), havocbot_ctf_find_flag(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_DEFENSE, HAVOCBOT_CTF_ROLE_MIDDLE, HAVOCBOT_CTF_ROLE_OFFENSE, HAVOCBOT_CTF_ROLE_RETRIEVER, havocbot_ctf_teamcount(), havocbot_middlepoint, havocbot_middlepoint_radius, havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, IS_PLAYER, jointime, random(), SAME_TEAM, and time.

Referenced by havocbot_role_ctf_carrier(), havocbot_role_ctf_defense(), havocbot_role_ctf_escort(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), havocbot_role_ctf_retriever(), and MUTATOR_HOOKFUNCTION().

◆ havocbot_ctf_teamcount()

int havocbot_ctf_teamcount ( entity bot,
vector org,
float tc_radius )

Definition at line 1552 of file sv_ctf.qc.

1553{
1554 if (!teamplay)
1555 return 0;
1556
1557 int c = 0;
1558
1560 if(DIFF_TEAM(it, bot) || IS_DEAD(it) || it == bot)
1561 continue;
1562
1563 if(vdist(it.origin - org, <, tc_radius))
1564 ++c;
1565 });
1566
1567 return c;
1568}
vector org
Definition self.qh:96
bool teamplay
Definition teams.qh:59

References DIFF_TEAM, entity(), FOREACH_CLIENT, IS_DEAD, IS_PLAYER, org, teamplay, vdist, and vector.

Referenced by havocbot_ctf_reset_role().

◆ havocbot_goalrating_ctf_droppedflags()

void havocbot_goalrating_ctf_droppedflags ( entity this,
float ratingscale,
vector org,
float df_radius )

Definition at line 1678 of file sv_ctf.qc.

1679{
1680 IL_EACH(g_flags, true,
1681 {
1682 // flag is out in the field
1683 if(it.ctf_status != FLAG_BASE)
1684 if(it.tag_entity==NULL) // dropped
1685 {
1686 if(df_radius)
1687 {
1688 if(vdist(org - it.origin, <, df_radius))
1689 navigation_routerating(this, it, ratingscale, 10000);
1690 }
1691 else
1692 navigation_routerating(this, it, ratingscale, 10000);
1693 }
1694 });
1695}
void navigation_routerating(entity this, entity e, float f, float rangebias)

References entity(), FLAG_BASE, g_flags, IL_EACH, navigation_routerating(), NULL, org, vdist, and vector.

Referenced by havocbot_role_ctf_defense(), havocbot_role_ctf_middle(), and havocbot_role_ctf_retriever().

◆ havocbot_goalrating_ctf_enemybase()

void havocbot_goalrating_ctf_enemybase ( entity this,
float ratingscale )

Definition at line 1649 of file sv_ctf.qc.

1650{
1651 // disabled because we always spawn waypoints for flags with waypoint_spawnforitem_force
1652 /*
1653 if (!bot_waypoints_for_items)
1654 {
1655 havocbot_goalrating_ctf_enemyflag(this, ratingscale);
1656 return;
1657 }
1658 */
1660
1661 if (!head)
1662 return;
1663
1664 navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
1665}

References entity(), havocbot_ctf_find_enemy_flag(), and navigation_routerating().

Referenced by havocbot_role_ctf_carrier(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), and havocbot_role_ctf_retriever().

◆ havocbot_goalrating_ctf_enemyflag()

void havocbot_goalrating_ctf_enemyflag ( entity this,
float ratingscale )

Definition at line 1605 of file sv_ctf.qc.

1606{
1607 entity chosen = NULL;
1608 IL_EACH(g_flags, true,
1609 {
1610 if(ctf_oneflag)
1611 {
1612 if(CTF_DIFFTEAM(this, it))
1613 {
1614 if(it.team)
1615 {
1616 if(this.flagcarried)
1617 {
1618 chosen = it;
1619 break;
1620 }
1621 }
1622 else if(!this.flagcarried)
1623 {
1624 chosen = it;
1625 break;
1626 }
1627 }
1628 }
1629 else if(CTF_DIFFTEAM(this, it))
1630 {
1631 chosen = it;
1632 break;
1633 }
1634 });
1635
1636 if (chosen)
1637 {
1638 if (chosen.ctf_status == FLAG_CARRY)
1639 {
1640 // adjust rating of our flag carrier depending on their health
1641 chosen = chosen.tag_entity;
1642 float f = bound(0, (GetResource(chosen, RES_HEALTH) + GetResource(chosen, RES_ARMOR)) / 100, 2) - 1;
1643 ratingscale += ratingscale * f * 0.1;
1644 }
1645 navigation_routerating(this, chosen, ratingscale, 10000);
1646 }
1647}

References bound(), CTF_DIFFTEAM, ctf_oneflag, entity(), FLAG_CARRY, flagcarried, g_flags, GetResource(), IL_EACH, navigation_routerating(), NULL, and RES_ARMOR.

Referenced by havocbot_role_ctf_escort().

◆ havocbot_goalrating_ctf_ourbase()

void havocbot_goalrating_ctf_ourbase ( entity this,
float ratingscale )

Definition at line 1586 of file sv_ctf.qc.

1587{
1588 entity chosen = NULL;
1589 IL_EACH(g_flags, CTF_SAMETEAM(this, it),
1590 {
1591 if(this.flagcarried)
1592 if((this.flagcarried.cnt || it.cnt) && this.flagcarried.cnt != it.cnt)
1593 {
1594 // skip base if it has a different group
1595 continue;
1596 }
1597
1598 chosen = it;
1599 break;
1600 });
1601
1602 navigation_routerating(this, chosen.bot_basewaypoint, ratingscale, 10000);
1603}

References CTF_SAMETEAM, entity(), flagcarried, g_flags, IL_EACH, navigation_routerating(), and NULL.

Referenced by havocbot_role_ctf_carrier(), and havocbot_role_ctf_defense().

◆ havocbot_goalrating_ctf_ourstolenflag()

void havocbot_goalrating_ctf_ourstolenflag ( entity this,
float ratingscale )

Definition at line 1667 of file sv_ctf.qc.

1668{
1669 entity mf = havocbot_ctf_find_flag(this);
1670
1671 if(mf.ctf_status == FLAG_BASE)
1672 return;
1673
1674 if(mf.tag_entity)
1675 navigation_routerating(this, mf.tag_entity, ratingscale, 10000);
1676}

References entity(), FLAG_BASE, havocbot_ctf_find_flag(), and navigation_routerating().

Referenced by havocbot_role_ctf_defense(), havocbot_role_ctf_escort(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), and havocbot_role_ctf_retriever().

◆ havocbot_role_ctf_carrier()

void havocbot_role_ctf_carrier ( entity this)

Definition at line 1788 of file sv_ctf.qc.

1789{
1790 if(IS_DEAD(this))
1791 {
1793 return;
1794 }
1795
1796 if (this.flagcarried == NULL)
1797 {
1799 return;
1800 }
1801
1803 {
1805
1806 // role: carrier
1807 entity mf = havocbot_ctf_find_flag(this);
1808 vector base_org = mf.dropped_origin;
1809 float base_rating = (mf.ctf_status == FLAG_BASE) ? 10000 : (vdist(this.origin - base_org, >, 100) ? 2000 : 1000);
1810 if(ctf_oneflag)
1811 havocbot_goalrating_ctf_enemybase(this, base_rating);
1812 else
1813 havocbot_goalrating_ctf_ourbase(this, base_rating);
1814
1815 // start collecting items very close to the bot but only inside of own base radius
1816 if (vdist(this.origin - base_org, <, havocbot_middlepoint_radius))
1817 havocbot_goalrating_items(this, 15000, this.origin, min(500, havocbot_middlepoint_radius * 0.5));
1818
1819 havocbot_goalrating_items(this, 10000, base_org, havocbot_middlepoint_radius * 0.5);
1820
1822
1824
1825 entity goal = this.goalentity;
1826 if (havocbot_ctf_is_basewaypoint(goal) && vdist(goal.origin - this.origin, <, 100))
1827 this.goalentity_lock_timeout = time + ((this.enemy) ? 2 : 3);
1828
1829 if (goal)
1830 this.havocbot_cantfindflag = time + 10;
1831 else if (time > this.havocbot_cantfindflag)
1832 {
1833 // Can't navigate to my own base, suicide!
1834 // TODO: drop it and wander around
1835 Damage(this, this, this, 100000, DEATH_KILL.m_id, DMG_NOWEP, this.origin, '0 0 0');
1836 return;
1837 }
1838 }
1839}
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
float goalentity_lock_timeout
Definition api.qh:97
void navigation_goalrating_end(entity this)
entity goalentity
Definition viewloc.qh:16
entity this
Definition self.qh:76
bool havocbot_ctf_is_basewaypoint(entity item)
Definition sv_ctf.qc:1776
void havocbot_goalrating_ctf_ourbase(entity this, float ratingscale)
Definition sv_ctf.qc:1586
void havocbot_goalrating_ctf_enemybase(entity this, float ratingscale)
Definition sv_ctf.qc:1649
void havocbot_ctf_reset_role(entity this)
Definition sv_ctf.qc:1697
bool havocbot_cantfindflag
Definition sv_ctf.qh:180
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition roles.qc:106

References ctf_oneflag, Damage(), DMG_NOWEP, enemy, entity(), FLAG_BASE, flagcarried, goalentity, goalentity_lock_timeout, havocbot_cantfindflag, havocbot_ctf_find_flag(), havocbot_ctf_is_basewaypoint(), havocbot_ctf_reset_role(), havocbot_goalrating_ctf_enemybase(), havocbot_goalrating_ctf_ourbase(), havocbot_goalrating_items(), havocbot_middlepoint_radius, IS_DEAD, min(), navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), NULL, origin, time, vdist, and vector.

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_defense()

void havocbot_role_ctf_defense ( entity this)

Definition at line 2102 of file sv_ctf.qc.

2103{
2104 entity mf;
2105
2106 if(IS_DEAD(this))
2107 {
2109 return;
2110 }
2111
2112 if (this.flagcarried)
2113 {
2115 return;
2116 }
2117
2118 // If own flag was captured
2119 mf = havocbot_ctf_find_flag(this);
2120 if(mf.ctf_status!=FLAG_BASE)
2121 {
2123 return;
2124 }
2125
2126 if (!this.havocbot_role_timeout)
2127 this.havocbot_role_timeout = time + 30;
2128
2129 if (time > this.havocbot_role_timeout)
2130 {
2132 return;
2133 }
2135 {
2136 vector org = mf.dropped_origin;
2137
2139
2140 // if enemies are closer to our base, go there
2141 entity closestplayer = NULL;
2142 float distance, bestdistance = 10000;
2143 FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
2144 distance = vlen(org - it.origin);
2145 if(distance<bestdistance)
2146 {
2147 closestplayer = it;
2148 bestdistance = distance;
2149 }
2150 });
2151
2152 // role: defense
2153 if(closestplayer)
2154 if(DIFF_TEAM(closestplayer, this))
2155 if(vdist(org - this.origin, >, 1000))
2156 if(checkpvs(this.origin,closestplayer)||random()<0.5)
2158
2163 havocbot_goalrating_items(this, 18000, this.origin, 10000);
2164
2166
2168 }
2169}
float checkpvs(vector viewpos, entity viewee)
void havocbot_goalrating_ctf_ourstolenflag(entity this, float ratingscale)
Definition sv_ctf.qc:1667
void havocbot_goalrating_ctf_droppedflags(entity this, float ratingscale, vector org, float df_radius)
Definition sv_ctf.qc:1678
void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
Definition roles.qc:176

References checkpvs(), DIFF_TEAM, entity(), FLAG_BASE, flagcarried, FOREACH_CLIENT, havocbot_ctf_find_flag(), havocbot_ctf_reset_role(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_RETRIEVER, havocbot_goalrating_ctf_droppedflags(), havocbot_goalrating_ctf_ourbase(), havocbot_goalrating_ctf_ourstolenflag(), havocbot_goalrating_enemyplayers(), havocbot_goalrating_items(), havocbot_middlepoint_radius, havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, IS_PLAYER, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), NULL, org, origin, random(), time, vdist, vector, and vlen().

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_escort()

void havocbot_role_ctf_escort ( entity this)

Definition at line 1841 of file sv_ctf.qc.

1842{
1843 entity mf, ef;
1844
1845 if(IS_DEAD(this))
1846 {
1848 return;
1849 }
1850
1851 if (this.flagcarried)
1852 {
1854 return;
1855 }
1856
1857 // If enemy flag is back on the base switch to previous role
1859 if(ef.ctf_status==FLAG_BASE)
1860 {
1861 this.havocbot_role = this.havocbot_previous_role;
1862 this.havocbot_role_timeout = 0;
1863 return;
1864 }
1865 if (ef.ctf_status == FLAG_DROPPED)
1866 {
1868 return;
1869 }
1870
1871 // If the flag carrier reached the base switch to defense
1872 mf = havocbot_ctf_find_flag(this);
1873 if (mf.ctf_status != FLAG_BASE && vdist(ef.origin - mf.dropped_origin, <, 900))
1874 {
1876 return;
1877 }
1878
1879 // Set the role timeout if necessary
1880 if (!this.havocbot_role_timeout)
1881 {
1882 this.havocbot_role_timeout = time + random() * 30 + 60;
1883 }
1884
1885 // If nothing happened just switch to previous role
1886 if (time > this.havocbot_role_timeout)
1887 {
1888 this.havocbot_role = this.havocbot_previous_role;
1889 this.havocbot_role_timeout = 0;
1890 return;
1891 }
1892
1893 // Chase the flag carrier
1895 {
1897
1898 // role: escort
1901 havocbot_goalrating_items(this, 21000, this.origin, 10000);
1902
1904
1906 }
1907}
void navigation_goalrating_timeout_expire(entity this, float seconds)
Definition navigation.qc:36
void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
Definition sv_ctf.qc:1605

References entity(), FLAG_BASE, FLAG_DROPPED, flagcarried, havocbot_ctf_find_enemy_flag(), havocbot_ctf_find_flag(), havocbot_ctf_reset_role(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_DEFENSE, havocbot_goalrating_ctf_enemyflag(), havocbot_goalrating_ctf_ourstolenflag(), havocbot_goalrating_items(), havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_expire(), navigation_goalrating_timeout_set(), origin, random(), time, and vdist.

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_middle()

void havocbot_role_ctf_middle ( entity this)

Definition at line 2045 of file sv_ctf.qc.

2046{
2047 entity mf;
2048
2049 if(IS_DEAD(this))
2050 {
2052 return;
2053 }
2054
2055 if (this.flagcarried)
2056 {
2058 return;
2059 }
2060
2061 mf = havocbot_ctf_find_flag(this);
2062 if(mf.ctf_status!=FLAG_BASE)
2063 {
2065 return;
2066 }
2067
2068 if (!this.havocbot_role_timeout)
2069 this.havocbot_role_timeout = time + 10;
2070
2071 if (time > this.havocbot_role_timeout)
2072 {
2074 return;
2075 }
2076
2078 {
2080 org.z = this.origin.z;
2081
2083
2084 // role: middle
2086 havocbot_goalrating_ctf_droppedflags(this, 9000, this.origin, 10000);
2089 havocbot_goalrating_items(this, 18000, this.origin, 10000);
2091
2093
2094 entity goal = this.goalentity;
2095 if (havocbot_ctf_is_basewaypoint(goal) && vdist(goal.origin - this.origin, <, 100))
2096 this.goalentity_lock_timeout = time + 2;
2097
2099 }
2100}

References entity(), FLAG_BASE, flagcarried, goalentity, goalentity_lock_timeout, havocbot_ctf_find_flag(), havocbot_ctf_is_basewaypoint(), havocbot_ctf_reset_role(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_RETRIEVER, havocbot_goalrating_ctf_droppedflags(), havocbot_goalrating_ctf_enemybase(), havocbot_goalrating_ctf_ourstolenflag(), havocbot_goalrating_enemyplayers(), havocbot_goalrating_items(), havocbot_middlepoint, havocbot_middlepoint_radius, havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), org, origin, time, vdist, and vector.

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_offense()

void havocbot_role_ctf_offense ( entity this)

Definition at line 1909 of file sv_ctf.qc.

1910{
1911 entity mf, ef;
1912 vector pos;
1913
1914 if(IS_DEAD(this))
1915 {
1917 return;
1918 }
1919
1920 if (this.flagcarried)
1921 {
1923 return;
1924 }
1925
1926 // Check flags
1927 mf = havocbot_ctf_find_flag(this);
1929
1930 // Own flag stolen
1931 if(mf.ctf_status!=FLAG_BASE)
1932 {
1933 if(mf.tag_entity)
1934 pos = mf.tag_entity.origin;
1935 else
1936 pos = mf.origin;
1937
1938 // Try to get it if closer than the enemy base
1939 if(vlen2(this.origin-ef.dropped_origin)>vlen2(this.origin-pos))
1940 {
1942 return;
1943 }
1944 }
1945
1946 // Escort flag carrier
1947 if(ef.ctf_status!=FLAG_BASE)
1948 {
1949 if(ef.tag_entity)
1950 pos = ef.tag_entity.origin;
1951 else
1952 pos = ef.origin;
1953
1954 if(vdist(pos - mf.dropped_origin, >, 700))
1955 {
1957 return;
1958 }
1959 }
1960
1961 // Set the role timeout if necessary
1962 if (!this.havocbot_role_timeout)
1963 this.havocbot_role_timeout = time + 120;
1964
1965 if (time > this.havocbot_role_timeout)
1966 {
1968 return;
1969 }
1970
1972 {
1974
1975 // role: offense
1978 havocbot_goalrating_items(this, 22000, this.origin, 10000);
1979
1981
1983 }
1984}
const int HAVOCBOT_CTF_ROLE_ESCORT
Definition sv_ctf.qh:178
#define vlen2(v)
Definition vector.qh:4

References entity(), FLAG_BASE, flagcarried, havocbot_ctf_find_enemy_flag(), havocbot_ctf_find_flag(), havocbot_ctf_reset_role(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_ESCORT, HAVOCBOT_CTF_ROLE_RETRIEVER, havocbot_goalrating_ctf_enemybase(), havocbot_goalrating_ctf_ourstolenflag(), havocbot_goalrating_items(), havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), origin, time, vdist, vector, and vlen2.

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_retriever()

void havocbot_role_ctf_retriever ( entity this)

Definition at line 1987 of file sv_ctf.qc.

1988{
1989 entity mf;
1990
1991 if(IS_DEAD(this))
1992 {
1994 return;
1995 }
1996
1997 if (this.flagcarried)
1998 {
2000 return;
2001 }
2002
2003 // If flag is back on the base switch to previous role
2004 mf = havocbot_ctf_find_flag(this);
2005 if(mf.ctf_status==FLAG_BASE)
2006 {
2007 if (mf.enemy == this) // did this bot return the flag?
2010 return;
2011 }
2012
2013 if (!this.havocbot_role_timeout)
2014 this.havocbot_role_timeout = time + 20;
2015
2016 if (time > this.havocbot_role_timeout)
2017 {
2019 return;
2020 }
2021
2023 {
2024 const float RT_RADIUS = 10000;
2025
2027
2028 // role: retriever
2030 havocbot_goalrating_ctf_droppedflags(this, 12000, this.origin, RT_RADIUS);
2033 vector enemy_base_org = ef.dropped_origin;
2034 // start collecting items very close to the bot but only inside of enemy base radius
2035 if (vdist(this.origin - enemy_base_org, <, havocbot_middlepoint_radius))
2036 havocbot_goalrating_items(this, 27000, this.origin, min(500, havocbot_middlepoint_radius * 0.5));
2038
2040
2042 }
2043}
void navigation_goalrating_timeout_force(entity this)
Definition navigation.qc:29

References entity(), FLAG_BASE, flagcarried, havocbot_ctf_find_enemy_flag(), havocbot_ctf_find_flag(), havocbot_ctf_reset_role(), HAVOCBOT_CTF_ROLE_CARRIER, havocbot_goalrating_ctf_droppedflags(), havocbot_goalrating_ctf_enemybase(), havocbot_goalrating_ctf_ourstolenflag(), havocbot_goalrating_items(), havocbot_middlepoint_radius, havocbot_role_ctf_setrole(), havocbot_role_timeout, IS_DEAD, min(), navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_force(), navigation_goalrating_timeout_set(), origin, time, vdist, and vector.

Referenced by havocbot_role_ctf_setrole().

◆ havocbot_role_ctf_setrole()

void havocbot_role_ctf_setrole ( entity bot,
int role )

Definition at line 2171 of file sv_ctf.qc.

2172{
2173 string s = "(null)";
2174 switch(role)
2175 {
2177 s = "carrier";
2178 bot.havocbot_role = havocbot_role_ctf_carrier;
2179 bot.havocbot_role_timeout = 0;
2180 bot.havocbot_cantfindflag = time + 10;
2181 if (bot.havocbot_previous_role != bot.havocbot_role)
2183 break;
2185 s = "defense";
2186 bot.havocbot_role = havocbot_role_ctf_defense;
2187 bot.havocbot_role_timeout = 0;
2188 break;
2190 s = "middle";
2191 bot.havocbot_role = havocbot_role_ctf_middle;
2192 bot.havocbot_role_timeout = 0;
2193 break;
2195 s = "offense";
2196 bot.havocbot_role = havocbot_role_ctf_offense;
2197 bot.havocbot_role_timeout = 0;
2198 break;
2200 s = "retriever";
2201 bot.havocbot_previous_role = bot.havocbot_role;
2202 bot.havocbot_role = havocbot_role_ctf_retriever;
2203 bot.havocbot_role_timeout = time + 10;
2204 if (bot.havocbot_previous_role != bot.havocbot_role)
2206 break;
2208 s = "escort";
2209 bot.havocbot_previous_role = bot.havocbot_role;
2210 bot.havocbot_role = havocbot_role_ctf_escort;
2211 bot.havocbot_role_timeout = time + 30;
2212 if (bot.havocbot_previous_role != bot.havocbot_role)
2214 break;
2215 }
2216 LOG_TRACE(bot.netname, " switched to ", s);
2217}
void havocbot_role_ctf_middle(entity this)
Definition sv_ctf.qc:2045
void havocbot_role_ctf_carrier(entity this)
Definition sv_ctf.qc:1788
void havocbot_role_ctf_escort(entity this)
Definition sv_ctf.qc:1841
void havocbot_role_ctf_offense(entity this)
Definition sv_ctf.qc:1909
void havocbot_role_ctf_defense(entity this)
Definition sv_ctf.qc:2102
void havocbot_role_ctf_retriever(entity this)
Definition sv_ctf.qc:1987

References entity(), HAVOCBOT_CTF_ROLE_CARRIER, HAVOCBOT_CTF_ROLE_DEFENSE, HAVOCBOT_CTF_ROLE_ESCORT, HAVOCBOT_CTF_ROLE_MIDDLE, HAVOCBOT_CTF_ROLE_OFFENSE, HAVOCBOT_CTF_ROLE_RETRIEVER, havocbot_role_ctf_carrier(), havocbot_role_ctf_defense(), havocbot_role_ctf_escort(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), havocbot_role_ctf_retriever(), LOG_TRACE, navigation_goalrating_timeout_expire(), navigation_goalrating_timeout_force(), and time.

Referenced by havocbot_ctf_reset_role(), havocbot_role_ctf_defense(), havocbot_role_ctf_escort(), havocbot_role_ctf_middle(), havocbot_role_ctf_offense(), and havocbot_role_ctf_retriever().

◆ if() [1/2]

if ( frag_attacker. flagcarried)

Definition at line 2319 of file sv_ctf.qc.

2320 {
2321 if(frag_target == frag_attacker) // damage done to yourself
2322 {
2325 }
2326 else // damage done to everyone else
2327 {
2330 }
2331
2332 M_ARGV(4, float) = frag_damage;
2333 M_ARGV(6, vector) = frag_force;
2334 }
#define M_ARGV(x, type)
Definition events.qh:17
float autocvar_g_ctf_flagcarrier_forcefactor
Definition sv_ctf.qc:71
float autocvar_g_ctf_flagcarrier_damagefactor
Definition sv_ctf.qc:70
float autocvar_g_ctf_flagcarrier_selfdamagefactor
Definition sv_ctf.qc:68
float autocvar_g_ctf_flagcarrier_selfforcefactor
Definition sv_ctf.qc:69
float frag_damage
Definition sv_ctf.qc:2316
vector frag_force
Definition sv_ctf.qc:2317
entity frag_target
Definition sv_ctf.qc:2315

References autocvar_g_ctf_flagcarrier_damagefactor, autocvar_g_ctf_flagcarrier_forcefactor, autocvar_g_ctf_flagcarrier_selfdamagefactor, autocvar_g_ctf_flagcarrier_selfforcefactor, frag_damage, frag_force, frag_target, M_ARGV, and vector.

Referenced by bot_removefromlargestteam(), botframe_showwaypointlinks(), findnearest(), GameCommand(), HUD_ItemsTime(), NadeOffhand::offhand_think(), target_give_use(), and trigger_race_checkpoint_verify().

◆ if() [2/2]

else if ( frag_target.flagcarried &&! IS_DEADfrag_target) &&CTF_DIFFTEAM(frag_target, frag_attacker)

Definition at line 2335 of file sv_ctf.qc.

2336 {
2339 {
2340 frag_target.wps_helpme_time = time;
2341 WaypointSprite_HelpMePing(frag_target.wps_flagcarrier);
2342 }
2343 // todo: add notification for when flag carrier needs help?
2344 }
float autocvar_g_ctf_flagcarrier_auto_helpme_damage
Definition sv_ctf.qc:66
float autocvar_g_ctf_flagcarrier_auto_helpme_time
Definition sv_ctf.qc:67
void WaypointSprite_HelpMePing(entity e)

References autocvar_g_balance_armor_blockpercent, autocvar_g_ctf_flagcarrier_auto_helpme_damage, autocvar_g_ctf_flagcarrier_auto_helpme_time, frag_target, GetResource(), healtharmor_maxdamage(), IS_DEAD, RES_ARMOR, time, and WaypointSprite_HelpMePing().

◆ MUTATOR_HOOKFUNCTION() [1/20]

MUTATOR_HOOKFUNCTION ( ctf ,
AbortSpeedrun  )

Definition at line 2575 of file sv_ctf.qc.

2576{
2577 entity player = M_ARGV(0, entity);
2578
2579 if(player.flagcarried)
2580 {
2581 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(player.flagcarried.team, INFO_CTF_FLAGRETURN_ABORTRUN));
2582 ctf_RespawnFlag(player.flagcarried);
2583 return true;
2584 }
2585}

References APP_NUM, ctf_RespawnFlag(), entity(), M_ARGV, NULL, and Send_Notification().

◆ MUTATOR_HOOKFUNCTION() [2/20]

MUTATOR_HOOKFUNCTION ( ctf ,
ClientConnect  )

Definition at line 2399 of file sv_ctf.qc.

2400{
2402 return;
2403
2404 entity player = M_ARGV(0, entity);
2405
2406 race_SendAll(player, true);
2407}
void race_SendAll(entity player, bool only_rankings)
Definition race.qc:332

References autocvar_g_ctf_leaderboard, ClientConnect, entity(), M_ARGV, and race_SendAll().

◆ MUTATOR_HOOKFUNCTION() [3/20]

MUTATOR_HOOKFUNCTION ( ctf ,
ClientDisconnect  )

Definition at line 2392 of file sv_ctf.qc.

2393{
2394 entity player = M_ARGV(0, entity);
2395
2396 ctf_RemovePlayer(player);
2397}
void ctf_RemovePlayer(entity player)
Definition sv_ctf.qc:2372

References ClientDisconnect, ctf_RemovePlayer(), entity(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [4/20]

MUTATOR_HOOKFUNCTION ( ctf ,
DropSpecialItems  )

Definition at line 2693 of file sv_ctf.qc.

2694{
2696
2697 if(frag_target.flagcarried)
2699}

References ctf_Handle_Throw(), DROP_THROW, entity(), frag_target, M_ARGV, and NULL.

◆ MUTATOR_HOOKFUNCTION() [5/20]

MUTATOR_HOOKFUNCTION ( ctf ,
GetPressedKeys  )

Definition at line 2409 of file sv_ctf.qc.

2410{
2412 return;
2413
2414 entity player = M_ARGV(0, entity);
2415
2416 race_checkAndWriteName(player);
2417}
void race_checkAndWriteName(entity player)
Definition race.qc:133

References autocvar_g_ctf_leaderboard, entity(), GetPressedKeys(), M_ARGV, and race_checkAndWriteName().

◆ MUTATOR_HOOKFUNCTION() [6/20]

MUTATOR_HOOKFUNCTION ( ctf ,
GetRecords  )

Definition at line 2625 of file sv_ctf.qc.

2626{
2627 int record_page = M_ARGV(0, int);
2628 string ret_string = M_ARGV(1, string);
2629
2630 for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
2631 {
2632 if (MapInfo_Get_ByID(i))
2633 {
2634 float r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
2635
2636 if(!r)
2637 continue;
2638
2639 // TODO: uid2name
2640 string h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
2641 ret_string = strcat(ret_string, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
2642 }
2643 }
2644
2645 M_ARGV(1, string) = ret_string;
2646}
bool MapInfo_Get_ByID(int i)
Definition mapinfo.qc:274
float MapInfo_count
Definition mapinfo.qh:166
string MapInfo_Map_bspname
Definition mapinfo.qh:6
ERASEABLE string ftos_decimals(float number, int decimals)
Converts a number to a string with the indicated number of decimals.
Definition string.qh:476

References db_get(), ftos_decimals(), M_ARGV, MapInfo_count, MapInfo_Get_ByID(), MapInfo_Map_bspname, ServerProgsDB, stof(), and strcat().

◆ MUTATOR_HOOKFUNCTION() [7/20]

MUTATOR_HOOKFUNCTION ( ctf ,
GiveFragsForKill  )

Definition at line 2366 of file sv_ctf.qc.

2367{
2368 M_ARGV(2, float) = 0; // frag score
2369 return (autocvar_g_ctf_ignore_frags); // no frags counted in ctf if this is true
2370}
bool autocvar_g_ctf_ignore_frags
Definition sv_ctf.qc:74

References autocvar_g_ctf_ignore_frags, and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [8/20]

MUTATOR_HOOKFUNCTION ( ctf ,
HavocBot_ChooseRole  )

Definition at line 2617 of file sv_ctf.qc.

2618{
2619 entity bot = M_ARGV(0, entity);
2620
2622 return true;
2623}

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

◆ MUTATOR_HOOKFUNCTION() [9/20]

MUTATOR_HOOKFUNCTION ( ctf ,
HelpMePing  )

Definition at line 2519 of file sv_ctf.qc.

2520{
2521 entity player = M_ARGV(0, entity);
2522
2523 if(player.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
2524 {
2525 player.wps_helpme_time = time;
2526 WaypointSprite_HelpMePing(player.wps_flagcarrier);
2527 }
2528 else // create a normal help me waypointsprite
2529 {
2530 WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, player, FLAG_WAYPOINT_OFFSET, NULL, player.team, player, wps_helpme, false, RADARICON_HELPME);
2531 WaypointSprite_Ping(player.wps_helpme);
2532 }
2533
2534 return true;
2535}
entity wps_helpme
Definition sv_ctf.qh:104
float waypointsprite_limitedrange
float waypointsprite_deployed_lifetime

References entity(), FLAG_WAYPOINT_OFFSET, M_ARGV, NULL, time, waypointsprite_deployed_lifetime, WaypointSprite_HelpMePing(), waypointsprite_limitedrange, WaypointSprite_Ping(), WaypointSprite_Spawn(), and wps_helpme.

◆ MUTATOR_HOOKFUNCTION() [10/20]

MUTATOR_HOOKFUNCTION ( ctf ,
LogDeath_AppendItemCodes  )

Definition at line 2701 of file sv_ctf.qc.

2702{
2703 entity player = M_ARGV(0, entity);
2704 if(player.flagcarried)
2705 M_ARGV(1, string) = strcat(M_ARGV(1, string), "F"); // item codes
2706}

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

◆ MUTATOR_HOOKFUNCTION() [11/20]

MUTATOR_HOOKFUNCTION ( ctf ,
MakePlayerObserver  )

Definition at line 2385 of file sv_ctf.qc.

2386{
2387 entity player = M_ARGV(0, entity);
2388
2389 ctf_RemovePlayer(player);
2390}

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

◆ MUTATOR_HOOKFUNCTION() [12/20]

MUTATOR_HOOKFUNCTION ( ctf ,
MatchEnd  )

Definition at line 2587 of file sv_ctf.qc.

2588{
2589 IL_EACH(g_flags, true,
2590 {
2591 switch(it.ctf_status)
2592 {
2593 case FLAG_DROPPED:
2594 case FLAG_PASSING:
2595 {
2596 // lock the flag, game is over
2598 it.takedamage = DAMAGE_NO;
2599 it.solid = SOLID_NOT;
2600 it.nextthink = false; // stop thinking
2601
2602 //dprint("stopping the ", flag.netname, " from moving.\n");
2603 break;
2604 }
2605
2606 default:
2607 case FLAG_BASE:
2608 case FLAG_CARRY:
2609 {
2610 // do nothing for these flags
2611 break;
2612 }
2613 }
2614 });
2615}

References DAMAGE_NO, FLAG_BASE, FLAG_CARRY, FLAG_DROPPED, FLAG_PASSING, g_flags, IL_EACH, MOVETYPE_NONE, set_movetype(), and SOLID_NOT.

◆ MUTATOR_HOOKFUNCTION() [13/20]

MUTATOR_HOOKFUNCTION ( ctf ,
PlayerDies  )

Definition at line 2347 of file sv_ctf.qc.

2348{
2349 entity frag_attacker = M_ARGV(1, entity);
2351
2352 if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)) && (frag_target.flagcarried))
2353 {
2355 GameRules_scoring_add(frag_attacker, CTF_FCKILLS, 1);
2356 }
2357
2358 if(frag_target.flagcarried)
2359 {
2360 entity tmp_entity = frag_target.flagcarried;
2362 tmp_entity.ctf_dropper = NULL;
2363 }
2364}
int autocvar_g_ctf_score_kill
Definition sv_ctf.qc:78

References autocvar_g_ctf_score_kill, ctf_Handle_Throw(), DROP_NORMAL, entity(), frag_target, GameRules_scoring_add, GameRules_scoring_add_team, IS_PLAYER, M_ARGV, NULL, and SAME_TEAM.

◆ MUTATOR_HOOKFUNCTION() [14/20]

MUTATOR_HOOKFUNCTION ( ctf ,
PlayerPreThink  )

Definition at line 2224 of file sv_ctf.qc.

2225{
2226 entity player = M_ARGV(0, entity);
2227
2228 // initially clear items so they can be set as necessary later.
2229 STAT(OBJECTIVE_STATUS, player) &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST
2235
2236 // do an iteration for each team (plus neutral) and get the flag for that team
2237 // this allows selection of the "best" flag for each team (e.g. the carried one)
2238 for(int j = 0; j <= AVAILABLE_TEAMS; ++j)
2239 {
2240 int teamnumber = (j > 0) ? Team_IndexToTeam(j) : 0;
2241 entity bestflag = NULL;
2242 int bestprio = 0;
2243
2244 IL_EACH(g_flags, it.team == teamnumber,
2245 {
2246 // if there's a neutral flag in the map, enable oneflag display
2247 if(it.team == 0)
2248 STAT(OBJECTIVE_STATUS, player) |= CTF_FLAG_NEUTRAL;
2249
2250 // use a priority system to decide the preferred flag
2251 int prio = 0;
2252 if(it.owner == player || it.pass_sender == player)
2253 prio = 3;
2254 else if(it.ctf_status == FLAG_DROPPED)
2255 prio = 2;
2256 else if(it.ctf_status != FLAG_BASE)
2257 prio = 1;
2258
2259 if(!bestflag || prio > bestprio)
2260 {
2261 bestflag = it;
2262 bestprio = prio;
2263 }
2264 });
2265
2266 if(bestflag)
2267 {
2268 int t = 0, t2 = 0, t3 = 0;
2269 switch(bestflag.team)
2270 {
2276 }
2277
2278 switch(bestflag.ctf_status)
2279 {
2280 case FLAG_PASSING:
2281 case FLAG_CARRY:
2282 {
2283 if((bestflag.owner == player) || (bestflag.pass_sender == player))
2284 STAT(OBJECTIVE_STATUS, player) |= t; // carrying: player is currently carrying the flag
2285 else
2286 STAT(OBJECTIVE_STATUS, player) |= t2; // taken: someone else is carrying the flag
2287 break;
2288 }
2289 case FLAG_DROPPED:
2290 {
2291 STAT(OBJECTIVE_STATUS, player) |= t3; // lost: the flag is dropped somewhere on the map
2292 break;
2293 }
2294 }
2295 }
2296 }
2297
2298 // item for stopping players from capturing the flag too often
2299 if(player.ctf_captureshielded)
2300 STAT(OBJECTIVE_STATUS, player) |= CTF_SHIELDED;
2301
2302 if(ctf_stalemate)
2303 STAT(OBJECTIVE_STATUS, player) |= CTF_STALEMATE;
2304
2305 ctf_CaptureShield_Update(player, 1);
2306
2307 // update the health of the flag carrier waypointsprite
2308 if(player.wps_flagcarrier)
2309 WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResource(player, RES_HEALTH), GetResource(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
2310}
const int CTF_SHIELDED
Definition ctf.qh:57
const int CTF_PINK_FLAG_CARRYING
Definition ctf.qh:52
const int CTF_YELLOW_FLAG_TAKEN
Definition ctf.qh:47
const int CTF_YELLOW_FLAG_CARRYING
Definition ctf.qh:49
const int CTF_PINK_FLAG_TAKEN
Definition ctf.qh:50
const int CTF_RED_FLAG_LOST
Definition ctf.qh:42
const int CTF_NEUTRAL_FLAG_LOST
Definition ctf.qh:54
const int CTF_YELLOW_FLAG_LOST
Definition ctf.qh:48
const int CTF_RED_FLAG_CARRYING
Definition ctf.qh:43
const int CTF_RED_FLAG_TAKEN
Definition ctf.qh:41
const int CTF_FLAG_NEUTRAL
Definition ctf.qh:56
const int CTF_STALEMATE
Definition ctf.qh:58
const int CTF_BLUE_FLAG_LOST
Definition ctf.qh:45
const int CTF_BLUE_FLAG_TAKEN
Definition ctf.qh:44
const int CTF_PINK_FLAG_LOST
Definition ctf.qh:51
const int CTF_NEUTRAL_FLAG_CARRYING
Definition ctf.qh:55
const int CTF_BLUE_FLAG_CARRYING
Definition ctf.qh:46
const int CTF_NEUTRAL_FLAG_TAKEN
Definition ctf.qh:53
#define STAT(...)
Definition stats.qh:94
#define AVAILABLE_TEAMS
Number of teams that exist currently.
int Team_IndexToTeam(int index)
Converts team index into team value.
Definition teams.qh:169

References AVAILABLE_TEAMS, CTF_BLUE_FLAG_CARRYING, CTF_BLUE_FLAG_LOST, CTF_BLUE_FLAG_TAKEN, CTF_FLAG_NEUTRAL, CTF_NEUTRAL_FLAG_CARRYING, CTF_NEUTRAL_FLAG_LOST, CTF_NEUTRAL_FLAG_TAKEN, CTF_PINK_FLAG_CARRYING, CTF_PINK_FLAG_LOST, CTF_PINK_FLAG_TAKEN, CTF_RED_FLAG_CARRYING, CTF_RED_FLAG_LOST, CTF_RED_FLAG_TAKEN, CTF_SHIELDED, CTF_STALEMATE, CTF_YELLOW_FLAG_CARRYING, CTF_YELLOW_FLAG_LOST, CTF_YELLOW_FLAG_TAKEN, entity(), FLAG_CARRY, FLAG_DROPPED, FLAG_PASSING, g_flags, IL_EACH, M_ARGV, NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, PlayerPreThink, STAT, and Team_IndexToTeam().

◆ MUTATOR_HOOKFUNCTION() [15/20]

MUTATOR_HOOKFUNCTION ( ctf ,
PlayerUseKey  )

Definition at line 2428 of file sv_ctf.qc.

2429{
2430 if(MUTATOR_RETURNVALUE || game_stopped) return;
2431
2432 entity player = M_ARGV(0, entity);
2433
2434 if((time > player.throw_antispam) && !IS_DEAD(player) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
2435 {
2436 // pass the flag to a teammate
2437 if(autocvar_g_ctf_pass && player.flagcarried.classname != "phantomflag")
2438 {
2439 entity head, closest_target = NULL;
2440 head = WarpZone_FindRadius(player.origin, autocvar_g_ctf_pass_radius, true);
2441
2442 while(head) // find the closest acceptable target to pass to
2443 {
2444 if(IS_PLAYER(head) && !IS_DEAD(head) && !IS_INDEPENDENT_PLAYER(head))
2445 if(head != player && SAME_TEAM(head, player))
2446 if(!head.speedrunning && !head.vehicle)
2447 {
2448 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
2449 vector head_center = WarpZone_UnTransformOrigin(head, CENTER_OR_VIEWOFS(head));
2450 vector passer_center = CENTER_OR_VIEWOFS(player);
2451
2452 if(ctf_CheckPassDirection(head_center, passer_center, player.v_angle, head.WarpZone_findradius_nearest))
2453 {
2454 if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried && head.flagcarried.classname != "phantomflag")
2455 {
2456 if(IS_BOT_CLIENT(head))
2457 {
2458 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
2459 ctf_Handle_Throw(head, player, DROP_PASS);
2460 }
2461 else
2462 {
2463 Send_Notification(NOTIF_ONE, head, MSG_CENTER, CENTER_CTF_PASS_REQUESTED, player.netname);
2464 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
2465 }
2466 player.throw_antispam = time + autocvar_g_ctf_pass_wait;
2467 return true;
2468 }
2469 else if(player.flagcarried && !head.flagcarried)
2470 {
2471 if(closest_target)
2472 {
2473 vector closest_target_center = WarpZone_UnTransformOrigin(closest_target, CENTER_OR_VIEWOFS(closest_target));
2474 if(vlen2(passer_center - head_center) < vlen2(passer_center - closest_target_center))
2475 { closest_target = head; }
2476 }
2477 else { closest_target = head; }
2478 }
2479 }
2480 }
2481 head = head.chain;
2482 }
2483
2484 if(closest_target) { ctf_Handle_Throw(player, closest_target, DROP_PASS); return true; }
2485 }
2486
2487 // throw the flag in front of you
2488 if(autocvar_g_ctf_throw && player.flagcarried)
2489 {
2490 if(player.throw_count == -1)
2491 {
2492 if(time > player.throw_prevtime + autocvar_g_ctf_throw_punish_delay)
2493 {
2494 player.throw_prevtime = time;
2495 player.throw_count = 1;
2497 return true;
2498 }
2499 else
2500 {
2501 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_FLAG_THROW_PUNISH, rint((player.throw_prevtime + autocvar_g_ctf_throw_punish_delay) - time));
2502 return false;
2503 }
2504 }
2505 else
2506 {
2507 if(time > player.throw_prevtime + autocvar_g_ctf_throw_punish_time) { player.throw_count = 1; }
2508 else { ++player.throw_count; }
2509 if(player.throw_count >= autocvar_g_ctf_throw_punish_count) { player.throw_count = -1; }
2510
2511 player.throw_prevtime = time;
2513 return true;
2514 }
2515 }
2516 }
2517}
#define MUTATOR_RETURNVALUE
Definition base.qh:328
float game_stopped
Definition stats.qh:81
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:660
vector WarpZone_UnTransformOrigin(entity wz, vector v)
Definition common.qc:519
float rint(float f)
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
int autocvar_g_ctf_throw_punish_count
Definition sv_ctf.qc:27
float autocvar_g_ctf_throw_punish_time
Definition sv_ctf.qc:29
bool ctf_CheckPassDirection(vector head_center, vector passer_center, vector passer_angle, vector nearest_to_passer)
Definition sv_ctf.qc:233
bool autocvar_g_ctf_pass_request
Definition sv_ctf.qc:44
bool autocvar_g_ctf_throw
Definition sv_ctf.qc:24
bool autocvar_g_ctf_pass
Definition sv_ctf.qc:37
bool autocvar_g_ctf_allow_vehicle_touch
Definition sv_ctf.qc:22
float autocvar_g_ctf_throw_punish_delay
Definition sv_ctf.qc:28
#define CENTER_OR_VIEWOFS(ent)
Definition utils.qh:31
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition utils.qh:15

References autocvar_g_ctf_allow_vehicle_touch, autocvar_g_ctf_pass, autocvar_g_ctf_pass_radius, autocvar_g_ctf_pass_request, autocvar_g_ctf_pass_wait, autocvar_g_ctf_throw, autocvar_g_ctf_throw_punish_count, autocvar_g_ctf_throw_punish_delay, autocvar_g_ctf_throw_punish_time, CENTER_OR_VIEWOFS, ctf_CheckPassDirection(), ctf_Handle_Throw(), DROP_PASS, DROP_THROW, entity(), game_stopped, IS_BOT_CLIENT, IS_DEAD, IS_INDEPENDENT_PLAYER, IS_PLAYER, M_ARGV, MUTATOR_RETURNVALUE, NULL, PlayerUseKey(), rint(), SAME_TEAM, Send_Notification(), time, vector, vlen2, WarpZone_FindRadius(), and WarpZone_UnTransformOrigin().

◆ MUTATOR_HOOKFUNCTION() [16/20]

MUTATOR_HOOKFUNCTION ( ctf ,
PortalTeleport  )

Definition at line 2419 of file sv_ctf.qc.

2420{
2421 entity player = M_ARGV(0, entity);
2422
2423 if(player.flagcarried)
2425 { ctf_Handle_Throw(player, NULL, DROP_NORMAL); }
2426}
bool autocvar_g_ctf_portalteleport
Definition sv_ctf.qc:36

References autocvar_g_ctf_portalteleport, ctf_Handle_Throw(), DROP_NORMAL, entity(), M_ARGV, and NULL.

◆ MUTATOR_HOOKFUNCTION() [17/20]

MUTATOR_HOOKFUNCTION ( ctf ,
PreferPlayerScore_Clear  )

Definition at line 2708 of file sv_ctf.qc.

2709{
2710 return true;
2711}

◆ MUTATOR_HOOKFUNCTION() [18/20]

MUTATOR_HOOKFUNCTION ( ctf ,
SV_ParseClientCommand  )

Definition at line 2650 of file sv_ctf.qc.

2651{
2652 entity player = M_ARGV(0, entity);
2653 string cmd_name = M_ARGV(1, string);
2654 int cmd_argc = M_ARGV(2, int);
2655
2656 if(IS_PLAYER(player) || MUTATOR_RETURNVALUE || !cvar("g_superspectate")) { return false; }
2657
2658 if(cmd_name == "followfc")
2659 {
2660 if(!g_ctf)
2661 return true;
2662
2663 int _team = 0;
2664 bool found = false;
2665
2666 if(cmd_argc == 2)
2667 {
2668 switch(argv(1))
2669 {
2670 case "red": if(teamplay_bitmask & BIT(0)) _team = NUM_TEAM_1; break;
2671 case "blue": if(teamplay_bitmask & BIT(1)) _team = NUM_TEAM_2; break;
2672 case "yellow": if(teamplay_bitmask & BIT(2)) _team = NUM_TEAM_3; break;
2673 case "pink": if(teamplay_bitmask & BIT(3)) _team = NUM_TEAM_4; break;
2674 }
2675 }
2676
2678 if(it.flagcarried && (it.team == _team || _team == 0))
2679 {
2680 found = true;
2681 if(_team == 0 && IS_SPEC(player) && player.enemy == it)
2682 continue; // already spectating this fc, try another
2683 return superspec_Spectate(player, it);
2684 }
2685 });
2686
2687 if(!found)
2688 superspec_msg("", "", player, "No active flag carrier\n", 1);
2689 return true;
2690 }
2691}
#define g_ctf
Definition ctf.qh:38
string cmd_name
Definition events.qh:12
int cmd_argc
Definition events.qh:13
string argv(float n)
void superspec_msg(string _center_title, string _con_title, entity _to, string _msg, float _spamlevel)
bool superspec_Spectate(entity this, entity targ)
int teamplay_bitmask
The set of currently available teams (AVAILABLE_TEAMS is the number of them).
Definition teamplay.qh:18
#define IS_SPEC(v)
Definition utils.qh:10

References argv(), BIT, cmd_argc, cmd_name, cvar(), entity(), FOREACH_CLIENT, g_ctf, IS_PLAYER, IS_SPEC, M_ARGV, MUTATOR_RETURNVALUE, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, superspec_msg(), superspec_Spectate(), SV_ParseClientCommand, and teamplay_bitmask.

◆ MUTATOR_HOOKFUNCTION() [19/20]

MUTATOR_HOOKFUNCTION ( ctf ,
VehicleEnter  )

Definition at line 2537 of file sv_ctf.qc.

2538{
2539 entity player = M_ARGV(0, entity);
2540 entity veh = M_ARGV(1, entity);
2541
2542 if(player.flagcarried)
2543 {
2545 {
2547 }
2548 else
2549 {
2550 player.flagcarried.nodrawtoclient = player; // hide the flag from the driver
2551 setattachment(player.flagcarried, veh, "");
2552 setorigin(player.flagcarried, VEHICLE_FLAG_OFFSET);
2553 player.flagcarried.scale = VEHICLE_FLAG_SCALE;
2554 //player.flagcarried.angles = '0 0 0';
2555 }
2556 return true;
2557 }
2558}
bool autocvar_g_ctf_allow_vehicle_carry
Definition sv_ctf.qc:21

References autocvar_g_ctf_allow_vehicle_carry, autocvar_g_ctf_allow_vehicle_touch, ctf_Handle_Throw(), DROP_NORMAL, entity(), M_ARGV, NULL, VEHICLE_FLAG_OFFSET, and VEHICLE_FLAG_SCALE.

◆ MUTATOR_HOOKFUNCTION() [20/20]

MUTATOR_HOOKFUNCTION ( ctf ,
VehicleExit  )

Definition at line 2560 of file sv_ctf.qc.

2561{
2562 entity player = M_ARGV(0, entity);
2563
2564 if(player.flagcarried)
2565 {
2566 setattachment(player.flagcarried, player, "");
2567 setorigin(player.flagcarried, FLAG_CARRY_OFFSET);
2568 player.flagcarried.scale = FLAG_SCALE;
2569 player.flagcarried.angles = '0 0 0';
2570 player.flagcarried.nodrawtoclient = NULL;
2571 return true;
2572 }
2573}

References entity(), FLAG_CARRY_OFFSET, FLAG_SCALE, M_ARGV, and NULL.

◆ nades_GiveBonus()

void nades_GiveBonus ( entity player,
float score )

Definition at line 445 of file sv_nades.qc.

446{
448 && IS_REAL_CLIENT(player) && IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max
449 && !IS_DEAD(player) && !STAT(FROZEN, player))
450 {
451 if (STAT(NADE_BONUS_SCORE, player) < 1)
452 STAT(NADE_BONUS_SCORE, player) += score / autocvar_g_nades_bonus_score_max;
453
454 if (STAT(NADE_BONUS_SCORE, player) >= 1)
455 {
456 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
457 play2(player, SND(NADE_BONUS));
458 ++STAT(NADE_BONUS, player);
459 --STAT(NADE_BONUS_SCORE, player);
460 }
461 }
462}
void play2(entity e, string filename)
Definition all.qc:116
bool autocvar_g_nades
Definition sv_nades.qh:5
bool autocvar_g_nades_bonus
Definition sv_nades.qh:27
int autocvar_g_nades_bonus_max
Definition sv_nades.qh:32
int autocvar_g_nades_bonus_score_max
Definition sv_nades.qh:33

References autocvar_g_nades, autocvar_g_nades_bonus, autocvar_g_nades_bonus_max, autocvar_g_nades_bonus_score_max, entity(), IS_DEAD, IS_PLAYER, IS_REAL_CLIENT, play2(), Send_Notification(), SND, and STAT.

Referenced by ctf_Handle_Capture(), ctf_Handle_Pickup(), ctf_Handle_Return(), and MUTATOR_HOOKFUNCTION().

◆ spawnfunc() [1/22]

spawnfunc ( ctf_team )

Definition at line 2815 of file sv_ctf.qc.

2816{
2817 if(!g_ctf) { delete(this); return; }
2818
2819 this.team = this.cnt + 1;
2820}
float cnt
Definition powerups.qc:24

References cnt, g_ctf, and team.

◆ spawnfunc() [2/22]

spawnfunc ( info_player_team1 )

Definition at line 201 of file spawnpoints.qc.

202{
203 this.team = NUM_TEAM_1; // red
204 spawnfunc_info_player_deathmatch(this);
205}

References NUM_TEAM_1, and team.

◆ spawnfunc() [3/22]

spawnfunc ( info_player_team2 )

Definition at line 211 of file spawnpoints.qc.

212{
213 this.team = NUM_TEAM_2; // blue
214 spawnfunc_info_player_deathmatch(this);
215}

References NUM_TEAM_2, and team.

◆ spawnfunc() [4/22]

spawnfunc ( item_flag_neutral )

Definition at line 2801 of file sv_ctf.qc.

2802{
2803 if(!g_ctf) { delete(this); return; }
2804 if(!cvar("g_ctf_oneflag")) { delete(this); return; }
2805
2806 ctf_FlagSetup(0, this);
2807}
void ctf_FlagSetup(int teamnum, entity flag)
Definition sv_ctf.qc:1351

References ctf_FlagSetup(), cvar(), and g_ctf.

◆ spawnfunc() [5/22]

spawnfunc ( item_flag_team1 )

Definition at line 2729 of file sv_ctf.qc.

2730{
2731 if(!g_ctf) { delete(this); return; }
2732
2734}

References ctf_FlagSetup(), g_ctf, and NUM_TEAM_1.

◆ spawnfunc() [6/22]

spawnfunc ( item_flag_team2 )

Definition at line 2747 of file sv_ctf.qc.

2748{
2749 if(!g_ctf) { delete(this); return; }
2750
2752}

References ctf_FlagSetup(), g_ctf, and NUM_TEAM_2.

◆ spawnfunc() [7/22]

spawnfunc ( item_flag_team3 )

Definition at line 2765 of file sv_ctf.qc.

2766{
2767 if(!g_ctf) { delete(this); return; }
2768
2770}

References ctf_FlagSetup(), g_ctf, and NUM_TEAM_3.

◆ spawnfunc() [8/22]

spawnfunc ( item_flag_team4 )

Definition at line 2783 of file sv_ctf.qc.

2784{
2785 if(!g_ctf) { delete(this); return; }
2786
2788}

References ctf_FlagSetup(), g_ctf, and NUM_TEAM_4.

◆ spawnfunc() [9/22]

spawnfunc ( team_blueplayer )

Definition at line 2837 of file sv_ctf.qc.

2837{ spawnfunc_info_player_team2(this); }

◆ spawnfunc() [10/22]

spawnfunc ( team_CTF_blueflag )

Definition at line 2824 of file sv_ctf.qc.

2824{ spawnfunc_item_flag_team2(this); }

◆ spawnfunc() [11/22]

spawnfunc ( team_CTF_blueplayer )

Definition at line 2829 of file sv_ctf.qc.

2829{ spawnfunc_info_player_team2(this); }

◆ spawnfunc() [12/22]

spawnfunc ( team_CTF_bluespawn )

Definition at line 2830 of file sv_ctf.qc.

2830{ spawnfunc_info_player_team2(this); }

◆ spawnfunc() [13/22]

spawnfunc ( team_CTF_neutralflag )

Definition at line 2832 of file sv_ctf.qc.

2832{ spawnfunc_item_flag_neutral(this); }

◆ spawnfunc() [14/22]

spawnfunc ( team_CTF_redflag )

Definition at line 2823 of file sv_ctf.qc.

2823{ spawnfunc_item_flag_team1(this); }

◆ spawnfunc() [15/22]

spawnfunc ( team_CTF_redplayer )

Definition at line 2826 of file sv_ctf.qc.

2826{ spawnfunc_info_player_team1(this); }

◆ spawnfunc() [16/22]

spawnfunc ( team_CTF_redspawn )

Definition at line 2827 of file sv_ctf.qc.

2827{ spawnfunc_info_player_team1(this); }

◆ spawnfunc() [17/22]

spawnfunc ( team_CTL_bluelolly )

Definition at line 2841 of file sv_ctf.qc.

2841{ spawnfunc_item_flag_team2(this); }

◆ spawnfunc() [18/22]

spawnfunc ( team_ctl_bluelolly )

Definition at line 2840 of file sv_ctf.qc.

2840{ spawnfunc_item_flag_team2(this); }

◆ spawnfunc() [19/22]

spawnfunc ( team_CTL_redlolly )

Definition at line 2839 of file sv_ctf.qc.

2839{ spawnfunc_item_flag_team1(this); }

◆ spawnfunc() [20/22]

spawnfunc ( team_ctl_redlolly )

Definition at line 2838 of file sv_ctf.qc.

2838{ spawnfunc_item_flag_team1(this); }

◆ spawnfunc() [21/22]

spawnfunc ( team_neutralobelisk )

Definition at line 2833 of file sv_ctf.qc.

2833{ spawnfunc_item_flag_neutral(this); }

◆ spawnfunc() [22/22]

spawnfunc ( team_redplayer )

Definition at line 2836 of file sv_ctf.qc.

2836{ spawnfunc_info_player_team1(this); }

◆ superspec_msg()

void superspec_msg ( string _center_title,
string _con_title,
entity _to,
string _msg,
float _spamlevel )

Definition at line 63 of file sv_superspec.qc.

64{
65 sprint(_to, strcat(_con_title, _msg));
66
67 if(_to.superspec_flags & SSF_SILENT)
68 return;
69
70 if(_spamlevel > 1 && !(_to.superspec_flags & SSF_VERBOSE))
71 return;
72
73 centerprint(_to, strcat(_center_title, _msg));
74}
void sprint(float clientnum, string text,...)
void centerprint(string text,...)
const int SSF_VERBOSE
const int SSF_SILENT

References centerprint(), entity(), sprint(), SSF_SILENT, SSF_VERBOSE, and strcat().

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

◆ superspec_Spectate()

bool superspec_Spectate ( entity this,
entity targ )

Definition at line 27 of file sv_superspec.qc.

28{
29 Spectate(this, targ);
30 return true;
31}
bool Spectate(entity this, entity pl)
Definition client.qc:1977

References entity(), and Spectate().

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

Variable Documentation

◆ autocvar_g_ctf_allow_monster_touch

bool autocvar_g_ctf_allow_monster_touch

Definition at line 23 of file sv_ctf.qc.

◆ autocvar_g_ctf_allow_vehicle_carry

bool autocvar_g_ctf_allow_vehicle_carry

Definition at line 21 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_allow_vehicle_touch

bool autocvar_g_ctf_allow_vehicle_touch

Definition at line 22 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION(), and MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_drop_velocity_side

float autocvar_g_ctf_drop_velocity_side

Definition at line 34 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_drop_velocity_up

float autocvar_g_ctf_drop_velocity_up

Definition at line 33 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_dropped_capture_delay

float autocvar_g_ctf_dropped_capture_delay

Definition at line 92 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_dropped_capture_radius

float autocvar_g_ctf_dropped_capture_radius

Definition at line 93 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_dynamiclights

bool autocvar_g_ctf_dynamiclights

Definition at line 48 of file sv_ctf.qc.

Referenced by ctf_FlagSetup().

◆ autocvar_g_ctf_flag_collect_delay

float autocvar_g_ctf_flag_collect_delay

Definition at line 49 of file sv_ctf.qc.

Referenced by ctf_Handle_Capture(), and ctf_Handle_Return().

◆ autocvar_g_ctf_flag_damageforcescale

float autocvar_g_ctf_flag_damageforcescale

Definition at line 50 of file sv_ctf.qc.

Referenced by ctf_FlagSetup().

◆ autocvar_g_ctf_flag_dropped_floatinwater

bool autocvar_g_ctf_flag_dropped_floatinwater

Definition at line 52 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_flag_dropped_waypoint

bool autocvar_g_ctf_flag_dropped_waypoint

Definition at line 51 of file sv_ctf.qc.

Referenced by ctf_Handle_Drop().

◆ autocvar_g_ctf_flag_glowtrails

bool autocvar_g_ctf_flag_glowtrails

Definition at line 53 of file sv_ctf.qc.

Referenced by ctf_FlagSetup().

◆ autocvar_g_ctf_flag_health

float autocvar_g_ctf_flag_health

Definition at line 54 of file sv_ctf.qc.

Referenced by ctf_FlagSetup(), and ctf_Handle_Drop().

◆ autocvar_g_ctf_flag_return

bool autocvar_g_ctf_flag_return

Definition at line 55 of file sv_ctf.qc.

Referenced by ctf_FlagThink(), and ctf_Immediate_Return_Allowed().

◆ autocvar_g_ctf_flag_return_carried_radius

float autocvar_g_ctf_flag_return_carried_radius

Definition at line 57 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_flag_return_carrying

bool autocvar_g_ctf_flag_return_carrying

Definition at line 56 of file sv_ctf.qc.

Referenced by ctf_Immediate_Return_Allowed().

◆ autocvar_g_ctf_flag_return_damage

float autocvar_g_ctf_flag_return_damage

Definition at line 60 of file sv_ctf.qc.

Referenced by ctf_CheckFlagReturn(), ctf_FlagDamage(), ctf_FlagSetup(), and ctf_Handle_Drop().

◆ autocvar_g_ctf_flag_return_damage_delay

float autocvar_g_ctf_flag_return_damage_delay

Definition at line 61 of file sv_ctf.qc.

Referenced by ctf_FlagDamage(), and ctf_FlagThink().

◆ autocvar_g_ctf_flag_return_dropped

float autocvar_g_ctf_flag_return_dropped

Definition at line 62 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_flag_return_time

float autocvar_g_ctf_flag_return_time

Definition at line 58 of file sv_ctf.qc.

Referenced by ctf_CheckFlagReturn(), ctf_FlagThink(), ctf_Handle_Drop(), and ctf_Handle_Pickup().

◆ autocvar_g_ctf_flag_return_when_unreachable

bool autocvar_g_ctf_flag_return_when_unreachable

Definition at line 59 of file sv_ctf.qc.

Referenced by ctf_FlagSetup(), and ctf_Handle_Drop().

◆ autocvar_g_ctf_flag_stay

bool autocvar_g_ctf_flag_stay

Definition at line 63 of file sv_ctf.qc.

Referenced by ctf_Handle_Pickup().

◆ autocvar_g_ctf_flag_waypoint

bool autocvar_g_ctf_flag_waypoint = true

Definition at line 64 of file sv_ctf.qc.

Referenced by ctf_DelayedFlagSetup().

◆ autocvar_g_ctf_flag_waypoint_maxdistance

float autocvar_g_ctf_flag_waypoint_maxdistance

Definition at line 65 of file sv_ctf.qc.

Referenced by ctf_DelayedFlagSetup().

◆ autocvar_g_ctf_flagcarrier_auto_helpme_damage

float autocvar_g_ctf_flagcarrier_auto_helpme_damage

Definition at line 66 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_flagcarrier_auto_helpme_time

float autocvar_g_ctf_flagcarrier_auto_helpme_time

Definition at line 67 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_flagcarrier_damagefactor

float autocvar_g_ctf_flagcarrier_damagefactor

Definition at line 70 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_flagcarrier_forcefactor

float autocvar_g_ctf_flagcarrier_forcefactor

Definition at line 71 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_flagcarrier_selfdamagefactor

float autocvar_g_ctf_flagcarrier_selfdamagefactor

Definition at line 68 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_flagcarrier_selfforcefactor

float autocvar_g_ctf_flagcarrier_selfforcefactor

Definition at line 69 of file sv_ctf.qc.

Referenced by if().

◆ autocvar_g_ctf_fullbrightflags

bool autocvar_g_ctf_fullbrightflags

Definition at line 73 of file sv_ctf.qc.

Referenced by ctf_FlagSetup().

◆ autocvar_g_ctf_ignore_frags

bool autocvar_g_ctf_ignore_frags

Definition at line 74 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_oneflag_reverse

bool autocvar_g_ctf_oneflag_reverse

Definition at line 35 of file sv_ctf.qc.

◆ autocvar_g_ctf_pass

bool autocvar_g_ctf_pass

Definition at line 37 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_pass_arc

float autocvar_g_ctf_pass_arc

Definition at line 38 of file sv_ctf.qc.

Referenced by ctf_CalculatePassVelocity().

◆ autocvar_g_ctf_pass_arc_max

float autocvar_g_ctf_pass_arc_max

Definition at line 39 of file sv_ctf.qc.

Referenced by ctf_CalculatePassVelocity().

◆ autocvar_g_ctf_pass_directional_max

float autocvar_g_ctf_pass_directional_max

Definition at line 40 of file sv_ctf.qc.

Referenced by ctf_CheckPassDirection().

◆ autocvar_g_ctf_pass_directional_min

float autocvar_g_ctf_pass_directional_min

Definition at line 41 of file sv_ctf.qc.

Referenced by ctf_CheckPassDirection().

◆ autocvar_g_ctf_pass_radius

float autocvar_g_ctf_pass_radius

Definition at line 42 of file sv_ctf.qc.

Referenced by ctf_CheckPassDirection(), ctf_FlagThink(), and MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_pass_request

bool autocvar_g_ctf_pass_request

Definition at line 44 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_pass_timelimit

float autocvar_g_ctf_pass_timelimit

Definition at line 46 of file sv_ctf.qc.

Referenced by ctf_FlagThink().

◆ autocvar_g_ctf_pass_turnrate

float autocvar_g_ctf_pass_turnrate

Definition at line 45 of file sv_ctf.qc.

Referenced by ctf_CalculatePassVelocity().

◆ autocvar_g_ctf_pass_velocity

float autocvar_g_ctf_pass_velocity

Definition at line 47 of file sv_ctf.qc.

Referenced by ctf_CalculatePassVelocity().

◆ autocvar_g_ctf_pass_wait

float autocvar_g_ctf_pass_wait

Definition at line 43 of file sv_ctf.qc.

Referenced by ctf_Handle_Drop(), ctf_Handle_Retrieve(), and MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_portalteleport

bool autocvar_g_ctf_portalteleport

Definition at line 36 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_reverse

bool autocvar_g_ctf_reverse

Definition at line 91 of file sv_ctf.qc.

◆ autocvar_g_ctf_score_capture

int autocvar_g_ctf_score_capture

Definition at line 76 of file sv_ctf.qc.

Referenced by ctf_Handle_Capture().

◆ autocvar_g_ctf_score_capture_assist

int autocvar_g_ctf_score_capture_assist

Definition at line 77 of file sv_ctf.qc.

Referenced by ctf_Handle_Capture().

◆ autocvar_g_ctf_score_ignore_fields

bool autocvar_g_ctf_score_ignore_fields

Definition at line 75 of file sv_ctf.qc.

Referenced by ctf_FlagSetup().

◆ autocvar_g_ctf_score_kill

int autocvar_g_ctf_score_kill

Definition at line 78 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_score_penalty_drop

int autocvar_g_ctf_score_penalty_drop

Definition at line 79 of file sv_ctf.qc.

Referenced by ctf_Handle_Drop().

◆ autocvar_g_ctf_score_penalty_returned

int autocvar_g_ctf_score_penalty_returned

Definition at line 80 of file sv_ctf.qc.

Referenced by ctf_Handle_Return().

◆ autocvar_g_ctf_score_pickup_base

int autocvar_g_ctf_score_pickup_base

Definition at line 81 of file sv_ctf.qc.

Referenced by ctf_Handle_Pickup().

◆ autocvar_g_ctf_score_pickup_dropped_early

int autocvar_g_ctf_score_pickup_dropped_early

Definition at line 82 of file sv_ctf.qc.

Referenced by ctf_Handle_Pickup().

◆ autocvar_g_ctf_score_pickup_dropped_late

int autocvar_g_ctf_score_pickup_dropped_late

Definition at line 83 of file sv_ctf.qc.

Referenced by ctf_Handle_Pickup().

◆ autocvar_g_ctf_score_return

int autocvar_g_ctf_score_return

Definition at line 84 of file sv_ctf.qc.

Referenced by ctf_Handle_Return().

◆ autocvar_g_ctf_shield_force

float autocvar_g_ctf_shield_force

Definition at line 85 of file sv_ctf.qc.

Referenced by ctf_Initialize().

◆ autocvar_g_ctf_shield_max_ratio

float autocvar_g_ctf_shield_max_ratio

Definition at line 86 of file sv_ctf.qc.

Referenced by ctf_Initialize().

◆ autocvar_g_ctf_shield_min_negscore

int autocvar_g_ctf_shield_min_negscore

Definition at line 87 of file sv_ctf.qc.

Referenced by ctf_Initialize().

◆ autocvar_g_ctf_stalemate

bool autocvar_g_ctf_stalemate

Definition at line 88 of file sv_ctf.qc.

Referenced by ctf_CheckStalemate(), and ctf_FlagThink().

◆ autocvar_g_ctf_stalemate_endcondition

int autocvar_g_ctf_stalemate_endcondition

Definition at line 89 of file sv_ctf.qc.

Referenced by ctf_CheckStalemate().

◆ autocvar_g_ctf_stalemate_time

float autocvar_g_ctf_stalemate_time

Definition at line 90 of file sv_ctf.qc.

Referenced by ctf_CheckStalemate().

◆ autocvar_g_ctf_throw

bool autocvar_g_ctf_throw

Definition at line 24 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_throw_angle_max

float autocvar_g_ctf_throw_angle_max

Definition at line 25 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_throw_angle_min

float autocvar_g_ctf_throw_angle_min

Definition at line 26 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_throw_punish_count

int autocvar_g_ctf_throw_punish_count

Definition at line 27 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_throw_punish_delay

float autocvar_g_ctf_throw_punish_delay

Definition at line 28 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_throw_punish_time

float autocvar_g_ctf_throw_punish_time

Definition at line 29 of file sv_ctf.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ctf_throw_strengthmultiplier

float autocvar_g_ctf_throw_strengthmultiplier

Definition at line 30 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_throw_velocity_forward

float autocvar_g_ctf_throw_velocity_forward

Definition at line 31 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ autocvar_g_ctf_throw_velocity_up

float autocvar_g_ctf_throw_velocity_up

Definition at line 32 of file sv_ctf.qc.

Referenced by ctf_Handle_Throw().

◆ frag_damage

◆ frag_force

◆ frag_target

◆ pushable

bool pushable

Definition at line 1349 of file sv_ctf.qc.