Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_ctf.qh
Go to the documentation of this file.
1#pragma once
2
3#include "ctf.qh"
7
8void ctf_Initialize();
9
13
28
29// used in cheats.qc
30void ctf_RespawnFlag(entity flag);
31
32// score rule declarations
33const int ST_CTF_CAPS = 1;
34
35// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
36
38 // bones_was_here: previously after several calculations (inc FL_ITEM expansion with sv_legacy_bbox_expand 1)
39 // the old final bbox was '-28.44 -28.44 -32.08' '28.44 28.44 27.88' at FLAG_SCALE 0.6
40 // and the model was noticeably too tall to fit.
41 // The following values give '-30 -30 -32' '30 30 38' after vrint() at FLAG_SCALE 0.5625
42 // which match the 60x60x70 size of megas and powerups,
43 // keep the same origin.z height, and are a better fit for the model.
44 ATTRIB(Flag, m_mins, vector, '-53 -53 -57');
45 ATTRIB(Flag, m_maxs, vector, '53 53 68');
48
49// bones_was_here: previous FLAG_SCALE was 0.6 but model scale is floored to a 1/16 increment
50// so 9/16 was the real model scale. Applies to bbox too!
51const float FLAG_SCALE = 0.5625;
52
53const float FLAG_THINKRATE = 0.2;
54const float FLAG_TOUCHRATE = 0.5;
55const float WPFE_THINKRATE = 0.5;
56
57const vector FLAG_DROP_OFFSET = ('0 0 32');
58const vector FLAG_CARRY_OFFSET = ('-16 0 8');
59#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
60const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
61const int FLAG_FLOAT_OFFSET_Z = 32;
62const int FLAG_PASS_ARC_OFFSET_Z = -10;
63
64const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
65const float VEHICLE_FLAG_SCALE = 1.0;
66
68
69// waypoint colors
70#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
71#define WPCOLOR_FLAGCARRIER(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
72//#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color)
73#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
74
75// sounds
76#define snd_flag_taken noise
77#define snd_flag_returned noise1
78#define snd_flag_capture noise2
79#define snd_flag_respawn noise3
83
84// score fields
87.float score_drop; // note: negated
90.float score_team_capture; // shouldn't be too high
91
92// property set on objects to point to the flag they're carrying (if any)
94
95// effects
97.string passeffect;
98.string capeffect;
99
100// list of stale flags on the map
102
103// waypoint sprites
113
114// statuses
115const int FLAG_BASE = 1;
116const int FLAG_DROPPED = 2;
117const int FLAG_CARRY = 3;
118const int FLAG_PASSING = 4;
119
120const int DROP_NORMAL = 1;
121const int DROP_THROW = 2;
122const int DROP_PASS = 3;
123const int DROP_RESET = 4;
124
125const int PICKUP_BASE = 1;
126const int PICKUP_DROPPED = 2;
127
128const int CAPTURE_NORMAL = 1;
129const int CAPTURE_DROPPED = 2;
130
131const int RETURN_TIMEOUT = 1;
132const int RETURN_DROPPED = 2;
133const int RETURN_DAMAGE = 3;
134const int RETURN_SPEEDRUN = 4;
135const int RETURN_NEEDKILL = 5;
136
137bool ctf_Stalemate_Customize(entity this, entity client);
138
139void ctf_Handle_Throw(entity player, entity receiver, float droptype);
140
141// flag properties
142#define ctf_spawnorigin dropped_origin
143bool ctf_stalemate; // indicates that a stalemate is active
144float ctf_captimerecord; // record time for capturing the flag
148.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
149.entity ctf_dropper; // don't allow spam of dropping the flag
153.entity enemy; // when flag is back in the base, it remembers last player who carried/touched the flag, useful to bots
154
155// passing/throwing properties
162
163// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
164.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
165float ctf_captureshield_min_negscore; // punish at -20 points
166float ctf_captureshield_max_ratio; // punish at most 30% of each team
167float ctf_captureshield_force; // push force of the shield
168
169// 1 flag ctf
170bool ctf_oneflag; // indicates whether or not a neutral flag has been found
171
172// bot player logic
180
182
183void havocbot_role_ctf_setrole(entity bot, int role);
184
185// team checking
186#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
187#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
#define MUTATOR_ONADD
Definition base.qh:309
#define REGISTER_MUTATOR(...)
Definition base.qh:295
#define MUTATOR_STATIC()
Definition base.qh:313
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Definition sv_ctf.qh:37
vector m_maxs
Definition sv_ctf.qh:45
vector m_mins
Definition sv_ctf.qh:44
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
ATTRIB(Pickup, m_model, Model)
#define ITEM_HANDLE(signal,...)
Definition item.qh:125
#define IL_NEW()
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
vector
Definition self.qh:92
entity entity toucher
Definition self.qh:72
float wps_helpme_time
Definition sv_ctf.qh:110
const int PICKUP_BASE
Definition sv_ctf.qh:125
entity wps_flagreturn
Definition sv_ctf.qh:108
const int HAVOCBOT_CTF_ROLE_RETRIEVER
Definition sv_ctf.qh:178
float ctf_captureshield_min_negscore
Definition sv_ctf.qh:165
float wpforenemy_nextthink
Definition sv_ctf.qh:112
int throw_count
Definition sv_ctf.qh:161
const int DROP_NORMAL
Definition sv_ctf.qh:120
IntrusiveList g_flags
Definition sv_ctf.qh:12
void ctf_Handle_Throw(entity player, entity receiver, float droptype)
float ctf_landtime
Definition sv_ctf.qh:147
const int RETURN_DAMAGE
Definition sv_ctf.qh:133
void ctf_RespawnFlag(entity flag)
Definition sv_ctf.qc:1236
entity wps_enemyflagcarrier
Definition sv_ctf.qh:109
const int FLAG_FLOAT_OFFSET_Z
Definition sv_ctf.qh:61
entity wps_flagbase
Definition sv_ctf.qh:105
const int CAPTURE_DROPPED
Definition sv_ctf.qh:129
const int DROP_RESET
Definition sv_ctf.qh:123
bool ctf_stalemate
Definition sv_ctf.qh:143
string toucheffect
Definition sv_ctf.qh:96
const float FLAG_TOUCHRATE
Definition sv_ctf.qh:54
const vector FLAG_WAYPOINT_OFFSET
Definition sv_ctf.qh:60
const vector VEHICLE_FLAG_OFFSET
Definition sv_ctf.qh:64
float score_capture
Definition sv_ctf.qh:86
const int HAVOCBOT_CTF_ROLE_DEFENSE
Definition sv_ctf.qh:174
entity pass_sender
Definition sv_ctf.qh:157
const int HAVOCBOT_CTF_ROLE_MIDDLE
Definition sv_ctf.qh:175
string passeffect
Definition sv_ctf.qh:97
int ctf_teams
Definition sv_ctf.qh:152
const float FLAG_SCALE
Definition sv_ctf.qh:51
void ctf_FlagTouch(entity this, entity toucher)
Definition sv_ctf.qh:67
int ctf_status
Definition sv_ctf.qh:148
bool havocbot_cantfindflag
Definition sv_ctf.qh:181
string snd_flag_touch
Definition sv_ctf.qh:81
const int DROP_PASS
Definition sv_ctf.qh:122
const float WPFE_THINKRATE
Definition sv_ctf.qh:55
entity wps_flagcarrier
Definition sv_ctf.qh:106
entity pass_target
Definition sv_ctf.qh:158
int autocvar_captureleadlimit_override
Definition sv_ctf.qh:10
float ctf_captureshield_force
Definition sv_ctf.qh:167
bool ctf_Stalemate_Customize(entity this, entity client)
Definition sv_ctf.qc:886
const int FLAG_BASE
Definition sv_ctf.qh:115
entity ctf_staleflagnext
Definition sv_ctf.qh:101
float throw_prevtime
Definition sv_ctf.qh:160
float ctf_pickuptime
Definition sv_ctf.qh:145
entity wps_flagdropped
Definition sv_ctf.qh:107
string capeffect
Definition sv_ctf.qh:98
const int HAVOCBOT_CTF_ROLE_ESCORT
Definition sv_ctf.qh:179
const int FLAG_DROPPED
Definition sv_ctf.qh:116
const int HAVOCBOT_CTF_ROLE_NONE
Definition sv_ctf.qh:173
float score_team_capture
Definition sv_ctf.qh:90
entity ctf_dropper
Definition sv_ctf.qh:149
const int FLAG_PASSING
Definition sv_ctf.qh:118
entity flagcarried
Definition sv_ctf.qh:93
entity enemy
Definition sv_ctf.qh:153
Flag CTF_FLAG
Definition sv_ctf.qh:47
const int PICKUP_DROPPED
Definition sv_ctf.qh:126
entity wps_helpme
Definition sv_ctf.qh:104
void ctf_Initialize()
Definition sv_ctf.qc:2925
const int ST_CTF_CAPS
Definition sv_ctf.qh:33
float score_return
Definition sv_ctf.qh:89
bool ctf_captureshielded
Definition sv_ctf.qh:164
string snd_flag_pass
Definition sv_ctf.qh:82
bool ctf_flagdamaged_byworld
Definition sv_ctf.qh:151
const float FLAG_THINKRATE
Definition sv_ctf.qh:53
const int HAVOCBOT_CTF_ROLE_OFFENSE
Definition sv_ctf.qh:176
bool ctf_oneflag
Definition sv_ctf.qh:170
void havocbot_role_ctf_setrole(entity bot, int role)
Definition sv_ctf.qc:2177
const int RETURN_SPEEDRUN
Definition sv_ctf.qh:134
bool wpforenemy_announced
Definition sv_ctf.qh:111
const int RETURN_DROPPED
Definition sv_ctf.qh:132
float next_take_time
Definition sv_ctf.qh:150
const int CAPTURE_NORMAL
Definition sv_ctf.qh:128
float throw_antispam
Definition sv_ctf.qh:159
float score_pickup
Definition sv_ctf.qh:88
float ctf_captimerecord
Definition sv_ctf.qh:144
const int RETURN_NEEDKILL
Definition sv_ctf.qh:135
const float VEHICLE_FLAG_SCALE
Definition sv_ctf.qh:65
float score_assist
Definition sv_ctf.qh:85
const vector FLAG_CARRY_OFFSET
Definition sv_ctf.qh:58
const int DROP_THROW
Definition sv_ctf.qh:121
const int RETURN_TIMEOUT
Definition sv_ctf.qh:131
const int HAVOCBOT_CTF_ROLE_CARRIER
Definition sv_ctf.qh:177
const vector FLAG_DROP_OFFSET
Definition sv_ctf.qh:57
float score_drop
Definition sv_ctf.qh:87
float ctf_droptime
Definition sv_ctf.qh:146
string snd_flag_dropped
Definition sv_ctf.qh:80
const int FLAG_CARRY
Definition sv_ctf.qh:117
int autocvar_capturelimit_override
Definition sv_ctf.qh:11
const int FLAG_PASS_ARC_OFFSET_Z
Definition sv_ctf.qh:62
float ctf_captureshield_max_ratio
Definition sv_ctf.qh:166
float pass_distance
Definition sv_ctf.qh:156
void GameRules_limit_score(int limit)
Definition sv_rules.qc:23
void GameRules_teams(bool value)
Definition sv_rules.qc:3
void GameRules_limit_lead(int limit)
Definition sv_rules.qc:33