]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Purge self from event_damage
[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 // TODO: deprecated: remove. Replaced by physics.qh PHYS_INPUT_BUTTON_*
10
11 #define BUTTON_ATCK       button0
12 #define BUTTON_JUMP       button2
13 #define BUTTON_ATCK2      button3
14 #define BUTTON_ZOOM       button4
15 #define BUTTON_CROUCH     button5
16 #define BUTTON_HOOK       button6
17 #define BUTTON_INFO       button7
18 #define BUTTON_DRAG       button8
19 #define BUTTON_USE        buttonuse
20 #define BUTTON_CHAT       buttonchat
21 #define BUTTON_PRYDON     cursor_active
22 #define BUTTON_ZOOMSCRIPT button9
23 #define BUTTON_JETPACK    button10
24
25 // Globals
26
27 float g_footsteps, g_grappling_hook, g_instagib;
28 float g_warmup_limit;
29 float g_warmup_allguns;
30 float g_warmup_allow_timeout;
31 float warmup_stage;
32 PROPERTY(float, g_pickup_respawntime_weapon)
33 PROPERTY(float, g_pickup_respawntime_superweapon)
34 PROPERTY(float, g_pickup_respawntime_ammo)
35 PROPERTY(float, g_pickup_respawntime_short)
36 PROPERTY(float, g_pickup_respawntime_medium)
37 PROPERTY(float, g_pickup_respawntime_long)
38 PROPERTY(float, g_pickup_respawntime_powerup)
39 PROPERTY(float, g_pickup_respawntimejitter_weapon)
40 PROPERTY(float, g_pickup_respawntimejitter_superweapon)
41 PROPERTY(float, g_pickup_respawntimejitter_ammo)
42 PROPERTY(float, g_pickup_respawntimejitter_short)
43 PROPERTY(float, g_pickup_respawntimejitter_medium)
44 PROPERTY(float, g_pickup_respawntimejitter_long)
45 PROPERTY(float, g_pickup_respawntimejitter_powerup)
46 float g_jetpack;
47
48 float sv_clones;
49 float sv_foginterval;
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 // 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 this, 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 = _STAT(STRENGTH_FINISHED);
82 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
83 .float  superweapons_finished = _STAT(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 void() player_setupanimsformodel;
98
99 .string mdl;
100
101 .string playermodel;
102 .string playerskin;
103
104 .float species;
105
106 .float  scheduledrespawntime;
107 .float  respawntime;
108 .float  respawntimejitter;
109 //.float        chasecam;
110
111 .float  damageforcescale;
112 const float MIN_DAMAGEEXTRARADIUS = 2;
113 const float MAX_DAMAGEEXTRARADIUS = 16;
114 .float damageextraradius;
115
116 //.float          gravity;
117
118 .float          dmg;
119
120 // for railgun damage (hitting multiple enemies)
121 .float railgunhit;
122 .float railgunhitsolidbackup;
123 .vector railgunhitloc;
124
125 .float          air_finished;
126 .float          dmgtime;
127
128 .float          killcount;
129 .float damage_dealt, typehitsound;
130
131 .float watersound_finished;
132 .float iscreature;
133 .float damagedbycontents;
134 .float damagedbytriggers;
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 bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool 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 bool nJoinAllowed(entity this, 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 = _STAT(MOVEVARS_CL_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_noantilag;
211
212 .string weaponorder_byimpulse;
213
214 .float cvar_cl_allow_uid2name;
215 .float cvar_cl_allow_uidtracking;
216 .string stored_netname;
217
218 .float version_nagtime;
219
220 string gamemode_name;
221
222 float startitem_failed;
223
224 string W_Apply_Weaponreplace(string in);
225
226 void FixIntermissionClient(entity e);
227 void FixClientCvars(entity e);
228
229 // WEAPONTODO: remove this
230 WepSet weaponsInMap;
231
232 #define weapons _STAT(WEAPONS)
233 #define weaponsinmap _STAT(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, PS(ent).m_weapon.m_id, 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 // autotaunt system
281 .float cvar_cl_autotaunt;
282 .float cvar_cl_voice_directional;
283 .float cvar_cl_voice_directional_taunt_attenuation;
284
285 .float version_mismatch;
286
287 int autocvar__independent_players;
288 bool independent_players;
289 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
290 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
291 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_NONSOLID))
292
293 string clientstuff;
294 .float phase;
295 .int pressedkeys = _STAT(PRESSED_KEYS);
296
297 .string fog;
298
299 string cvar_changes;
300 string cvar_purechanges;
301 float cvar_purechanges_count;
302
303 float game_starttime; //point in time when the countdown to game start is over
304 float round_starttime; //point in time when the countdown to round start is over
305 .float stat_game_starttime = _STAT(GAMESTARTTIME);
306 .float stat_round_starttime = _STAT(ROUNDSTARTTIME);
307
308 void W_Porto_Remove (entity p);
309
310 .int projectiledeathtype;
311
312 .string message2;
313
314 .bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
315
316 // reset to 0 on weapon switch
317 // may be useful to all weapons
318 .float bulletcounter;
319
320 // Nexball
321 .entity ballcarried; // Also used for keepaway
322 float g_nexball_meter_period;
323
324 void SUB_DontUseTargets();
325 void SUB_UseTargets();
326
327 .void(entity this) reset; // if set, an entity is reset using this
328 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
329
330 void ClientData_Touch(entity e);
331
332 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
333
334 .float wasplayer;
335
336 float servertime, serverprevtime, serverframetime;
337
338 .float ammo_fuel;
339
340 .vector prevorigin;
341
342 //flood fields
343 .float nickspamtime; // time of last nick change
344 .float nickspamcount;
345 .float floodcontrol_chat;
346 .float floodcontrol_chatteam;
347 .float floodcontrol_chattell;
348 .float floodcontrol_voice;
349 .float floodcontrol_voiceteam;
350
351 .float stat_shotorg = _STAT(SHOTORG); // networked stat for trueaim HUD
352
353 string matchid;
354
355 .float last_pickup = _STAT(LAST_PICKUP);
356
357 .float hit_time = _STAT(HIT_TIME);
358 .float typehit_time = _STAT(TYPEHIT_TIME);
359
360 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
361
362 .float stat_leadlimit = _STAT(LEADLIMIT);
363
364 bool radar_showennemies;
365
366 #ifdef PROFILING
367 float client_cefc_accumulator;
368 float client_cefc_accumulatortime;
369 #endif
370
371 .float weapon_load[Weapons_MAX];
372 .int ammo_none; // used by the reloading system, must always be 0
373 .float clip_load = _STAT(WEAPON_CLIPLOAD);
374 .float old_clip_load;
375 .float clip_size = _STAT(WEAPON_CLIPSIZE);
376
377 .float minelayer_mines = _STAT(LAYED_MINES);
378 .float vortex_charge = _STAT(VORTEX_CHARGE);
379 .float vortex_charge_rottime;
380 .float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
381 .float hagar_load = _STAT(HAGAR_LOAD);
382
383 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
384
385 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
386 // when doing this, hagar can go through clones
387 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
388
389 .float spectatee_status;
390 .float zoomstate;
391 .float restriction;
392
393 .entity clientdata;
394 .entity personal;
395
396 string deathmessage;
397
398 .float just_joined;
399
400 .float cvar_cl_weaponimpulsemode;
401 .float selectweapon; // last selected weapon of the player
402
403 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
404
405 const float ACTIVE_NOT          = 0;
406 const float ACTIVE_ACTIVE       = 1;
407 const float ACTIVE_IDLE         = 2;
408 const float ACTIVE_BUSY         = 2;
409 const float ACTIVE_TOGGLE       = 3;
410 .float active;
411 .void (float act_state) setactive;
412 .entity realowner;
413
414 //float serverflags;
415
416 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
417
418 .float player_blocked;
419 .float weapon_blocked; // weapon use disabled
420
421 .float frozen = _STAT(FROZEN); // for freeze attacks
422 .float revive_progress = _STAT(REVIVE_PROGRESS);
423 .float revival_time; // time at which player was last revived
424 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
425 .entity iceblock;
426 .entity frozen_by; // for ice fields
427
428 .entity muzzle_flash;
429 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
430
431 .float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
432
433 void PlayerUseKey();
434
435 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
436 .spawn_evalfunc_t spawn_evalfunc;
437
438 string modname;
439
440 .float missile_flags;
441 const int MIF_SPLASH = BIT(1);
442 const int MIF_ARC = BIT(2);
443 const int MIF_PROXY = BIT(3);
444 const int MIF_GUIDED_MANUAL = BIT(4);
445 const int MIF_GUIDED_HEAT = BIT(5);
446 const int MIF_GUIDED_LASER = BIT(6);
447 const int MIF_GUIDED_AI = BIT(7);
448 const int MIF_GUIDED_TAG = BIT(7);
449 const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
450 const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
451 const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
452
453 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
454 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
455 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
456
457
458 ////
459
460 .entity player_stats;
461 //.float playerid;
462 .string playernick;
463 .float elos;
464 .float ranks;
465
466 .string cvar_cl_physics;
467
468 .float init_for_player_needed;
469 .void(entity) init_for_player;
470
471 #endif