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