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