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