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