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