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