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