]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Weapons: remove many direct references to `self`
[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
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 float player_count;
50 float currentbots;
51 float bots_would_leave;
52
53 void UpdateFrags(entity player, float f);
54 .float totalfrags;
55
56 float team1_score, team2_score, team3_score, team4_score;
57
58 float maxclients;
59
60 // flag set on worldspawn so that the code knows if it is dedicated or not
61 float server_is_dedicated;
62
63 // Fields
64
65 .void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
66
67 //.string       wad;
68 //.string       map;
69
70 //.float        worldtype;
71 // Needed for dynamic clientwalls
72 .float inactive; // Clientwall disappears when inactive
73 .float alpha_max, alpha_min;
74 .float fade_start, fade_end, fade_vertical_offset;
75 .float default_solid; // Variable to store default self.solid for clientwalls
76
77 .float  pain_finished;                  //Added by Supajoe
78 .float  pain_frame;                     //"
79 .float  crouch; // Crouching or not?
80
81 .float  strength_finished;
82 .float  invincible_finished;
83 .float  superweapons_finished;
84
85 .float cnt; // used in too many places
86 .float count;
87 //.float cnt2;
88
89 .float play_time;
90 .int respawn_flags;
91 .float respawn_time;
92 .float respawn_time_max;
93 .float death_time;
94 .float fade_time;
95 .float fade_rate;
96
97 // weapon animation vectors:
98 .vector anim_fire1;
99 .vector anim_fire2;
100 .vector anim_idle;
101 .vector anim_reload;
102
103 void() player_setupanimsformodel;
104 void setanim(entity e, vector anim, float looping, float override, float restart);
105
106 .string mdl;
107
108 .string playermodel;
109 .string playerskin;
110
111 .float species;
112
113 .float  scheduledrespawntime;
114 .float  respawntime;
115 .float  respawntimejitter;
116 //.float        chasecam;
117
118 .float  damageforcescale;
119 const float MIN_DAMAGEEXTRARADIUS = 2;
120 const float MAX_DAMAGEEXTRARADIUS = 16;
121 .float damageextraradius;
122
123 //.float          gravity;
124
125 .float          dmg;
126
127 // for railgun damage (hitting multiple enemies)
128 .float railgunhit;
129 .float railgunhitsolidbackup;
130 .vector railgunhitloc;
131
132 .float          air_finished;
133 .float          dmgtime;
134
135 .float          killcount;
136 .float damage_dealt, typehitsound;
137
138 .float watersound_finished;
139 .float iscreature;
140 .float damagedbycontents;
141 .float damagedbytriggers;
142 .float pushable;
143 .float teleportable;
144 .vector oldvelocity;
145
146 .float pauseregen_finished;
147 .float pauserothealth_finished;
148 .float pauserotarmor_finished;
149 .float pauserotfuel_finished;
150 // string overrides entity
151 .string item_pickupsound;
152 .entity item_pickupsound_ent;
153
154 // definitions for weaponsystem
155 // more WEAPONTODO: move these to their proper files
156 .entity weaponentity;
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, bool fire1, bool fire2);
169 void w_ready(Weapon thiswep, entity actor, bool fire1, bool fire2);
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, bool fire1, bool fire2) 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(float wpn);
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[WEP_MAXCOUNT];
267 .float attack_finished_single;
268 #ifdef INDEPENDENT_ATTACK_FINISHED
269 #define ATTACK_FINISHED_FOR(ent,w) ((ent).(attack_finished_for[(w) - WEP_FIRST]))
270 #else
271 #define ATTACK_FINISHED_FOR(ent,w) ((ent).attack_finished_single)
272 #endif
273 #define ATTACK_FINISHED(ent) ATTACK_FINISHED_FOR(ent,(ent).weapon)
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 .float Version;
308 .int SendFlags;
309 .bool(entity to, int sendflags) SendEntity;
310
311 // player sounds, voice messages
312 // TODO implemented fall and falling
313 #define ALLPLAYERSOUNDS \
314                 _VOICEMSG(death) \
315                 _VOICEMSG(drown) \
316                 _VOICEMSG(fall) \
317                 _VOICEMSG(falling) \
318                 _VOICEMSG(gasp) \
319                 _VOICEMSG(jump) \
320                 _VOICEMSG(pain100) \
321                 _VOICEMSG(pain25) \
322                 _VOICEMSG(pain50) \
323                 _VOICEMSG(pain75)
324
325 #define ALLVOICEMSGS \
326                 _VOICEMSG(attack) \
327                 _VOICEMSG(attackinfive) \
328                 _VOICEMSG(coverme) \
329                 _VOICEMSG(defend) \
330                 _VOICEMSG(freelance) \
331                 _VOICEMSG(incoming) \
332                 _VOICEMSG(meet) \
333                 _VOICEMSG(needhelp) \
334                 _VOICEMSG(seenflag) \
335                 _VOICEMSG(taunt) \
336                 _VOICEMSG(teamshoot)
337
338 #define _VOICEMSG(m) .string playersound_##m;
339 ALLPLAYERSOUNDS
340 ALLVOICEMSGS
341 #undef _VOICEMSG
342
343 // reserved sound names for the future (some models lack sounds for them):
344 //              _VOICEMSG(flagcarriertakingdamage) \
345 //              _VOICEMSG(getflag) \
346 // reserved sound names for the future (ALL models lack sounds for them):
347 //              _VOICEMSG(affirmative) \
348 //              _VOICEMSG(attacking) \
349 //              _VOICEMSG(defending) \
350 //              _VOICEMSG(roaming) \
351 //              _VOICEMSG(onmyway) \
352 //              _VOICEMSG(droppedflag) \
353 //              _VOICEMSG(negative) \
354 //              _VOICEMSG(seenenemy) \
355
356 string globalsound_fall;
357 string globalsound_metalfall;
358 string globalsound_step;
359 string globalsound_metalstep;
360
361 const float VOICETYPE_PLAYERSOUND = 10;
362 const float VOICETYPE_TEAMRADIO = 11;
363 const float VOICETYPE_LASTATTACKER = 12;
364 const float VOICETYPE_LASTATTACKER_ONLY = 13;
365 const float VOICETYPE_AUTOTAUNT = 14;
366 const float VOICETYPE_TAUNT = 15;
367
368 void PrecachePlayerSounds(string f);
369 void PrecacheGlobalSound(string samplestring);
370 void UpdatePlayerSounds();
371 void ClearPlayerSounds();
372 void PlayerSound(.string samplefield, float channel, float voicetype);
373 void GlobalSound(string samplestring, float channel, float voicetype);
374 void FakeGlobalSound(string samplestring, float channel, float voicetype);
375 void VoiceMessage(string type, string message);
376 float GetPlayerSoundSampleField_notFound;
377 .string GetVoiceMessageSampleField(string type);
378
379 // autotaunt system
380 .float cvar_cl_autotaunt;
381 .float cvar_cl_voice_directional;
382 .float cvar_cl_voice_directional_taunt_attenuation;
383
384 .float version_mismatch;
385
386 float independent_players;
387 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
388 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
389 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER) + ((e).frags = FRAGS_PLAYER_NONSOLID))
390 // we're using + here instead of , because fteqcc sucks
391
392 string clientstuff;
393 .float phase;
394 .int pressedkeys;
395
396 .float porto_forbidden;
397
398 .string fog;
399
400 string cvar_changes;
401 string cvar_purechanges;
402 float cvar_purechanges_count;
403
404 float game_starttime; //point in time when the countdown to game start is over
405 float round_starttime; //point in time when the countdown to round start is over
406 .float stat_game_starttime;
407 .float stat_round_starttime;
408
409 void W_Porto_Remove (entity p);
410
411 .int projectiledeathtype;
412
413 .string message2;
414
415 .float stat_allow_oldvortexbeam;
416
417 // reset to 0 on weapon switch
418 // may be useful to all weapons
419 .float bulletcounter;
420
421 // Nexball
422 .entity ballcarried; // Also used for keepaway
423 .float metertime;
424 float g_nexball_meter_period;
425
426 void SUB_DontUseTargets();
427 void SUB_UseTargets();
428
429 .void() reset; // if set, an entity is reset using this
430 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
431
432 void ClientData_Touch(entity e);
433
434 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
435
436 .float wasplayer;
437
438 float servertime, serverprevtime, serverframetime;
439
440 .float ammo_fuel;
441
442 .vector prevorigin;
443
444 //flood fields
445 .float nickspamtime; // time of last nick change
446 .float nickspamcount;
447 .float floodcontrol_chat;
448 .float floodcontrol_chatteam;
449 .float floodcontrol_chattell;
450 .float floodcontrol_voice;
451 .float floodcontrol_voiceteam;
452
453 .float stat_shotorg; // networked stat for trueaim HUD
454
455 string matchid;
456
457 .float last_pickup;
458
459 .float hit_time;
460 .float typehit_time;
461
462 .float damage_dealt_total;
463
464 .float stat_leadlimit;
465
466 bool radar_showennemies;
467
468 #ifdef PROFILING
469 float client_cefc_accumulator;
470 float client_cefc_accumulatortime;
471 #endif
472
473 .float weapon_load[WEP_MAXCOUNT];
474 .int ammo_none; // used by the reloading system, must always be 0
475 .float clip_load;
476 .float old_clip_load;
477 .float clip_size;
478
479 .entity lastrocket;
480 .float minelayer_mines;
481 .float vortex_charge;
482 .float vortex_charge_rottime;
483 .float vortex_chargepool_ammo;
484 .float hagar_load;
485
486 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
487
488 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
489 // when doing this, hagar can go through clones
490 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
491
492 .float spectatee_status;
493 .float zoomstate;
494 .float restriction;
495
496 .entity clientdata;
497 .entity personal;
498
499 string deathmessage;
500
501 .float just_joined;
502
503 .float cvar_cl_weaponimpulsemode;
504 .float selectweapon; // last selected weapon of the player
505
506 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
507
508 const float ACTIVE_NOT          = 0;
509 const float ACTIVE_ACTIVE       = 1;
510 const float ACTIVE_IDLE         = 2;
511 const float ACTIVE_BUSY         = 2;
512 const float ACTIVE_TOGGLE       = 3;
513 .float active;
514 .void (float act_state) setactive;
515 .entity realowner;
516
517 //float serverflags;
518
519 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
520
521 .float player_blocked;
522 .float weapon_blocked; // weapon use disabled
523
524 .float frozen; // for freeze attacks
525 .float revive_progress;
526 .float revival_time; // time at which player was last revived
527 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
528 .entity iceblock;
529 .entity frozen_by; // for ice fields
530
531 .entity muzzle_flash;
532 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
533
534 .float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn
535
536 void PlayerUseKey();
537
538 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
539 .spawn_evalfunc_t spawn_evalfunc;
540
541 string modname;
542
543 .float missile_flags;
544 const int MIF_SPLASH = 2;
545 const int MIF_ARC = 4;
546 const int MIF_PROXY = 8;
547 const int MIF_GUIDED_MANUAL = 16;
548 const int MIF_GUIDED_HEAT = 32;
549 const int MIF_GUIDED_LASER = 64;
550 const int MIF_GUIDED_AI = 128;
551 const int MIF_GUIDED_TAG = 128;
552 #define MIF_GUIDED_ALL (MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
553 #define MIF_GUIDED_TRACKING (MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG)
554 #define MIF_GUIDED_CONFUSABLE (MIF_GUIDED_HEAT | MIF_GUIDED_AI)
555
556 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
557 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
558 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
559
560
561 ////
562
563 .entity player_stats;
564 //.float playerid;
565 .string playernick;
566 .float elos;
567 .float ranks;
568
569 .string cvar_cl_physics;
570
571 .float init_for_player_needed;
572 .void(entity) init_for_player;
573
574 #endif