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