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