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