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