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