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