]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Merge branch 'Mario/wepent_experimental' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / defs.qh
1 #pragma once
2
3 float warmup_limit;
4 #include <common/weapons/_all.qh>
5 #include <common/stats.qh>
6
7 #define INDEPENDENT_ATTACK_FINISHED 1
8
9 // Globals
10
11 float g_footsteps, g_grappling_hook, g_instagib;
12 float g_warmup_allguns;
13 float g_warmup_allow_timeout;
14 float warmup_stage;
15 float g_jetpack;
16
17 float sv_clones;
18 float sv_foginterval;
19
20 float player_count;
21 float currentbots;
22 float bots_would_leave;
23
24 void UpdateFrags(entity player, int f);
25 .float totalfrags;
26
27 float team1_score, team2_score, team3_score, team4_score;
28
29 // flag set on worldspawn so that the code knows if it is dedicated or not
30 float server_is_dedicated;
31
32 // Fields
33
34 .void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
35
36 //.string       wad;
37 //.string       map;
38
39 //.float        worldtype;
40 // Needed for dynamic clientwalls
41 .float inactive; // Clientwall disappears when inactive
42 .float alpha_max, alpha_min;
43 .float fade_start, fade_end, fade_vertical_offset;
44 .float default_solid; // Variable to store default .solid for clientwalls
45
46 .float  pain_finished;                  //Added by Supajoe
47 .float  pain_frame;                     //"
48 .float  crouch; // Crouching or not?
49
50 .float  strength_finished = _STAT(STRENGTH_FINISHED);
51 .float  invincible_finished = _STAT(INVINCIBLE_FINISHED);
52 .float  superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
53
54 .float cnt; // used in too many places
55 .float count;
56 //.float cnt2;
57
58 .float play_time;
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 .float railgunhit;
92 .float railgunhitsolidbackup;
93 .vector railgunhitloc;
94
95 .float          air_finished;
96 .float          dmgtime;
97
98 .float          killcount;
99 .float damage_dealt, typehitsound;
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 .float version;
137
138 // footstep interval
139 .float nextstep;
140
141 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
142 .float spectatortime; //point in time since the client is spectating or observing
143 void checkSpectatorBlock(entity this);
144
145 float game_completion_ratio; // 0 at start, 1 near end
146 .float winning;
147 .float jointime; // time of joining
148 .float alivetime; // time of being alive
149 .float motd_actived_time; // used for both motd and campaign_message
150
151 bool nJoinAllowed(entity this, entity ignore);
152
153 .float spawnshieldtime;
154 .float item_spawnshieldtime;
155
156 .entity flagcarried;
157
158 .int playerid;
159 .float noalign;         // if set to 1, the item or spawnpoint won't be dropped to the floor
160
161 .vector death_origin;
162
163 float default_player_alpha;
164 float default_weapon_alpha;
165
166 .float cvar_cl_handicap;
167 .float cvar_cl_clippedspectating;
168 .float cvar_cl_autoscreenshot;
169 .float cvar_cl_jetpack_jump;
170 .float cvar_cl_movement_track_canjump = _STAT(MOVEVARS_CL_TRACK_CANJUMP);
171 .float cvar_cl_newusekeysupported;
172
173 .string cvar_g_xonoticversion;
174 .string cvar_cl_weaponpriority;
175 .string cvar_cl_weaponpriorities[10];
176 .float cvar_cl_noantilag;
177
178 .string weaponorder_byimpulse;
179
180 .float cvar_cl_allow_uid2name;
181 .float cvar_cl_allow_uidtracking;
182 .string stored_netname;
183
184 .float version_nagtime;
185
186 string gamemode_name;
187
188 float startitem_failed;
189
190 string W_Apply_Weaponreplace(string in);
191
192 void FixIntermissionClient(entity e);
193 void FixClientCvars(entity e);
194
195 // WEAPONTODO: remove this
196 WepSet weaponsInMap;
197
198 #define weapons _STAT(WEAPONS)
199
200 .float respawn_countdown; // next number to count
201
202 float bot_waypoints_for_items;
203
204 .float attack_finished_for[Weapons_MAX * MAX_WEAPONSLOTS];
205 .float attack_finished_single[MAX_WEAPONSLOTS];
206 #if INDEPENDENT_ATTACK_FINISHED
207 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
208 #else
209 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
210 #endif
211 #define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, ent.(weaponentity).m_weapon.m_id, slot)
212
213 // assault game mode: Which team is attacking in this round?
214 float assault_attacker_team;
215
216 // speedrun: when 1, player auto teleports back when capture timeout happens
217 .float speedrunning;
218
219 // database
220 float ServerProgsDB;
221 float TemporaryDB;
222
223 .float team_saved;
224
225 float some_spawn_has_been_used;
226 float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
227 float have_team_spawns_forteam[17]; // 0 = this team has no spawns, 1 = this team has spawns; team 0 is the "no-team"
228
229 // set when showing a kill countdown
230 .entity killindicator;
231 .float killindicator_teamchange;
232
233 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
234
235 float lockteams;
236
237 .float parm_idlesince;
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 .float version_mismatch;
253
254 int autocvar__independent_players;
255 bool independent_players;
256 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
257 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
258 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_NONSOLID))
259
260 string clientstuff;
261 .float phase;
262 .int pressedkeys;
263
264 .string fog;
265
266 string cvar_changes;
267 string cvar_purechanges;
268 float cvar_purechanges_count;
269
270 float game_starttime; //point in time when the countdown to game start is over
271 float round_starttime; //point in time when the countdown to round start is over
272
273 void W_Porto_Remove (entity p);
274
275 .int projectiledeathtype;
276
277 .string message2;
278
279 // reset to 0 on weapon switch
280 // may be useful to all weapons
281 .float bulletcounter;
282
283 // Nexball
284 .entity ballcarried; // Also used for keepaway
285 float g_nexball_meter_period;
286
287 void SUB_DontUseTargets(entity this, entity actor, entity trigger);
288 void SUB_UseTargets(entity this, entity actor, entity trigger);
289
290 .void(entity this) reset; // if set, an entity is reset using this
291 .void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
292
293 void ClientData_Touch(entity e);
294
295 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
296
297 .float wasplayer;
298
299 float servertime, serverprevtime, serverframetime;
300
301 .float ammo_fuel;
302
303 .vector prevorigin;
304
305 //flood fields
306 .float nickspamtime; // time of last nick change
307 .float nickspamcount;
308 .float floodcontrol_chat;
309 .float floodcontrol_chatteam;
310 .float floodcontrol_chattell;
311 .float floodcontrol_voice;
312 .float floodcontrol_voiceteam;
313
314 .float stat_shotorg = _STAT(SHOTORG); // networked stat for trueaim HUD
315
316 string matchid;
317
318 .float last_pickup = _STAT(LAST_PICKUP);
319
320 .float hit_time = _STAT(HIT_TIME);
321 .float typehit_time = _STAT(TYPEHIT_TIME);
322
323 .float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
324
325 bool radar_showennemies;
326
327 #ifdef PROFILING
328 float client_cefc_accumulator;
329 float client_cefc_accumulatortime;
330 #endif
331
332 .float weapon_load[Weapons_MAX];
333 .int ammo_none; // used by the reloading system, must always be 0
334 .float clip_load = _STAT(WEAPON_CLIPLOAD);
335 .float old_clip_load;
336 .float clip_size = _STAT(WEAPON_CLIPSIZE);
337
338 .float minelayer_mines = _STAT(LAYED_MINES);
339 .float vortex_charge = _STAT(VORTEX_CHARGE);
340 .float vortex_charge_rottime;
341 .float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
342 .float hagar_load = _STAT(HAGAR_LOAD);
343
344 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
345
346 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
347 // when doing this, hagar can go through clones
348 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
349
350 .float spectatee_status;
351 .float zoomstate;
352 .float restriction;
353
354 .entity clientdata;
355 .entity personal;
356
357 string deathmessage;
358
359 .bool just_joined;
360
361 .float cvar_cl_weaponimpulsemode;
362 .float selectweapon; // last selected weapon of the player
363
364 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
365
366 const float ACTIVE_NOT          = 0;
367 const float ACTIVE_ACTIVE       = 1;
368 const float ACTIVE_IDLE         = 2;
369 const float ACTIVE_BUSY         = 2;
370 const float ACTIVE_TOGGLE       = 3;
371 .float active;
372 .void (entity this, int act_state) setactive;
373 .entity realowner;
374
375 //float serverflags;
376
377 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
378
379 .float player_blocked;
380 .float weapon_blocked; // weapon use disabled
381
382 .float revive_progress = _STAT(REVIVE_PROGRESS);
383 .float revival_time; // time at which player was last revived
384 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
385 .entity iceblock;
386 .entity frozen_by; // for ice fields
387
388 .entity muzzle_flash;
389 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
390
391 .float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
392
393 void PlayerUseKey(entity this);
394
395 USING(spawn_evalfunc_t, vector(entity this, entity player, entity spot, vector current));
396 .spawn_evalfunc_t spawn_evalfunc;
397
398 string modname;
399
400 .float missile_flags;
401 const int MIF_SPLASH = BIT(1);
402 const int MIF_ARC = BIT(2);
403 const int MIF_PROXY = BIT(3);
404 const int MIF_GUIDED_MANUAL = BIT(4);
405 const int MIF_GUIDED_HEAT = BIT(5);
406 const int MIF_GUIDED_LASER = BIT(6);
407 const int MIF_GUIDED_AI = BIT(7);
408 const int MIF_GUIDED_TAG = BIT(7);
409 const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
410 const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
411 const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
412
413 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
414 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
415 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
416
417 ////
418
419 .string cvar_cl_physics;
420
421 .void(entity this, entity player) init_for_player;
422
423 IntrusiveList g_monsters;
424 STATIC_INIT(g_monsters) { g_monsters = IL_NEW(); }
425
426 IntrusiveList g_waypoints;
427 STATIC_INIT(g_waypoints) { g_waypoints = IL_NEW(); }
428
429 IntrusiveList g_vehicles;
430 STATIC_INIT(g_vehicles) { g_vehicles = IL_NEW(); }
431
432 IntrusiveList g_turrets;
433 STATIC_INIT(g_turrets) { g_turrets = IL_NEW(); }
434
435 IntrusiveList g_mines;
436 STATIC_INIT(g_mines) { g_mines = IL_NEW(); }
437
438 IntrusiveList g_projectiles;
439 STATIC_INIT(g_projectiles) { g_projectiles = IL_NEW(); }
440
441 IntrusiveList g_items;
442 STATIC_INIT(g_items) { g_items = IL_NEW(); }
443
444 IntrusiveList g_initforplayer;
445 STATIC_INIT(g_initforplayer) { g_initforplayer = IL_NEW(); }
446
447 IntrusiveList g_clones;
448 STATIC_INIT(g_clones) { g_clones = IL_NEW(); }
449
450 IntrusiveList g_assault_destructibles;
451 STATIC_INIT(g_assault_destructibles) { g_assault_destructibles = IL_NEW(); }
452
453 IntrusiveList g_assault_objectivedecreasers;
454 STATIC_INIT(g_assault_objectivedecreasers) { g_assault_objectivedecreasers = IL_NEW(); }
455
456 IntrusiveList g_assault_objectives;
457 STATIC_INIT(g_assault_objectives) { g_assault_objectives = IL_NEW(); }
458
459 IntrusiveList g_spawnpoints;
460 STATIC_INIT(g_spawnpoints) { g_spawnpoints = IL_NEW(); }
461
462 IntrusiveList g_bot_targets;
463 STATIC_INIT(g_bot_targets) { g_bot_targets = IL_NEW(); }
464
465 IntrusiveList g_bot_dodge;
466 STATIC_INIT(g_bot_dodge) { g_bot_dodge = IL_NEW(); }
467
468 IntrusiveList g_damagedbycontents;
469 STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); }