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