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