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