]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/gamemode_ctf.qh
Merge branch 'master' into Mario/ctf_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_ctf.qh
1 #ifndef GAMEMODE_CTF_H
2 #define GAMEMODE_CTF_H
3 // these are needed since mutators are compiled last
4
5 #ifdef SVQC
6 // used in cheats.qc
7 void ctf_RespawnFlag(entity flag);
8
9 // score rule declarations
10 const int ST_CTF_CAPS = 1;
11 const int SP_CTF_CAPS = 4;
12 const int SP_CTF_CAPTIME = 5;
13 const int SP_CTF_PICKUPS = 6;
14 const int SP_CTF_DROPS = 7;
15 const int SP_CTF_FCKILLS = 8;
16 const int SP_CTF_RETURNS = 9;
17
18 // flag constants // for most of these, there is just one question to be asked: WHYYYYY?
19 #define FLAG_MIN (PL_MIN_CONST + '0 0 -13')
20 #define FLAG_MAX (PL_MAX_CONST + '0 0 -13')
21
22 const float FLAG_SCALE = 0.6;
23
24 const float FLAG_THINKRATE = 0.2;
25 const float FLAG_TOUCHRATE = 0.5;
26 const float WPFE_THINKRATE = 0.5;
27
28 const vector FLAG_DROP_OFFSET = ('0 0 32');
29 const vector FLAG_CARRY_OFFSET = ('-16 0 8');
30 #define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
31 const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
32 const vector FLAG_FLOAT_OFFSET = ('0 0 32');
33 const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
34
35 const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
36 const float VEHICLE_FLAG_SCALE = 1.0;
37
38 // waypoint colors
39 #define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
40 #define WPCOLOR_FLAGCARRIER(t) ('0.8 0.8 0')
41 #define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
42
43 // sounds
44 #define snd_flag_taken noise
45 #define snd_flag_returned noise1
46 #define snd_flag_capture noise2
47 #define snd_flag_respawn noise3
48 .string snd_flag_dropped;
49 .string snd_flag_touch;
50 .string snd_flag_pass;
51
52 // effects
53 .string toucheffect;
54 .string passeffect;
55 .string capeffect;
56
57 // list of flags on the map
58 entity ctf_worldflaglist;
59 .entity ctf_worldflagnext;
60 .entity ctf_staleflagnext;
61
62 // waypoint sprites
63 .entity bot_basewaypoint; // flag waypointsprite
64 .entity wps_helpme;
65 .entity wps_flagbase;
66 .entity wps_flagcarrier;
67 .entity wps_flagdropped;
68 .entity wps_enemyflagcarrier;
69 .float wps_helpme_time;
70 bool wpforenemy_announced;
71 float wpforenemy_nextthink;
72
73 // statuses
74 const int FLAG_BASE = 1;
75 const int FLAG_DROPPED = 2;
76 const int FLAG_CARRY = 3;
77 const int FLAG_PASSING = 4;
78
79 const int DROP_NORMAL = 1;
80 const int DROP_THROW = 2;
81 const int DROP_PASS = 3;
82 const int DROP_RESET = 4;
83
84 const int PICKUP_BASE = 1;
85 const int PICKUP_DROPPED = 2;
86
87 const int CAPTURE_NORMAL = 1;
88 const int CAPTURE_DROPPED = 2;
89
90 const int RETURN_TIMEOUT = 1;
91 const int RETURN_DROPPED = 2;
92 const int RETURN_DAMAGE = 3;
93 const int RETURN_SPEEDRUN = 4;
94 const int RETURN_NEEDKILL = 5;
95
96 void ctf_Handle_Throw(entity player, entity receiver, float droptype);
97
98 // flag properties
99 #define ctf_spawnorigin dropped_origin
100 bool ctf_stalemate; // indicates that a stalemate is active
101 float ctf_captimerecord; // record time for capturing the flag
102 .float ctf_pickuptime;
103 .float ctf_droptime;
104 .int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
105 .entity ctf_dropper; // don't allow spam of dropping the flag
106 .int max_flag_health;
107 .float next_take_time;
108 .bool ctf_flagdamaged;
109 int ctf_teams;
110
111 // passing/throwing properties
112 .float pass_distance;
113 .entity pass_sender;
114 .entity pass_target;
115 .float throw_antispam;
116 .float throw_prevtime;
117 .int throw_count;
118
119 // CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
120 .bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
121 float ctf_captureshield_min_negscore; // punish at -20 points
122 float ctf_captureshield_max_ratio; // punish at most 30% of each team
123 float ctf_captureshield_force; // push force of the shield
124
125 // 1 flag ctf
126 bool ctf_oneflag; // indicates whether or not a neutral flag has been found
127
128 // bot player logic
129 const int HAVOCBOT_CTF_ROLE_NONE = 0;
130 const int HAVOCBOT_CTF_ROLE_DEFENSE = 2;
131 const int HAVOCBOT_CTF_ROLE_MIDDLE = 4;
132 const int HAVOCBOT_CTF_ROLE_OFFENSE = 8;
133 const int HAVOCBOT_CTF_ROLE_CARRIER = 16;
134 const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
135 const int HAVOCBOT_CTF_ROLE_ESCORT = 64;
136
137 .bool havocbot_cantfindflag;
138
139 vector havocbot_ctf_middlepoint;
140 float havocbot_ctf_middlepoint_radius;
141
142 void havocbot_role_ctf_setrole(entity bot, int role);
143
144 // team checking
145 #define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
146 #define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
147
148 // networked flag statuses
149 .int ctf_flagstatus;
150 #endif
151
152 const int CTF_RED_FLAG_TAKEN                    = 1;
153 const int CTF_RED_FLAG_LOST                             = 2;
154 const int CTF_RED_FLAG_CARRYING                 = 3;
155 const int CTF_BLUE_FLAG_TAKEN                   = 4;
156 const int CTF_BLUE_FLAG_LOST                    = 8;
157 const int CTF_BLUE_FLAG_CARRYING                = 12;
158 const int CTF_YELLOW_FLAG_TAKEN                 = 16;
159 const int CTF_YELLOW_FLAG_LOST                  = 32;
160 const int CTF_YELLOW_FLAG_CARRYING              = 48;
161 const int CTF_PINK_FLAG_TAKEN                   = 64;
162 const int CTF_PINK_FLAG_LOST                    = 128;
163 const int CTF_PINK_FLAG_CARRYING                = 192;
164 const int CTF_NEUTRAL_FLAG_TAKEN                = 256;
165 const int CTF_NEUTRAL_FLAG_LOST                 = 512;
166 const int CTF_NEUTRAL_FLAG_CARRYING             = 768;
167 const int CTF_FLAG_NEUTRAL                              = 2048;
168 const int CTF_SHIELDED                                  = 4096;
169
170 #endif