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