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