]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Merge branch 'TimePath/experiments/csqc_prediction' into Mario/qc_physics
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / defs.qh
1 #ifndef SERVER_DEFS_H
2 #define SERVER_DEFS_H
3
4 #include "../common/weapons/weapons.qh"
5
6 #define INDEPENDENT_ATTACK_FINISHED
7
8 noref float require_spawnfunc_prefix; // if this float exists, only functions with spawnfunc_ name prefix qualify as spawn functions
9
10 #define BUTTON_ATCK       button0
11 #define BUTTON_JUMP       button2
12 #define BUTTON_ATCK2      button3
13 #define BUTTON_ZOOM       button4
14 #define BUTTON_CROUCH     button5
15 #define BUTTON_HOOK       button6
16 #define BUTTON_INFO       button7
17 #define BUTTON_CHAT       buttonchat
18 #define BUTTON_USE        buttonuse
19 #define BUTTON_DRAG       button8
20 #define BUTTON_ZOOMSCRIPT button9
21 #define BUTTON_JETPACK    button10
22
23 // Globals
24
25 float g_cloaked, g_footsteps, g_grappling_hook, g_instagib;
26 float g_warmup_limit;
27 float g_warmup_allguns;
28 float g_warmup_allow_timeout;
29 float warmup_stage;
30 float g_pickup_respawntime_weapon;
31 float g_pickup_respawntime_superweapon;
32 float g_pickup_respawntime_ammo;
33 float g_pickup_respawntime_short;
34 float g_pickup_respawntime_medium;
35 float g_pickup_respawntime_long;
36 float g_pickup_respawntime_powerup;
37 float g_pickup_respawntimejitter_weapon;
38 float g_pickup_respawntimejitter_superweapon;
39 float g_pickup_respawntimejitter_ammo;
40 float g_pickup_respawntimejitter_short;
41 float g_pickup_respawntimejitter_medium;
42 float g_pickup_respawntimejitter_long;
43 float g_pickup_respawntimejitter_powerup;
44 float g_jetpack;
45
46 float sv_clones;
47 float sv_foginterval;
48
49 float player_count;
50 float currentbots;
51 float bots_would_leave;
52
53 void UpdateFrags(entity player, float f);
54 .float totalfrags;
55
56 float team1_score, team2_score, team3_score, team4_score;
57
58 float maxclients;
59
60 // flag set on worldspawn so that the code knows if it is dedicated or not
61 float server_is_dedicated;
62
63 // Fields
64
65 .void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) event_damage;
66
67 //.string       wad;
68 //.string       map;
69
70 //.float        worldtype;
71
72 .float  pain_finished;                  //Added by Supajoe
73 .float  pain_frame;                     //"
74 .float  crouch; // Crouching or not?
75
76 .float  strength_finished;
77 .float  invincible_finished;
78 .float  superweapons_finished;
79
80 .float cnt; // used in too many places
81 .float count;
82 //.float cnt2;
83
84 .float play_time;
85 .int respawn_flags;
86 .float respawn_time;
87 .float respawn_time_max;
88 .float death_time;
89 .float fade_time;
90 .float fade_rate;
91
92 // weapon animation vectors:
93 .vector anim_fire1;
94 .vector anim_fire2;
95 .vector anim_idle;
96 .vector anim_reload;
97
98 void() player_setupanimsformodel;
99 void setanim(entity e, vector anim, float looping, float override, float restart);
100
101 .string mdl;
102
103 .string playermodel;
104 .string playerskin;
105
106 .float species;
107
108 .float  respawntime;
109 .float  respawntimejitter;
110 //.float        chasecam;
111
112 .float  damageforcescale;
113 const float MIN_DAMAGEEXTRARADIUS = 2;
114 const float MAX_DAMAGEEXTRARADIUS = 16;
115 .float damageextraradius;
116
117 //.float          gravity;
118
119 .float          dmg;
120
121 // for railgun damage (hitting multiple enemies)
122 .float railgunhit;
123 .float railgunhitsolidbackup;
124 .vector railgunhitloc;
125
126 .float          air_finished;
127 .float          dmgtime;
128
129 .float          killcount;
130 .float damage_dealt, typehitsound;
131
132 .float watersound_finished;
133 .float iscreature;
134 .float damagedbycontents;
135 .float damagedbytriggers;
136 .float pushable;
137 .float teleportable;
138 .vector oldvelocity;
139
140 .float pauseregen_finished;
141 .float pauserothealth_finished;
142 .float pauserotarmor_finished;
143 .float pauserotfuel_finished;
144 .string item_pickupsound;
145
146 // definitions for weaponsystem
147 // more WEAPONTODO: move these to their proper files
148 .entity weaponentity;
149 .entity exteriorweaponentity;
150 .vector weaponentity_glowmod;
151
152 //.int weapon; // current weapon
153 .int switchweapon; // weapon requested to switch to
154 .int switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
155 .string weaponname; // name of .weapon
156
157 // WEAPONTODO
158 .float autoswitch;
159 //float WEP_ACTION(float wpn, float wrequest);
160 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
161 void w_clear();
162 void w_ready();
163 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
164 .float weapon_nextthink;
165 .void() weapon_think;
166
167
168 // weapon states (self.weaponentity.state)
169 const int WS_CLEAR                      = 0; // no weapon selected
170 const int WS_RAISE                      = 1; // raise frame
171 const int WS_DROP                               = 2; // deselecting frame
172 const int WS_INUSE                      = 3; // fire state
173 const int WS_READY                      = 4; // idle frame
174
175 // there is 2 weapon tics that can run in one server frame
176 const int W_TICSPERFRAME = 2;
177
178 void weapon_defaultspawnfunc(float wpn);
179
180 float gameover;
181 float intermission_running;
182 float intermission_exittime;
183 float alreadychangedlevel;
184
185 .float version;
186
187 // footstep interval
188 .float nextstep;
189
190 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
191 .float spectatortime; //point in time since the client is spectating or observing
192 void checkSpectatorBlock();
193
194 float game_completion_ratio; // 0 at start, 1 near end
195 .float winning;
196 .float jointime; // time of joining
197 .float alivetime; // time of being alive
198 .float motd_actived_time; // used for both motd and campaign_message
199
200 float nJoinAllowed(entity ignore);
201
202 .float spawnshieldtime;
203 .float item_spawnshieldtime;
204
205 .entity flagcarried;
206
207 .float playerid;
208 float playerid_last;
209 .float noalign;         // if set to 1, the item or spawnpoint won't be dropped to the floor
210
211 .vector spawnorigin;
212
213 .vector death_origin;
214 .vector killer_origin;
215
216 float default_player_alpha;
217 float default_weapon_alpha;
218
219 .float() customizeentityforclient;
220 .float cvar_cl_handicap;
221 .float cvar_cl_clippedspectating;
222 .float cvar_cl_autoscreenshot;
223 .float cvar_cl_jetpack_jump;
224 .float cvar_cl_movement_track_canjump;
225 .float cvar_cl_newusekeysupported;
226
227 .string cvar_g_xonoticversion;
228 .string cvar_cl_weaponpriority;
229 .string cvar_cl_weaponpriorities[10];
230 .float cvar_cl_gunalign;
231 .float cvar_cl_noantilag;
232
233 .string weaponorder_byimpulse;
234
235 .float cvar_cl_allow_uid2name;
236 .float cvar_cl_allow_uidtracking;
237 .string stored_netname;
238
239 .float version_nagtime;
240
241 string gamemode_name;
242
243 float startitem_failed;
244
245 string W_Apply_Weaponreplace(string in);
246
247 void FixIntermissionClient(entity e);
248 void FixClientCvars(entity e);
249
250 // WEAPONTODO: remove this
251 WepSet weaponsInMap;
252
253 .float respawn_countdown; // next number to count
254
255 float bot_waypoints_for_items;
256
257 .float attack_finished_for[WEP_MAXCOUNT];
258 .float attack_finished_single;
259 #ifdef INDEPENDENT_ATTACK_FINISHED
260 #define ATTACK_FINISHED_FOR(ent,w) ((ent).(attack_finished_for[(w) - WEP_FIRST]))
261 #else
262 #define ATTACK_FINISHED_FOR(ent,w) ((ent).attack_finished_single)
263 #endif
264 #define ATTACK_FINISHED(ent) ATTACK_FINISHED_FOR(ent,(ent).weapon)
265
266 // assault game mode: Which team is attacking in this round?
267 float assault_attacker_team;
268
269 // speedrun: when 1, player auto teleports back when capture timeout happens
270 .float speedrunning;
271
272 // database
273 float ServerProgsDB;
274 float TemporaryDB;
275
276 .float team_saved;
277
278 float some_spawn_has_been_used;
279 float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
280 float have_team_spawns_forteam[17]; // 0 = this team has no spawns, 1 = this team has spawns; team 0 is the "no-team"
281
282 // set when showing a kill countdown
283 .entity killindicator;
284 .float killindicator_teamchange;
285
286 void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force);
287
288 float lockteams;
289
290 .float parm_idlesince;
291 float sv_maxidle;
292 float sv_maxidle_spectatorsareidle;
293
294 float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
295
296 float next_pingtime;
297
298 .float Version;
299 .int SendFlags;
300 .float(entity to, float sendflags) SendEntity;
301
302 // player sounds, voice messages
303 // TODO implemented fall and falling
304 #define ALLPLAYERSOUNDS \
305                 _VOICEMSG(death) \
306                 _VOICEMSG(drown) \
307                 _VOICEMSG(fall) \
308                 _VOICEMSG(falling) \
309                 _VOICEMSG(gasp) \
310                 _VOICEMSG(jump) \
311                 _VOICEMSG(pain100) \
312                 _VOICEMSG(pain25) \
313                 _VOICEMSG(pain50) \
314                 _VOICEMSG(pain75)
315
316 #define ALLVOICEMSGS \
317                 _VOICEMSG(attack) \
318                 _VOICEMSG(attackinfive) \
319                 _VOICEMSG(coverme) \
320                 _VOICEMSG(defend) \
321                 _VOICEMSG(freelance) \
322                 _VOICEMSG(incoming) \
323                 _VOICEMSG(meet) \
324                 _VOICEMSG(needhelp) \
325                 _VOICEMSG(seenflag) \
326                 _VOICEMSG(taunt) \
327                 _VOICEMSG(teamshoot)
328
329 #define _VOICEMSG(m) .string playersound_##m;
330 ALLPLAYERSOUNDS
331 ALLVOICEMSGS
332 #undef _VOICEMSG
333
334 // reserved sound names for the future (some models lack sounds for them):
335 //              _VOICEMSG(flagcarriertakingdamage) \
336 //              _VOICEMSG(getflag) \
337 // reserved sound names for the future (ALL models lack sounds for them):
338 //              _VOICEMSG(affirmative) \
339 //              _VOICEMSG(attacking) \
340 //              _VOICEMSG(defending) \
341 //              _VOICEMSG(roaming) \
342 //              _VOICEMSG(onmyway) \
343 //              _VOICEMSG(droppedflag) \
344 //              _VOICEMSG(negative) \
345 //              _VOICEMSG(seenenemy) \
346
347 string globalsound_fall;
348 string globalsound_metalfall;
349 string globalsound_step;
350 string globalsound_metalstep;
351
352 const float VOICETYPE_PLAYERSOUND = 10;
353 const float VOICETYPE_TEAMRADIO = 11;
354 const float VOICETYPE_LASTATTACKER = 12;
355 const float VOICETYPE_LASTATTACKER_ONLY = 13;
356 const float VOICETYPE_AUTOTAUNT = 14;
357 const float VOICETYPE_TAUNT = 15;
358
359 void PrecachePlayerSounds(string f);
360 void PrecacheGlobalSound(string samplestring);
361 void UpdatePlayerSounds();
362 void ClearPlayerSounds();
363 void PlayerSound(.string samplefield, float channel, float voicetype);
364 void GlobalSound(string samplestring, float channel, float voicetype);
365 void FakeGlobalSound(string samplestring, float channel, float voicetype);
366 void VoiceMessage(string type, string message);
367 float GetPlayerSoundSampleField_notFound;
368 .string GetVoiceMessageSampleField(string type);
369
370 // autotaunt system
371 .float cvar_cl_autotaunt;
372 .float cvar_cl_voice_directional;
373 .float cvar_cl_voice_directional_taunt_attenuation;
374
375 .float version_mismatch;
376
377 float independent_players;
378 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
379 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
380 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER) + ((e).frags = FRAGS_PLAYER_NONSOLID))
381 // we're using + here instead of , because fteqcc sucks
382
383 string clientstuff;
384 .float phase;
385 .int pressedkeys;
386
387 .float porto_forbidden;
388
389 .string fog;
390
391 string cvar_changes;
392 string cvar_purechanges;
393 float cvar_purechanges_count;
394
395 float game_starttime; //point in time when the countdown to game start is over
396 float round_starttime; //point in time when the countdown to round start is over
397 .float stat_game_starttime;
398 .float stat_round_starttime;
399
400 void W_Porto_Remove (entity p);
401
402 .int projectiledeathtype;
403
404 .string message2;
405
406 .float stat_allow_oldvortexbeam;
407
408 // reset to 0 on weapon switch
409 // may be useful to all weapons
410 .float bulletcounter;
411
412 // Nexball
413 .entity ballcarried; // Also used for keepaway
414 .float metertime;
415 float g_nexball_meter_period;
416
417 void SUB_DontUseTargets();
418 void SUB_UseTargets();
419
420 .void() reset; // if set, an entity is reset using this
421 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
422
423 void ClientData_Touch(entity e);
424
425 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
426
427 .float wasplayer;
428
429 float servertime, serverprevtime, serverframetime;
430
431 .float ammo_fuel;
432
433 .vector prevorigin;
434
435 //flood fields
436 .float nickspamtime; // time of last nick change
437 .float nickspamcount;
438 .float floodcontrol_chat;
439 .float floodcontrol_chatteam;
440 .float floodcontrol_chattell;
441 .float floodcontrol_voice;
442 .float floodcontrol_voiceteam;
443
444 .float stat_shotorg; // networked stat for trueaim HUD
445
446 string matchid;
447
448 .float last_pickup;
449
450 .float hit_time;
451 .float typehit_time;
452
453 .float damage_dealt_total;
454
455 .float stat_leadlimit;
456
457 float radar_showennemies;
458
459 #ifdef PROFILING
460 float client_cefc_accumulator;
461 float client_cefc_accumulatortime;
462 #endif
463
464 .float weapon_load[WEP_MAXCOUNT];
465 .float ammo_none; // used by the reloading system, must always be 0
466 .float clip_load;
467 .float old_clip_load;
468 .float clip_size;
469
470 .entity lastrocket;
471 .float minelayer_mines;
472 .float vortex_charge;
473 .float vortex_charge_rottime;
474 .float vortex_chargepool_ammo;
475 .float hagar_load;
476
477 .float grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
478
479 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
480 // when doing this, hagar can go through clones
481 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
482
483 .float spectatee_status;
484 .float zoomstate;
485 .float restriction;
486
487 .entity clientdata;
488 .entity personal;
489
490 string deathmessage;
491
492 .float just_joined;
493
494 .float cvar_cl_weaponimpulsemode;
495 .float selectweapon; // last selected weapon of the player
496
497 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
498
499 const float ACTIVE_NOT          = 0;
500 const float ACTIVE_ACTIVE       = 1;
501 const float ACTIVE_IDLE         = 2;
502 const float ACTIVE_BUSY         = 2;
503 const float ACTIVE_TOGGLE       = 3;
504 .float active;
505 .void (float act_state) setactive;
506 .entity realowner;
507
508 //float serverflags;
509
510 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
511
512 .float player_blocked;
513 .float weapon_blocked; // weapon use disabled
514
515 .float frozen; // for freeze attacks
516 .float revive_progress;
517 .float revival_time; // time at which player was last revived
518 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
519 .entity iceblock;
520 .entity frozen_by; // for ice fields
521
522 .entity muzzle_flash;
523 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
524
525 .float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn
526
527 void PlayerUseKey();
528
529 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
530 .spawn_evalfunc_t spawn_evalfunc;
531
532 string modname;
533
534 .float missile_flags;
535 const int MIF_SPLASH = 2;
536 const int MIF_ARC = 4;
537 const int MIF_PROXY = 8;
538 const int MIF_GUIDED_MANUAL = 16;
539 const int MIF_GUIDED_HEAT = 32;
540 const int MIF_GUIDED_LASER = 64;
541 const int MIF_GUIDED_AI = 128;
542 const int MIF_GUIDED_TAG = 128;
543 #define MIF_GUIDED_ALL (MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
544 #define MIF_GUIDED_TRACKING (MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
545 #define MIF_GUIDED_CONFUSABLE (MIF_GUIDED_HEAT | MIF_GUIDED_AI)
546
547 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
548 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
549 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
550
551
552 ////
553
554 .entity player_stats;
555 //.float playerid;
556 .string playernick;
557 .float elos;
558 .float ranks;
559 #endif