]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Merge branch 'master' into terencehill/menu_optimization
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / defs.qh
1 #ifndef SERVER_DEFS_H
2 #define SERVER_DEFS_H
3
4 #include "../common/weapons/all.qh"
5 #include "../common/stats.qh"
6
7 #define INDEPENDENT_ATTACK_FINISHED 1
8
9 #define BUTTON_ATCK       button0
10 #define BUTTON_JUMP       button2
11 #define BUTTON_ATCK2      button3
12 #define BUTTON_ZOOM       button4
13 #define BUTTON_CROUCH     button5
14 #define BUTTON_HOOK       button6
15 #define BUTTON_INFO       button7
16 #define BUTTON_CHAT       buttonchat
17 #define BUTTON_USE        buttonuse
18 #define BUTTON_DRAG       button8
19 #define BUTTON_ZOOMSCRIPT button9
20 #define BUTTON_JETPACK    button10
21
22 // Globals
23
24 float g_footsteps, g_grappling_hook, g_instagib;
25 float g_warmup_limit;
26 float g_warmup_allguns;
27 float g_warmup_allow_timeout;
28 float warmup_stage;
29 PROPERTY(float, g_pickup_respawntime_weapon)
30 PROPERTY(float, g_pickup_respawntime_superweapon)
31 PROPERTY(float, g_pickup_respawntime_ammo)
32 PROPERTY(float, g_pickup_respawntime_short)
33 PROPERTY(float, g_pickup_respawntime_medium)
34 PROPERTY(float, g_pickup_respawntime_long)
35 PROPERTY(float, g_pickup_respawntime_powerup)
36 PROPERTY(float, g_pickup_respawntimejitter_weapon)
37 PROPERTY(float, g_pickup_respawntimejitter_superweapon)
38 PROPERTY(float, g_pickup_respawntimejitter_ammo)
39 PROPERTY(float, g_pickup_respawntimejitter_short)
40 PROPERTY(float, g_pickup_respawntimejitter_medium)
41 PROPERTY(float, g_pickup_respawntimejitter_long)
42 PROPERTY(float, g_pickup_respawntimejitter_powerup)
43 float g_jetpack;
44
45 float sv_clones;
46 float sv_foginterval;
47
48 float player_count;
49 float currentbots;
50 float bots_would_leave;
51
52 void UpdateFrags(entity player, float f);
53 .float totalfrags;
54
55 float team1_score, team2_score, team3_score, team4_score;
56
57 // flag set on worldspawn so that the code knows if it is dedicated or not
58 float server_is_dedicated;
59
60 // Fields
61
62 .void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
63
64 //.string       wad;
65 //.string       map;
66
67 //.float        worldtype;
68 // Needed for dynamic clientwalls
69 .float inactive; // Clientwall disappears when inactive
70 .float alpha_max, alpha_min;
71 .float fade_start, fade_end, fade_vertical_offset;
72 .float default_solid; // Variable to store default self.solid for clientwalls
73
74 .float  pain_finished;                  //Added by Supajoe
75 .float  pain_frame;                     //"
76 .float  crouch; // Crouching or not?
77
78 .float  strength_finished = _STAT(STRENGTH_FINISHED);
79 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
80 .float  superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
81
82 .float cnt; // used in too many places
83 .float count;
84 //.float cnt2;
85
86 .float play_time;
87 .int respawn_flags;
88 .float respawn_time;
89 .float respawn_time_max;
90 .float death_time;
91 .float fade_time;
92 .float fade_rate;
93
94 void() player_setupanimsformodel;
95
96 .string mdl;
97
98 .string playermodel;
99 .string playerskin;
100
101 .float species;
102
103 .float  scheduledrespawntime;
104 .float  respawntime;
105 .float  respawntimejitter;
106 //.float        chasecam;
107
108 .float  damageforcescale;
109 const float MIN_DAMAGEEXTRARADIUS = 2;
110 const float MAX_DAMAGEEXTRARADIUS = 16;
111 .float damageextraradius;
112
113 //.float          gravity;
114
115 .float          dmg;
116
117 // for railgun damage (hitting multiple enemies)
118 .float railgunhit;
119 .float railgunhitsolidbackup;
120 .vector railgunhitloc;
121
122 .float          air_finished;
123 .float          dmgtime;
124
125 .float          killcount;
126 .float damage_dealt, typehitsound;
127
128 .float watersound_finished;
129 .float iscreature;
130 .float damagedbycontents;
131 .float damagedbytriggers;
132 .float pushable;
133 .float teleportable;
134 .vector oldvelocity;
135
136 .float pauseregen_finished;
137 .float pauserothealth_finished;
138 .float pauserotarmor_finished;
139 .float pauserotfuel_finished;
140 // string overrides entity
141 .string item_pickupsound;
142 .entity item_pickupsound_ent;
143 .entity item_model_ent;
144
145 // WEAPONTODO
146 .float autoswitch;
147 bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain);
148 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
149 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
150 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
151 .float weapon_nextthink;
152 .void(Weapon thiswep, entity actor, .entity weaponentity, int fire) weapon_think;
153
154
155 // there is 2 weapon tics that can run in one server frame
156 const int W_TICSPERFRAME = 2;
157
158 void weapon_defaultspawnfunc(entity this, Weapon e);
159
160 float gameover;
161 float intermission_running;
162 float intermission_exittime;
163 float alreadychangedlevel;
164
165 .float version;
166
167 // footstep interval
168 .float nextstep;
169
170 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
171 .float spectatortime; //point in time since the client is spectating or observing
172 void checkSpectatorBlock();
173
174 float game_completion_ratio; // 0 at start, 1 near end
175 .float winning;
176 .float jointime; // time of joining
177 .float alivetime; // time of being alive
178 .float motd_actived_time; // used for both motd and campaign_message
179
180 float nJoinAllowed(entity ignore);
181
182 .float spawnshieldtime;
183 .float item_spawnshieldtime;
184
185 .entity flagcarried;
186
187 .int playerid;
188 float playerid_last;
189 .float noalign;         // if set to 1, the item or spawnpoint won't be dropped to the floor
190
191 .vector death_origin;
192 .vector killer_origin;
193
194 float default_player_alpha;
195 float default_weapon_alpha;
196
197 .float() customizeentityforclient;
198 .float cvar_cl_handicap;
199 .float cvar_cl_clippedspectating;
200 .float cvar_cl_autoscreenshot;
201 .float cvar_cl_jetpack_jump;
202 .float cvar_cl_movement_track_canjump = _STAT(MOVEVARS_CL_TRACK_CANJUMP);
203 .float cvar_cl_newusekeysupported;
204
205 .string cvar_g_xonoticversion;
206 .string cvar_cl_weaponpriority;
207 .string cvar_cl_weaponpriorities[10];
208 .float cvar_cl_gunalign;
209 .float cvar_cl_noantilag;
210
211 .string weaponorder_byimpulse;
212
213 .float cvar_cl_allow_uid2name;
214 .float cvar_cl_allow_uidtracking;
215 .string stored_netname;
216
217 .float version_nagtime;
218
219 string gamemode_name;
220
221 float startitem_failed;
222
223 string W_Apply_Weaponreplace(string in);
224
225 void FixIntermissionClient(entity e);
226 void FixClientCvars(entity e);
227
228 // WEAPONTODO: remove this
229 WepSet weaponsInMap;
230
231 #define weapons _STAT(WEAPONS)
232 #define weaponsinmap _STAT(WEAPONSINMAP)
233
234 .float respawn_countdown; // next number to count
235
236 float bot_waypoints_for_items;
237
238 .float attack_finished_for[Weapons_MAX * MAX_WEAPONSLOTS];
239 .float attack_finished_single[MAX_WEAPONSLOTS];
240 #if INDEPENDENT_ATTACK_FINISHED
241 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
242 #else
243 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
244 #endif
245 #define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, PS(ent).m_weapon.m_id, slot)
246
247 // assault game mode: Which team is attacking in this round?
248 float assault_attacker_team;
249
250 // speedrun: when 1, player auto teleports back when capture timeout happens
251 .float speedrunning;
252
253 // database
254 float ServerProgsDB;
255 float TemporaryDB;
256
257 .float team_saved;
258
259 float some_spawn_has_been_used;
260 float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
261 float have_team_spawns_forteam[17]; // 0 = this team has no spawns, 1 = this team has spawns; team 0 is the "no-team"
262
263 // set when showing a kill countdown
264 .entity killindicator;
265 .float killindicator_teamchange;
266
267 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
268
269 float lockteams;
270
271 .float parm_idlesince;
272 float sv_maxidle;
273 float sv_maxidle_spectatorsareidle;
274
275 float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
276
277 float next_pingtime;
278
279 // autotaunt system
280 .float cvar_cl_autotaunt;
281 .float cvar_cl_voice_directional;
282 .float cvar_cl_voice_directional_taunt_attenuation;
283
284 .float version_mismatch;
285
286 int autocvar__independent_players;
287 bool independent_players;
288 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
289 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
290 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_NONSOLID))
291
292 string clientstuff;
293 .float phase;
294 .int pressedkeys = _STAT(PRESSED_KEYS);
295
296 .string fog;
297
298 string cvar_changes;
299 string cvar_purechanges;
300 float cvar_purechanges_count;
301
302 float game_starttime; //point in time when the countdown to game start is over
303 float round_starttime; //point in time when the countdown to round start is over
304 .float stat_game_starttime = _STAT(GAMESTARTTIME);
305 .float stat_round_starttime = _STAT(ROUNDSTARTTIME);
306
307 void W_Porto_Remove (entity p);
308
309 .int projectiledeathtype;
310
311 .string message2;
312
313 .bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
314
315 // reset to 0 on weapon switch
316 // may be useful to all weapons
317 .float bulletcounter;
318
319 // Nexball
320 .entity ballcarried; // Also used for keepaway
321 float g_nexball_meter_period;
322
323 void SUB_DontUseTargets();
324 void SUB_UseTargets();
325
326 .void(entity this) reset; // if set, an entity is reset using this
327 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
328
329 void ClientData_Touch(entity e);
330
331 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
332
333 .float wasplayer;
334
335 float servertime, serverprevtime, serverframetime;
336
337 .float ammo_fuel;
338
339 .vector prevorigin;
340
341 //flood fields
342 .float nickspamtime; // time of last nick change
343 .float nickspamcount;
344 .float floodcontrol_chat;
345 .float floodcontrol_chatteam;
346 .float floodcontrol_chattell;
347 .float floodcontrol_voice;
348 .float floodcontrol_voiceteam;
349
350 .float stat_shotorg = _STAT(SHOTORG); // networked stat for trueaim HUD
351
352 string matchid;
353
354 .float last_pickup = _STAT(LAST_PICKUP);
355
356 .float hit_time = _STAT(HIT_TIME);
357 .float typehit_time = _STAT(TYPEHIT_TIME);
358
359 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
360
361 .float stat_leadlimit = _STAT(LEADLIMIT);
362
363 bool radar_showennemies;
364
365 #ifdef PROFILING
366 float client_cefc_accumulator;
367 float client_cefc_accumulatortime;
368 #endif
369
370 .float weapon_load[Weapons_MAX];
371 .int ammo_none; // used by the reloading system, must always be 0
372 .float clip_load = _STAT(WEAPON_CLIPLOAD);
373 .float old_clip_load;
374 .float clip_size = _STAT(WEAPON_CLIPSIZE);
375
376 .float minelayer_mines = _STAT(LAYED_MINES);
377 .float vortex_charge = _STAT(VORTEX_CHARGE);
378 .float vortex_charge_rottime;
379 .float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
380 .float hagar_load = _STAT(HAGAR_LOAD);
381
382 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
383
384 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
385 // when doing this, hagar can go through clones
386 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
387
388 .float spectatee_status;
389 .float zoomstate;
390 .float restriction;
391
392 .entity clientdata;
393 .entity personal;
394
395 string deathmessage;
396
397 .float just_joined;
398
399 .float cvar_cl_weaponimpulsemode;
400 .float selectweapon; // last selected weapon of the player
401
402 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
403
404 const float ACTIVE_NOT          = 0;
405 const float ACTIVE_ACTIVE       = 1;
406 const float ACTIVE_IDLE         = 2;
407 const float ACTIVE_BUSY         = 2;
408 const float ACTIVE_TOGGLE       = 3;
409 .float active;
410 .void (float act_state) setactive;
411 .entity realowner;
412
413 //float serverflags;
414
415 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
416
417 .float player_blocked;
418 .float weapon_blocked; // weapon use disabled
419
420 .float frozen = _STAT(FROZEN); // for freeze attacks
421 .float revive_progress = _STAT(REVIVE_PROGRESS);
422 .float revival_time; // time at which player was last revived
423 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
424 .entity iceblock;
425 .entity frozen_by; // for ice fields
426
427 .entity muzzle_flash;
428 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
429
430 .float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
431
432 void PlayerUseKey();
433
434 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
435 .spawn_evalfunc_t spawn_evalfunc;
436
437 string modname;
438
439 .float missile_flags;
440 const int MIF_SPLASH = BIT(1);
441 const int MIF_ARC = BIT(2);
442 const int MIF_PROXY = BIT(3);
443 const int MIF_GUIDED_MANUAL = BIT(4);
444 const int MIF_GUIDED_HEAT = BIT(5);
445 const int MIF_GUIDED_LASER = BIT(6);
446 const int MIF_GUIDED_AI = BIT(7);
447 const int MIF_GUIDED_TAG = BIT(7);
448 const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
449 const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
450 const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
451
452 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
453 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
454 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
455
456
457 ////
458
459 .entity player_stats;
460 //.float playerid;
461 .string playernick;
462 .float elos;
463 .float ranks;
464
465 .string cvar_cl_physics;
466
467 .float init_for_player_needed;
468 .void(entity) init_for_player;
469
470 #endif