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