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