Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
client.qc
Go to the documentation of this file.
1#include "client.qh"
2
5#include <common/debug.qh>
8#include <common/ent_cs.qh>
11#include <common/items/_mod.qh>
29#include <common/net_linked.qh>
30#include <common/net_notice.qh>
33#include <common/playerstats.qh>
35#include <common/state.qh>
36#include <common/stats.qh>
39#include <common/viewloc.qh>
42#include <common/wepent.qh>
46#include <server/anticheat.qh>
47#include <server/antilag.qh>
48#include <server/bot/api.qh>
51#include <server/campaign.qh>
52#include <server/chat.qh>
53#include <server/cheats.qh>
54#include <server/clientkill.qh>
56#include <server/command/cmd.qh>
60#include <server/damage.qh>
61#include <server/gamelog.qh>
62#include <server/handicap.qh>
63#include <server/hook.qh>
64#include <server/impulse.qh>
66#include <server/ipban.qh>
67#include <server/main.qh>
69#include <server/player.qh>
70#include <server/portals.qh>
71#include <server/race.qh>
72#include <server/scores.qh>
74#include <server/spawnpoints.qh>
75#include <server/teamplay.qh>
82#include <server/world.qh>
83
84STATIC_METHOD(Client, Add, void(Client this, int _team))
85{
86 ClientConnect(this);
88 this.frame = 12; // 7
89 this.team = _team;
91}
92
93STATIC_METHOD(Client, Remove, void(Client this))
94{
95 TRANSMUTE(Observer, this);
98}
99
101{
102 if(!player) return 0; // not sure how, but best to be safe
103
104 int spec_count = 0;
105
106 FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_SPEC(it) && it != to && it.enemy == player,
107 {
108 spec_count++;
109 });
110
111 return spec_count;
112}
113
115{
116 if(!player) return; // not sure how, but best to be safe
117
118 int spec_count = 0;
119 FOREACH_CLIENT(IS_REAL_CLIENT(it) && IS_SPEC(it) && it != to && it.enemy == player,
120 {
121 if(spec_count >= MAX_SPECTATORS)
122 break;
123 WriteByte(MSG_ENTITY, num_for_edict(it));
124 ++spec_count;
125 });
126}
127
128bool ClientData_Send(entity this, entity to, int sf)
129{
130 assert(to == this.owner, return false);
131
132 entity e = to;
133 if (IS_SPEC(e)) e = e.enemy;
134
135 sf = 0;
136 if (CS(e).race_completed) sf |= BIT(0); // forced scoreboard
137 if (CS(to).spectatee_status) sf |= BIT(1); // spectator ent number follows
138 if (CS(e).zoomstate) sf |= BIT(2); // zoomed
140 sf |= BIT(3); // observing blocked
142 sf |= BIT(4); // show spectators
144 sf |= (autocvar_sv_teamnagger & 0x03) << 5; // BIT(5) | BIT(6)
145 if (to.ignore_list && to.ignore_list_send_time == IGNORE_LIST_SEND_NOW && !IS_SPEC(to))
146 sf |= BIT(7); // ignore list (private, won't be sent to spectators)
147
148 WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA);
150
151 if (sf & BIT(1))
153
154 // spectator list is cleared on the client if this flag is not set
155 if(sf & BIT(4))
156 {
157 float specs = CountSpectators(e, to);
158 WriteByte(MSG_ENTITY, specs);
159 WriteSpectators(e, to);
160 }
161
162 // ignore list is NOT cleared on the client if this flag is not set
163 if (sf & BIT(7))
164 {
165 to.ignore_list_send_time = 0;
166 WriteString(MSG_ENTITY, strcat(to.ignore_list));
167 }
168
169 return true;
170}
171
173{
175 CS(this).clientdata.drawonlytoclient = this;
176 CS(this).clientdata.owner = this;
177}
178
180{
181 delete(CS(this).clientdata);
182 CS(this).clientdata = NULL;
183}
184
185void ClientData_Touch(entity e, bool to_spectators_too)
186{
187 entity cd = CS(e).clientdata;
188 if (cd) cd.SendFlags = 1;
189
190 if (to_spectators_too)
191 FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != e && IS_SPEC(it) && it.enemy == e,
192 {
193 entity cd_spec = CS(it).clientdata;
194 if (cd_spec) cd_spec.SendFlags = cd.SendFlags;
195 });
196}
197
198
199/*
200=============
201CheckPlayerModel
202
203Checks if the argument string can be a valid playermodel.
204Returns a valid one in doubt.
205=============
206*/
208string CheckPlayerModel(string plyermodel)
209{
210 if(FallbackPlayerModel != cvar_defstring("_cl_playermodel"))
211 {
212 // note: we cannot summon Don Strunzone here, some player may
213 // still have the model string set. In case anyone manages how
214 // to change a cvar default, we'll have a small leak here.
215 FallbackPlayerModel = strzone(cvar_defstring("_cl_playermodel"));
216 }
217 // only in right path
218 if(substring(plyermodel, 0, 14) != "models/player/")
219 return FallbackPlayerModel;
220 // only good file extensions
221 if(substring(plyermodel, -4, 4) != ".iqm"
222 && substring(plyermodel, -4, 4) != ".zym"
223 && substring(plyermodel, -4, 4) != ".dpm"
224 && substring(plyermodel, -4, 4) != ".md3"
225 && substring(plyermodel, -4, 4) != ".psk")
226 return FallbackPlayerModel;
227
228 // forbid the LOD models
229 if(substring(plyermodel, -9, 5) == "_lod1" || substring(plyermodel, -9, 5) == "_lod2")
230 return FallbackPlayerModel;
231 if(plyermodel != strtolower(plyermodel))
232 return FallbackPlayerModel;
233 // also, restrict to server models
235 if(!fexists(plyermodel))
236 return FallbackPlayerModel;
237
238 return plyermodel;
239}
240
241void setplayermodel(entity e, string modelname)
242{
243 precache_model(modelname);
244 _setmodel(e, modelname);
248}
249
251{
254 {
255 RandomSelection_AddEnt(it, 1, 1);
256 });
258}
259
261void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
262{
263 bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this, is_forced);
264 bool recount_ready = false;
265 PlayerState_detach(this);
266
267 bool was_player = false;
268 if (IS_PLAYER(this))
269 {
270 if(GetResource(this, RES_HEALTH) >= 1)
271 {
272 // despawn effect
273 Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
274 }
275
276 // was a player, recount votes and ready status
277 if(IS_REAL_CLIENT(this))
278 {
279 if (vote_called) { VoteCount(false); }
280 this.ready = false;
281 if (warmup_stage || game_starttime > time) /* warmup OR countdown */ recount_ready = true;
282 }
284 was_player = true;
285 }
286
287 if (use_spawnpoint)
288 {
289 // first try to find a random "nice" location to view from
290 entity spot = SelectObservePoint(this);
291 bool is_observepoint = (spot != NULL);
292 if(!spot) // otherwise just use the player spawn points
293 spot = SelectSpawnPoint(this, true);
294 if (!spot) LOG_FATAL("No spawnpoints for observers?!?");
295
296 this.angles = vec2(spot.angles);
297 // offset it so that the spectator spawns higher off the ground, looks better this way
298 setorigin(this, spot.origin + (is_observepoint ? '0 0 0' : autocvar_sv_player_viewoffset));
299 }
300 else // change origin to restore previous view origin
301 setorigin(this, this.origin + STAT(PL_VIEW_OFS, this) - STAT(PL_CROUCH_VIEW_OFS, this));
302 this.fixangle = true;
303
304 if (IS_REAL_CLIENT(this))
305 {
306 msg_entity = this;
308 WriteEntity(MSG_ONE, this);
309 }
310 // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
311 // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
313 {
314 // needed for player sounds
315 this.model = "";
316 FixPlayermodel(this);
317 }
318 setmodel(this, MDL_Null);
319 setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
320 this.view_ofs = '0 0 0';
321
323 Portal_ClearAll(this);
324 SetSpectatee(this, NULL);
325
326 if (this.alivetime_start)
327 {
328 if (!warmup_stage)
330 this.alivetime_start = 0;
331 }
332
333 if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
334
335 TRANSMUTE(Observer, this);
336
338 accuracy_resend(this);
339
341 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
342
343 CS(this).spectatortime = time;
344 if (!autocvar_sv_spectate && CS(this).autojoin_checked) // unnecessary if autojoin succeeds, on failure it notifies
345 Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
346
347 if(this.bot_attack)
349 this.bot_attack = false;
350 if(this.monster_attack)
352 this.monster_attack = false;
353 STAT(HUD, this) = HUD_NORMAL;
354 this.iscreature = false;
356 if(this.damagedbycontents)
358 this.damagedbycontents = false;
359 SetResourceExplicit(this, RES_HEALTH, FRAGS_SPECTATOR);
360 SetSpectatee_status(this, etof(this));
361 this.takedamage = DAMAGE_NO;
362 this.solid = SOLID_NOT;
363 set_movetype(this, MOVETYPE_FLY_WORLDONLY); // user preference is controlled by playerprethink
364 this.flags = FL_CLIENT | FL_NOTARGET;
365 this.effects = 0;
367 this.pauserotarmor_finished = 0;
369 this.pauseregen_finished = 0;
370 this.damageforcescale = 0;
371 this.death_time = 0;
372 this.respawn_flags = 0;
373 this.respawn_time = 0;
374 STAT(RESPAWN_TIME, this) = 0;
375 this.alpha = 0;
376 this.scale = 0;
377 this.fade_time = 0;
378 this.pain_finished = 0;
379 STAT(AIR_FINISHED, this) = 0;
380 //this.dphitcontentsmask = 0;
384 this.pushltime = 0;
385 this.istypefrag = 0;
386 setthink(this, func_null);
387 this.nextthink = 0;
388 this.deadflag = DEAD_NO;
389 UNSET_DUCKED(this);
390 this.draggable = drag_undraggable;
391
392 player_powerups_remove_all(this, was_player);
393 this.items = 0;
394 STAT(WEAPONS, this) = '0 0 0';
395 this.drawonlytoclient = this;
396
397 this.viewloc = NULL;
398
399 //this.spawnpoint_targ = NULL; // keep it so they can return to where they were?
400
401 this.weaponmodel = "";
402 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
403 {
404 this.weaponentities[slot] = NULL;
405 }
407 CS(this).killcount = FRAGS_SPECTATOR;
408 this.velocity = '0 0 0';
409 this.avelocity = '0 0 0';
410 this.punchangle = '0 0 0';
411 this.punchvector = '0 0 0';
412 this.oldvelocity = this.velocity;
413 this.event_damage = func_null;
414 this.event_heal = func_null;
415
416 for(int slot = 0; slot < MAX_AXH; ++slot)
417 {
418 entity axh = this.(AuxiliaryXhair[slot]);
419 this.(AuxiliaryXhair[slot]) = NULL;
420
421 if(axh.owner == this && axh != NULL && !wasfreed(axh))
422 delete(axh);
423 }
424
425 if (mutator_returnvalue)
426 {
427 // mutator prevents resetting teams+score
428 }
429 else
430 {
431 SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR); // clears scores too in gametypes without teams
432 this.frags = FRAGS_SPECTATOR;
433 }
434
436
437 if (CS(this).just_joined)
438 CS(this).just_joined = false;
439
440 if (recount_ready)
441 ReadyCount(); // must be called after SetPlayerTeam() and TRANSMUTE(Observer
442}
443
445{
446 get_model_parameters(this.model, this.skin);
449 if (s < 0) return SPECIES_HUMAN;
450 return s;
451}
452
455{
456 string defaultmodel = "";
457 int defaultskin = 0;
459 {
460 if(teamplay)
461 {
462 switch(player.team)
463 {
468 }
469 }
470
471 if(defaultmodel == "")
472 {
473 defaultmodel = autocvar_sv_defaultplayermodel;
474 defaultskin = autocvar_sv_defaultplayerskin;
475 }
476
477 int n = tokenize_console(defaultmodel);
478 if(n > 0)
479 {
480 defaultmodel = argv(floor(n * CS(player).model_randomizer));
481 // However, do NOT randomize if the player-selected model is in the list.
482 for (int i = 0; i < n; ++i)
483 if ((argv(i) == player.playermodel && defaultskin == stof(player.playerskin)) || argv(i) == strcat(player.playermodel, ":", player.playerskin))
484 defaultmodel = argv(i);
485 }
486
487 int i = strstrofs(defaultmodel, ":", 0);
488 if(i >= 0)
489 {
490 defaultskin = stof(substring(defaultmodel, i+1, -1));
491 defaultmodel = substring(defaultmodel, 0, i);
492 }
493 }
494 if(autocvar_sv_defaultcharacterskin && !defaultskin)
495 {
496 if(teamplay)
497 {
498 switch(player.team)
499 {
500 case NUM_TEAM_1: defaultskin = autocvar_sv_defaultplayerskin_red; break;
501 case NUM_TEAM_2: defaultskin = autocvar_sv_defaultplayerskin_blue; break;
502 case NUM_TEAM_3: defaultskin = autocvar_sv_defaultplayerskin_yellow; break;
503 case NUM_TEAM_4: defaultskin = autocvar_sv_defaultplayerskin_pink; break;
504 }
505 }
506
507 if(!defaultskin)
508 defaultskin = autocvar_sv_defaultplayerskin;
509 }
510
511 MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin, player);
512 defaultmodel = M_ARGV(0, string);
513 defaultskin = M_ARGV(1, int);
514
515 bool chmdl = false;
516 int oldskin;
517 if(defaultmodel != "")
518 {
519 if (defaultmodel != player.model)
520 {
521 vector m1 = player.mins;
522 vector m2 = player.maxs;
523 setplayermodel (player, defaultmodel);
524 setsize (player, m1, m2);
525 chmdl = true;
526 }
527
528 oldskin = player.skin;
529 player.skin = defaultskin;
530 }
531 else
532 {
533 if (player.playermodel != player.model || player.playermodel == "")
534 {
535 player.playermodel = CheckPlayerModel(player.playermodel); // this is never "", so no endless loop
536 vector m1 = player.mins;
537 vector m2 = player.maxs;
538 setplayermodel (player, player.playermodel);
539 setsize (player, m1, m2);
540 chmdl = true;
541 }
542
544 {
545 oldskin = player.skin;
546 player.skin = stof(player.playerskin);
547 }
548 else
549 {
550 oldskin = player.skin;
551 player.skin = defaultskin;
552 }
553 }
554
555 if(chmdl || oldskin != player.skin) // model or skin has changed
556 {
557 player.species = player_getspecies(player); // update species
559 UpdatePlayerSounds(player); // update skin sounds
560 }
561
562 if(!teamplay)
564 if(player.clientcolors != stof(autocvar_sv_defaultplayercolors))
566}
567
569{
570 SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
571 SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
572 SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
573 SetResource(this, RES_CELLS, warmup_start_ammo_cells);
574 SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
575 SetResource(this, RES_HEALTH, warmup_start_health);
577 STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
578}
579
581{
582 if (MUTATOR_CALLHOOK(ForbidSpawn, this))
583 return;
584
585 if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
586
587 PlayerState_attach(this);
588 accuracy_resend(this);
589
590 if (teamplay)
591 {
592 if (this.bot_forced_team)
594 else if (this.team <= 0)
595 {
596 if (this.wants_join > 0)
598 else
600 }
601 }
602
603 entity spot = SelectSpawnPoint(this, false);
604 if (!spot)
605 {
606 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_NOSPAWNS);
607 return; // spawn failed
608 }
609
610 TRANSMUTE(Player, this);
611
612 this.iscreature = true;
614 if(!this.damagedbycontents)
616 this.damagedbycontents = true;
618 this.solid = SOLID_SLIDEBOX;
624 this.frags = FRAGS_PLAYER;
628 this.flags |= FL_NOTARGET;
629 this.takedamage = DAMAGE_AIM;
631
632 if (warmup_stage)
634 else
635 {
636 SetResource(this, RES_SHELLS, start_ammo_shells);
637 SetResource(this, RES_BULLETS, start_ammo_nails);
638 SetResource(this, RES_ROCKETS, start_ammo_rockets);
639 SetResource(this, RES_CELLS, start_ammo_cells);
640 SetResource(this, RES_FUEL, start_ammo_fuel);
641 SetResource(this, RES_HEALTH, start_health);
643 STAT(WEAPONS, this) = start_weapons;
644 if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
645 {
648 }
649 }
650 SetSpectatee_status(this, 0);
651
652 PS(this).dual_weapons = '0 0 0';
653
654 if(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS)
655 StatusEffects_apply(STATUSEFFECT_Superweapon, this, time + autocvar_g_balance_superweapons_time, 0);
656
657 this.items = start_items;
658
659 float shieldtime = time + autocvar_g_spawnshieldtime;
660
666 {
667 float f = game_starttime - time;
668 shieldtime += f;
669 this.pauserotarmor_finished += f;
670 this.pauserothealth_finished += f;
671 this.pauseregen_finished += f;
672 }
673
674 StatusEffects_apply(STATUSEFFECT_SpawnShield, this, shieldtime, 0);
675
677 this.death_time = 0;
678 this.respawn_flags = 0;
679 this.respawn_time = 0;
680 STAT(RESPAWN_TIME, this) = 0;
682 ? 0.8125 // DP model scaling uses 1/16 accuracy and 13/16 is closest to 56/69
684 this.fade_time = 0;
685 this.pain_finished = 0;
686 this.pushltime = 0;
687 setthink(this, func_null); // players have no think function
688 this.nextthink = 0;
689 this.dmg_team = 0;
690 this.spawn_time = time;
691
692 PS(this).ballistics_density = autocvar_g_ballistics_density_player;
693
694 this.deadflag = DEAD_NO;
695
696 this.angles = spot.angles;
697 this.angles_z = 0; // never spawn tilted even if the spot says to
698 if (IS_BOT_CLIENT(this))
699 {
700 this.v_angle = this.angles;
701 bot_aim_reset(this);
702 }
703 this.fixangle = true; // turn this way immediately
704 this.oldvelocity = this.velocity = '0 0 0';
705 this.avelocity = '0 0 0';
706 this.punchangle = '0 0 0';
707 this.punchvector = '0 0 0';
708
709 STAT(AIR_FINISHED, this) = 0;
712
713 entity spawnevent = new_pure(spawnevent);
714 spawnevent.owner = this;
715 Net_LinkEntity(spawnevent, false, 0.5, SpawnEvent_Send);
716
717 // Cut off any still running player sounds.
719
720 this.model = "";
721 FixPlayermodel(this);
722 this.drawonlytoclient = NULL;
723
724 this.viewloc = NULL;
725
726 for(int slot = 0; slot < MAX_AXH; ++slot)
727 {
728 entity axh = this.(AuxiliaryXhair[slot]);
729 this.(AuxiliaryXhair[slot]) = NULL;
730
731 if(axh.owner == this && axh != NULL && !wasfreed(axh))
732 delete(axh);
733 }
734
735 this.spawnpoint_targ = NULL;
736
737 UNSET_DUCKED(this);
738 this.view_ofs = STAT(PL_VIEW_OFS, this);
739 setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
740 this.spawnorigin = spot.origin;
741 setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24));
742 // don't reset back to last position, even if new position is stuck in solid
743 this.oldorigin = this.origin;
744 if(this.conveyor)
745 IL_REMOVE(g_conveyed, this);
746 this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
747 if(this.swampslug)
748 IL_REMOVE(g_swamped, this);
749 this.swampslug = NULL;
750 this.swamp_interval = 0;
751 if(this.ladder_entity)
752 IL_REMOVE(g_ladderents, this);
753 this.ladder_entity = NULL;
754 IL_EACH(g_counters, it.realowner == this,
755 {
756 delete(it);
757 });
758 STAT(HUD, this) = HUD_NORMAL;
759
760 this.event_damage = PlayerDamage;
761 this.event_heal = PlayerHeal;
762
763 this.draggable = func_null;
764
765 if(!this.bot_attack)
766 IL_PUSH(g_bot_targets, this);
767 this.bot_attack = true;
768 if(!this.monster_attack)
770 this.monster_attack = true;
771 navigation_dynamicgoal_init(this, false);
772
774
775 // player was spectator
776 if (CS(this).killcount == FRAGS_SPECTATOR)
777 {
778 PlayerScore_Clear(this);
779 CS(this).killcount = 0;
780 CS(this).startplaytime = time;
781 }
782
783 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
784 {
785 .entity weaponentity = weaponentities[slot];
786 CL_SpawnWeaponentity(this, weaponentity);
787 }
789 this.colormod = '1 1 1' * autocvar_g_player_brightness;
791
792 this.speedrunning = false;
793
794 this.counter_cnt = 0;
795 this.fragsfilter_cnt = 0;
796
798
799 // reset fields the weapons may use
800 FOREACH(Weapons, true,
801 {
802 it.wr_resetplayer(it, this);
803 // reload all reloadable weapons
804 if (it.spawnflags & WEP_FLAG_RELOADABLE)
805 {
806 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
807 {
808 .entity weaponentity = weaponentities[slot];
809 this.(weaponentity).weapon_load[it.m_id] = it.reloading_ammo;
810 }
811 }
812 });
813
814 MUTATOR_CALLHOOK(PlayerSpawn, this, spot);
815 {
816 string s = spot.target;
817 if(g_assault || g_race) // TODO: make targeting work in assault & race without this hack
818 spot.target = string_null;
819 SUB_UseTargets(spot, this, NULL);
820 if(g_assault || g_race)
821 spot.target = s;
822 }
823
825 {
826 sprint(this, strcat("spawnpoint origin: ", vtos(spot.origin), "\n"));
827 delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
828 }
829
830 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
831 {
832 .entity weaponentity = weaponentities[slot];
833 entity w_ent = this.(weaponentity);
834 if(slot == 0 || autocvar_g_weaponswitch_debug == 1)
835 w_ent.m_switchweapon = w_getbestweapon(this, weaponentity);
836 else
837 w_ent.m_switchweapon = WEP_Null;
838 w_ent.m_weapon = WEP_Null;
839 w_ent.weaponname = "";
840 w_ent.m_switchingweapon = WEP_Null;
841 w_ent.cnt = -1;
842 }
843
844 MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
845
846 if (CS(this).impulse) ImpulseCommands(this);
847
848 W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
849 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
850 {
851 .entity weaponentity = weaponentities[slot];
852 W_WeaponFrame(this, weaponentity);
853 }
854
855 if (!warmup_stage && !this.alivetime_start)
857
858 antilag_clear(this, CS(this));
859
860 if (warmup_stage)
861 ReadyCount();
862}
863
866{
867 if (IS_REAL_CLIENT(this))
868 {
869 msg_entity = this;
871 WriteEntity(MSG_ONE, this);
872 }
873 if (game_stopped)
874 TRANSMUTE(Observer, this);
875
876 bool use_spawnpoint = (!this.enemy); // check this.enemy here since SetSpectatee will clear it
877 SetSpectatee(this, NULL);
878
879 // reset player keys
880 if(PS(this))
881 PS(this).itemkeys = 0;
882
884
885 if (IS_OBSERVER(this))
886 PutObserverInServer(this, false, use_spawnpoint);
887 else if (IS_PLAYER(this))
888 PutPlayerInServer(this);
889
891}
892
893// TODO do we need all these fields, or should we stop autodetecting runtime
894// changes and just have a console command to update this?
895bool ClientInit_SendEntity(entity this, entity to, int sf)
896{
897 WriteHeader(MSG_ENTITY, _ENT_CLIENT_INIT);
898 return = true;
899 msg_entity = to;
900 // MSG_INIT replacement
901 // TODO: make easier to use
904 ClientInit_misc(this);
905 MUTATOR_CALLHOOK(Ent_Init);
906}
908{
909 int channel = MSG_ONE;
910 WriteHeader(channel, ENT_CLIENT_INIT);
911 WriteByte(channel, g_nexball_meter_period * 32);
912 WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[0]));
913 WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[1]));
914 WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[2]));
915 WriteInt24_t(channel, compressShotOrigin(hook_shotorigin[3]));
916 WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[0]));
917 WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[1]));
918 WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[2]));
919 WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[3]));
920
921 if(autocvar_sv_foginterval && world.fog != "")
922 WriteString(channel, world.fog);
923 else
924 WriteString(channel, "");
925 WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
926 WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor
927 WriteByte(channel, serverflags);
929}
930
932{
933 this.nextthink = time;
935 {
937 this.SendFlags |= 1;
938 }
940 {
942 this.SendFlags |= 1;
943 }
944}
945
947{
948 entity e = new_pure(clientinit);
951
953}
954
955/*
956=============
957SetNewParms
958=============
959*/
961{
962 // initialize parms for a new player
963 parm1 = -(86400 * 366);
964
966}
967
968/*
969=============
970SetChangeParms
971=============
972*/
974{
975 // save parms for level change
976 parm1 = CS(this).parm_idlesince - time;
977
979}
980
981/*
982=============
983DecodeLevelParms
984=============
985*/
987{
988 // load parms
989 CS(this).parm_idlesince = parm1;
990 if (CS(this).parm_idlesince == -(86400 * 366))
991 CS(this).parm_idlesince = time;
992
993 // whatever happens, allow 60 seconds of idling directly after connect for map loading
994 CS(this).parm_idlesince = max(CS(this).parm_idlesince, time - autocvar_sv_maxidle + 60);
995
997}
998
1000{
1001 // send prediction settings to the client
1002 if(autocvar_g_antilag == 3) // client side hitscan
1003 stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n");
1004 if(autocvar_sv_gentle)
1005 stuffcmd(e, "cl_cmd settemp cl_gentle 1\n");
1006
1007 stuffcmd(e, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min));
1008 stuffcmd(e, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max));
1009
1010 stuffcmd(e, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
1011
1013}
1014
1015bool findinlist_abbrev(string tofind, string list)
1016{
1017 if(list == "" || tofind == "")
1018 return false; // empty list or search, just return
1019
1020 // this function allows abbreviated strings!
1021 FOREACH_WORD(list, it != "" && it == substring(tofind, 0, strlen(it)),
1022 {
1023 return true;
1024 });
1025
1026 return false;
1027}
1028
1029bool PlayerInIPList(entity p, string iplist)
1030{
1031 // some safety checks (never allow local?)
1032 if(p.netaddress == "local" || p.netaddress == "" || !IS_REAL_CLIENT(p))
1033 return false;
1034
1035 return findinlist_abbrev(p.netaddress, iplist);
1036}
1037
1038bool PlayerInIDList(entity p, string idlist)
1039{
1040 // NOTE: we do NOT check crypto_idfp_signed here, an unsigned ID is fine too for this
1041 if(!p.crypto_idfp)
1042 return false;
1043
1044 return findinlist_abbrev(p.crypto_idfp, idlist);
1045}
1046
1047bool PlayerInList(entity player, string list)
1048{
1049 if (list == "")
1050 return false;
1051 return boolean(PlayerInIDList(player, list) || PlayerInIPList(player, list));
1052}
1053
1054#ifdef DP_EXT_PRECONNECT
1055/*
1056=============
1057ClientPreConnect
1058
1059Called once (not at each match start) when a client begins a connection to the server
1060=============
1061*/
1062void ClientPreConnect(entity this)
1063{
1065 {
1066 GameLogEcho(sprintf(":connect:%d:%d:%s",
1067 this.playerid,
1068 etof(this),
1069 IS_REAL_CLIENT(this) ? this.netaddress : "bot"));
1070 }
1071}
1072#endif
1073
1074// NOTE csqc uses the active mutators list sent by this function
1075// to understand which mutators are enabled
1076// also note that they aren't all registered mutators, e.g. jetpack, low gravity
1077void SendWelcomeMessage(entity this, int msg_type)
1078{
1079 if (boolean(autocvar_g_campaign))
1080 {
1081 WriteByte(msg_type, 1);
1082 WriteByte(msg_type, Campaign_GetLevelNum());
1083 return;
1084 }
1085
1086 int flags = 0;
1087 if (CS(this).version_mismatch)
1088 flags |= 2;
1089 if (CS(this).version < autocvar_gameversion)
1090 flags |= 4;
1092 if (MapInfo_Map_author != "")
1093 flags |= 8;
1094 WriteByte(msg_type, flags);
1095
1096 WriteString(msg_type, autocvar_hostname);
1098
1100 if (flags & 8)
1103
1105 WriteByte(msg_type, GetPlayerLimit());
1106
1107 MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
1108 string modifications = M_ARGV(0, string);
1109
1110 if (!g_weaponarena && cvar("g_balance_blaster_weaponstartoverride") == 0)
1111 modifications = strcat(modifications, ", No start weapons");
1112 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
1113 modifications = strcat(modifications, ", Low gravity");
1114 if(g_weapon_stay && !g_cts)
1115 modifications = strcat(modifications, ", Weapons stay");
1117 modifications = strcat(modifications, ", Jetpack");
1118 modifications = substring(modifications, 2, strlen(modifications) - 2);
1119
1120 WriteString(msg_type, modifications);
1121
1123
1125 {
1128 }
1129
1130 WriteString(msg_type, cache_mutatormsg);
1131
1132 WriteString(msg_type, strreplace("\\n", "\n", autocvar_sv_motd));
1133}
1134
1144{
1145 if (Ban_MaybeEnforceBanOnce(this)) return;
1146 assert(!IS_CLIENT(this), return);
1147 this.flags |= FL_CLIENT;
1148 assert(player_count >= 0, player_count = 0);
1149
1150 TRANSMUTE(Client, this);
1151 CS(this).version_nagtime = time + 10 + random() * 10;
1152
1153 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_CONNECT, this.netname);
1154
1155 bot_clientconnect(this);
1156
1157 this.team = -1;
1159
1160 TRANSMUTE(Observer, this);
1161
1162 PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
1163
1164 // always track bots, don't ask for cl_allow_uidtracking
1165 if (IS_BOT_CLIENT(this))
1167 else
1168 CS(this).allowed_timeouts = autocvar_sv_timeout_number;
1169
1171 GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? GameLog_ProcessIP(this.netaddress) : "bot"), ":", playername(this.netname, this.team, false)));
1172
1173 CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects
1174 this.wants_join = 0;
1175
1176 stuffcmd(this, clientstuff, "\n");
1177 stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
1178
1179 FixClientCvars(this);
1180
1181 // get version info from player
1182 stuffcmd(this, "cmd clientversion $gameversion\n");
1183
1184 // notify about available teams
1185 if (teamplay)
1186 {
1187 entity balance = TeamBalance_CheckAllowedTeams(this);
1188 int t = TeamBalance_GetAllowedTeams(balance);
1189 TeamBalance_Destroy(balance);
1190 stuffcmd(this, sprintf("set _teams_available %d\n", t));
1191 }
1192 else
1193 {
1194 stuffcmd(this, "set _teams_available 0\n");
1195 }
1196
1198
1199 CS(this).spectatortime = time;
1200 CS(this).jointime = time;
1201
1202 if (IS_REAL_CLIENT(this))
1203 {
1205
1206 if (g_weaponarena_weapons == WEPSET(TUBA))
1207 stuffcmd(this, "cl_cmd settemp chase_active 1\n");
1208 // quickmenu file must be put in a subfolder with an unique name
1209 // to reduce chances of overriding custom client quickmenus
1211 stuffcmd(this, sprintf("cl_cmd settemp _hud_panel_quickmenu_file_from_server %s\n", "wpeditor.txt"));
1213 stuffcmd(this, sprintf("cl_cmd settemp _hud_panel_quickmenu_file_from_server %s\n", autocvar_sv_quickmenu_file));
1214 }
1215
1216 if (!autocvar_sv_foginterval && world.fog != "")
1217 stuffcmd(this, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
1218
1219 CSQCMODEL_AUTOINIT(this);
1220
1221 CS(this).model_randomizer = random();
1222
1223 if (IS_REAL_CLIENT(this))
1224 sv_notice_join(this);
1225
1226 this.move_qcphysics = true;
1227
1228 // update physics stats (players can spawn before physics runs)
1229 Physics_UpdateStats(this);
1230
1231 IL_EACH(g_initforplayer, it.init_for_player,
1232 {
1233 it.init_for_player(it, this);
1234 });
1235
1236 Handicap_Initialize(this);
1237
1238 // playban
1240 TRANSMUTE(Observer, this);
1241
1242 if (PlayerInList(this, autocvar_g_chatban_list)) // chatban
1243 CS(this).muted = true;
1244
1246
1247 if (player_count == 1)
1248 {
1250 setpause(0);
1251 localcmd("\nsv_hook_firstjoin\n");
1252 }
1253
1254 if (get_nextmap() != "")
1256
1257 // cvar hook/callback TODO: recheck this when the cvar is changed
1260 this.vote_master = true;
1261}
1262
1265void player_powerups_remove_all(entity this, bool allow_poweroff_sound);
1266
1267/*
1268=============
1269ClientDisconnect
1270
1271Called when a client disconnects from the server
1272=============
1273*/
1275{
1276 assert(IS_CLIENT(this), return);
1277
1278 strfree(this.ignore_list);
1280 {
1281 // don't remove permanent ignores from db, only from list
1282 ignore_remove_player(it, this, false);
1283 });
1284
1286 if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
1287 if (CS(this).active_minigame) part_minigame(this);
1288 if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN, this.origin, '0 0 0', 1);
1289
1291 GameLogEcho(strcat(":part:", ftos(this.playerid)));
1292
1293 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_DISCONNECT, this.netname);
1294
1295 if(IS_SPEC(this))
1296 SetSpectatee(this, NULL);
1297
1299
1300 strfree(CS(this).netname_previous); // needs to be before the CS entity is removed!
1302 ClientState_detach(this);
1303
1304 Portal_ClearAll(this);
1305
1307
1309
1310 // Here, everything has been done that requires this player to be a client.
1311
1312 this.flags &= ~FL_CLIENT;
1313
1314 if (this.chatbubbleentity) delete(this.chatbubbleentity);
1315 if (this.killindicator) delete(this.killindicator);
1316
1317 IL_EACH(g_counters, it.realowner == this,
1318 {
1319 delete(it);
1320 });
1321
1323
1325
1326 strfree(this.clientstatus);
1327 if (this.personal) delete(this.personal);
1328
1329 this.playerid = 0;
1330 if (warmup_stage || game_starttime > time) /* warmup OR countdown */ ReadyCount();
1331 if (vote_called && IS_REAL_CLIENT(this)) VoteCount(false);
1332
1333 player_powerups_remove_all(this, IS_PLAYER(this)); // stop powerup sound
1334
1335 ONREMOVE(this);
1336
1337 if (player_count == 0)
1338 localcmd("\nsv_hook_lastleave\n");
1339
1344}
1345
1347{
1348 this.nextthink = time;
1349 if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
1350 {
1351 if(this.owner) // but why can that ever be NULL?
1352 this.owner.chatbubbleentity = NULL;
1353 delete(this);
1354 return;
1355 }
1356
1357 this.mdl = "";
1358
1359 if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) && !MUTATOR_CALLHOOK(ShowChatBubble, this.owner, this) )
1360 {
1362 this.mdl = "models/sprites/minigame_busy.iqm";
1363 else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
1364 this.mdl = "models/misc/chatbubble.spr";
1365 }
1366
1367 if ( this.model != this.mdl )
1368 _setmodel(this, this.mdl);
1369
1370}
1371
1373{
1374 if (this.alpha < 0)
1375 return;
1376 // spawn a chatbubble entity if needed
1377 if (!this.chatbubbleentity)
1378 {
1380 this.chatbubbleentity.owner = this;
1381 this.chatbubbleentity.exteriormodeltoclient = this;
1383 this.chatbubbleentity.nextthink = time;
1384 setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
1385 //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
1386 setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
1387 setattachment(this.chatbubbleentity, this, ""); // sticks to moving player better, also conserves bandwidth
1388 this.chatbubbleentity.mdl = this.chatbubbleentity.model;
1389 //this.chatbubbleentity.model = "";
1390 this.chatbubbleentity.effects = EF_LOWPRECISION;
1391 }
1392}
1393
1395{
1396 if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
1397 return;
1398
1399 float gametype_setting_tmp;
1400 float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
1401 float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
1402 float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
1403 float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
1404 float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
1405 float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
1406
1407 float pcount = 1; // Include myself whether or not team is already set right and I'm a "player".
1408 if (teamplay)
1409 {
1410 FOREACH_CLIENT(IS_PLAYER(it) && it != this,
1411 {
1412 if(it.team == this.team)
1413 ++pcount;
1414 });
1415 if (sdelay_small_count == 0)
1416 sdelay_small_count = 1;
1417 if (sdelay_large_count == 0)
1418 sdelay_large_count = 1;
1419 }
1420 else
1421 {
1422 FOREACH_CLIENT(IS_PLAYER(it) && it != this,
1423 {
1424 ++pcount;
1425 });
1426 if (sdelay_small_count == 0)
1427 {
1428 if (IS_INDEPENDENT_PLAYER(this))
1429 {
1430 // Players play independently. No point in requiring enemies.
1431 sdelay_small_count = 1;
1432 }
1433 else
1434 {
1435 // Players play AGAINST each other. Enemies required.
1436 sdelay_small_count = 2;
1437 }
1438 }
1439 if (sdelay_large_count == 0)
1440 {
1441 if (IS_INDEPENDENT_PLAYER(this))
1442 {
1443 // Players play independently. No point in requiring enemies.
1444 sdelay_large_count = 1;
1445 }
1446 else
1447 {
1448 // Players play AGAINST each other. Enemies required.
1449 sdelay_large_count = 2;
1450 }
1451 }
1452 }
1453
1454 float sdelay;
1455
1456 if (pcount <= sdelay_small_count)
1457 sdelay = sdelay_small;
1458 else if (pcount >= sdelay_large_count)
1459 sdelay = sdelay_large;
1460 else // NOTE: this case implies sdelay_large_count > sdelay_small_count.
1461 sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
1462
1463 if(waves)
1464 this.respawn_time = ceil((time + sdelay) / waves) * waves;
1465 else
1466 this.respawn_time = time + sdelay;
1467
1468 if(sdelay < sdelay_max)
1469 this.respawn_time_max = time + sdelay_max;
1470 else
1471 this.respawn_time_max = this.respawn_time;
1472
1473 if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75))
1474 this.respawn_countdown = 10; // first number to count down from is 10
1475 else
1476 this.respawn_countdown = -1; // do not count down
1477
1480}
1481
1482// LordHavoc: this hack will be removed when proper _pants/_shirt layers are
1483// added to the model skins
1484/*void UpdateColorModHack()
1485{
1486 float c;
1487 c = this.clientcolors & 15;
1488 // LordHavoc: only bothering to support white, green, red, yellow, blue
1489 if (!teamplay) this.colormod = '0 0 0';
1490 else if (c == 0) this.colormod = '1.00 1.00 1.00';
1491 else if (c == 3) this.colormod = '0.10 1.73 0.10';
1492 else if (c == 4) this.colormod = '1.73 0.10 0.10';
1493 else if (c == 12) this.colormod = '1.22 1.22 0.10';
1494 else if (c == 13) this.colormod = '0.10 0.10 1.73';
1495 else this.colormod = '1 1 1';
1496}*/
1497
1498void respawn(entity this)
1499{
1500 bool damagedbycontents_prev = this.damagedbycontents;
1501 if(this.alpha >= 0)
1502 {
1504 {
1505 this.solid = SOLID_NOT;
1506 this.takedamage = DAMAGE_NO;
1507 this.damagedbycontents = false;
1513 Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
1516 }
1517 else
1518 SUB_SetFade (this, time, 1); // fade out the corpse immediately
1519 }
1520
1521 CopyBody(this, 1);
1522 this.damagedbycontents = damagedbycontents_prev;
1523
1524 this.effects |= EF_NODRAW; // prevent another CopyBody
1525 PutClientInServer(this);
1526}
1527
1528void play_countdown(entity this, float finished, Sound samp)
1529{
1530 TC(Sound, samp);
1531 float time_left = finished - time;
1532 if(IS_REAL_CLIENT(this) && time_left < 6 && floor(time_left - frametime) != floor(time_left))
1533 sound(this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
1534}
1535
1536// it removes special powerups not handled by StatusEffects
1537void player_powerups_remove_all(entity this, bool allow_poweroff_sound)
1538{
1540 {
1541 // don't play the poweroff sound when the game restarts or the player disconnects
1542 if (allow_poweroff_sound && time > game_starttime + 1 && IS_CLIENT(this)
1544 sound(this, CH_INFO, SND_POWEROFF, VOL_BASE, ATTEN_NORM);
1545
1547 stopsound(this, CH_TRIGGER_SINGLE); // get rid of the pickup sound
1548
1550 }
1551}
1552
1554{
1555 if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !game_stopped)
1556 this.modelflags |= MF_ROCKET;
1557 else
1558 this.modelflags &= ~MF_ROCKET;
1559
1560 this.effects &= ~EF_NODEPTHTEST;
1561
1562 if (IS_DEAD(this))
1563 player_powerups_remove_all(this, true);
1564
1565 if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
1566 return;
1567
1568 // add a way to see what the items were BEFORE all of these checks for the mutator hook
1569 int items_prev = this.items;
1570
1571 if (!MUTATOR_IS_ENABLED(mutator_instagib))
1572 {
1573 // NOTE: superweapons are a special case and as such are handled here instead of the status effects system
1574 if (this.items & IT_SUPERWEAPON)
1575 {
1576 if (!(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS))
1577 {
1578 StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_NORMAL);
1579 this.items &= ~IT_SUPERWEAPON;
1580 //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
1581 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
1582 }
1583 else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
1584 {
1585 // don't let them run out
1586 }
1587 else
1588 {
1589 play_countdown(this, StatusEffects_gettime(STATUSEFFECT_Superweapon, this), SND_POWEROFF);
1590 if (time >= StatusEffects_gettime(STATUSEFFECT_Superweapon, this))
1591 {
1592 this.items &= ~IT_SUPERWEAPON;
1593 STAT(WEAPONS, this) &= ~WEPSET_SUPERWEAPONS;
1594 //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
1595 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
1596 }
1597 }
1598 }
1599 else if(STAT(WEAPONS, this) & WEPSET_SUPERWEAPONS)
1600 {
1601 if (time < StatusEffects_gettime(STATUSEFFECT_Superweapon, this) || (this.items & IT_UNLIMITED_SUPERWEAPONS))
1602 {
1603 this.items |= IT_SUPERWEAPON;
1604 if(!(this.items & IT_UNLIMITED_SUPERWEAPONS))
1605 {
1606 if(!g_cts)
1607 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
1608 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
1609 }
1610 }
1611 else
1612 {
1613 if(StatusEffects_active(STATUSEFFECT_Superweapon, this))
1614 StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_TIMEOUT);
1615 STAT(WEAPONS, this) &= ~WEPSET_SUPERWEAPONS;
1616 }
1617 }
1618 else if(StatusEffects_active(STATUSEFFECT_Superweapon, this)) // cheaper to check than to update each frame!
1619 {
1620 StatusEffects_remove(STATUSEFFECT_Superweapon, this, STATUSEFFECT_REMOVE_CLEAR);
1621 }
1622 }
1623
1625 this.effects |= EF_NODEPTHTEST;
1626
1628 this.effects |= EF_FULLBRIGHT;
1629
1630 MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
1631}
1632
1633float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
1634{
1635 if(current > stable)
1636 return current;
1637 else if(current > stable - 0.25) // when close enough, "snap"
1638 return stable;
1639 else
1640 return min(stable, current + (stable - current) * regenfactor * regenframetime);
1641}
1642
1643float CalcRot(float current, float stable, float rotfactor, float rotframetime)
1644{
1645 if(current < stable)
1646 return current;
1647 else if(current < stable + 0.25) // when close enough, "snap"
1648 return stable;
1649 else
1650 return max(stable, current + (stable - current) * rotfactor * rotframetime);
1651}
1652
1653void RotRegen(entity this, Resource res, float limit_mod,
1654 float regenstable, float regenfactor, float regenlinear, float regenframetime,
1655 float rotstable, float rotfactor, float rotlinear, float rotframetime)
1656{
1657 float old = GetResource(this, res);
1658 float current = old;
1659 if(current > rotstable)
1660 {
1661 if(rotframetime > 0)
1662 {
1663 current = CalcRot(current, rotstable, rotfactor, rotframetime);
1664 current = max(rotstable, current - rotlinear * rotframetime);
1665 }
1666 }
1667 else if(current < regenstable)
1668 {
1669 if(regenframetime > 0)
1670 {
1671 current = CalcRegen(current, regenstable, regenfactor, regenframetime);
1672 current = min(regenstable, current + regenlinear * regenframetime);
1673 }
1674 }
1675
1676 float limit = GetResourceLimit(this, res) * limit_mod;
1677 if(current > limit)
1678 current = limit;
1679
1680 if (current != old)
1681 SetResource(this, res, current);
1682}
1683
1685{
1686 float max_mod, regen_mod, rot_mod, limit_mod;
1687 max_mod = regen_mod = rot_mod = limit_mod = 1;
1688
1689 float regen_health = autocvar_g_balance_health_regen;
1690 float regen_health_linear = autocvar_g_balance_health_regenlinear;
1691 float regen_health_rot = autocvar_g_balance_health_rot;
1692 float regen_health_rotlinear = autocvar_g_balance_health_rotlinear;
1693 float regen_health_stable = autocvar_g_balance_health_regenstable;
1694 float regen_health_rotstable = autocvar_g_balance_health_rotstable;
1695 bool mutator_returnvalue = MUTATOR_CALLHOOK(PlayerRegen, this, max_mod, regen_mod, rot_mod, limit_mod, regen_health, regen_health_linear, regen_health_rot,
1696 regen_health_rotlinear, regen_health_stable, regen_health_rotstable);
1697 max_mod = M_ARGV(1, float);
1698 regen_mod = M_ARGV(2, float);
1699 rot_mod = M_ARGV(3, float);
1700 limit_mod = M_ARGV(4, float);
1701 regen_health = M_ARGV(5, float);
1702 regen_health_linear = M_ARGV(6, float);
1703 regen_health_rot = M_ARGV(7, float);
1704 regen_health_rotlinear = M_ARGV(8, float);
1705 regen_health_stable = M_ARGV(9, float);
1706 regen_health_rotstable = M_ARGV(10, float);
1707
1708 float rotstable, regenstable, rotframetime, regenframetime;
1709
1710 if(!mutator_returnvalue)
1711 {
1714 regenframetime = (time > this.pauseregen_finished) ? (regen_mod * frametime) : 0;
1715 rotframetime = (time > this.pauserotarmor_finished) ? (rot_mod * frametime) : 0;
1716 RotRegen(this, RES_ARMOR, limit_mod,
1719
1720 // NOTE: max_mod is only applied to health
1721 regenstable = regen_health_stable * max_mod;
1722 rotstable = regen_health_rotstable * max_mod;
1723 regenframetime = (time > this.pauseregen_finished) ? (regen_mod * frametime) : 0;
1724 rotframetime = (time > this.pauserothealth_finished) ? (rot_mod * frametime) : 0;
1725 RotRegen(this, RES_HEALTH, limit_mod,
1726 regenstable, regen_health, regen_health_linear, regenframetime,
1727 rotstable, regen_health_rot, regen_health_rotlinear, rotframetime);
1728 }
1729
1730 // if player rotted to death... die!
1731 // check this outside above checks, as player may still be able to rot to death
1732 if(GetResource(this, RES_HEALTH) < 1)
1733 {
1734 if(this.vehicle)
1736 if(this.event_damage)
1737 this.event_damage(this, this, this, 1, DEATH_ROT.m_id, DMG_NOWEP, this.origin, '0 0 0');
1738 }
1739
1740 if (!(this.items & IT_UNLIMITED_AMMO))
1741 {
1744 regenframetime = ((time > this.pauseregen_finished) && (this.items & ITEM_FuelRegen.m_itemid)) ? frametime : 0;
1745 rotframetime = (time > this.pauserotfuel_finished) ? frametime : 0;
1746 RotRegen(this, RES_FUEL, 1,
1749 }
1750}
1751
1753void SetZoomState(entity this, float newzoom)
1754{
1755 if(newzoom != CS(this).zoomstate)
1756 {
1757 CS(this).zoomstate = newzoom;
1758 ClientData_Touch(this, true);
1759 }
1760 zoomstate_set = true;
1761}
1762
1764{
1766 if (game_stopped)
1767 {
1768 CS(this).pressedkeys = 0;
1769 STAT(PRESSED_KEYS, this) = 0;
1770 return;
1771 }
1772
1773 // NOTE: GetPressedKeys and PM_dodging_GetPressedKeys use similar code
1774 int keys = STAT(PRESSED_KEYS, this);
1775 keys = BITSET(keys, KEY_FORWARD, CS(this).movement.x > 0);
1776 keys = BITSET(keys, KEY_BACKWARD, CS(this).movement.x < 0);
1777 keys = BITSET(keys, KEY_RIGHT, CS(this).movement.y > 0);
1778 keys = BITSET(keys, KEY_LEFT, CS(this).movement.y < 0);
1779
1780 keys = BITSET(keys, KEY_JUMP, PHYS_INPUT_BUTTON_JUMP(this));
1781 keys = BITSET(keys, KEY_CROUCH, IS_DUCKED(this)); // workaround: player can't un-crouch until their path is clear, so we keep the button held here
1782 keys = BITSET(keys, KEY_ATCK, PHYS_INPUT_BUTTON_ATCK(this));
1783 keys = BITSET(keys, KEY_ATCK2, PHYS_INPUT_BUTTON_ATCK2(this));
1784 CS(this).pressedkeys = keys; // store for other users
1785
1786 STAT(PRESSED_KEYS, this) = keys;
1787}
1788
1789/*
1790======================
1791spectate mode routines
1792======================
1793*/
1794
1795void SpectateCopy(entity this, entity spectatee)
1796{
1797 TC(Client, this); TC(Client, spectatee);
1798
1799 MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
1800 PS(this) = PS(spectatee);
1801 this.armortype = spectatee.armortype;
1803 SetResourceExplicit(this, RES_CELLS, GetResource(spectatee, RES_CELLS));
1804 SetResourceExplicit(this, RES_SHELLS, GetResource(spectatee, RES_SHELLS));
1805 SetResourceExplicit(this, RES_BULLETS, GetResource(spectatee, RES_BULLETS));
1806 SetResourceExplicit(this, RES_ROCKETS, GetResource(spectatee, RES_ROCKETS));
1807 SetResourceExplicit(this, RES_FUEL, GetResource(spectatee, RES_FUEL));
1808 this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
1809 SetResourceExplicit(this, RES_HEALTH, GetResource(spectatee, RES_HEALTH));
1810 CS(this).impulse = 0;
1811 this.disableclientprediction = 1; // no need to run prediction on a spectator
1812 this.items = spectatee.items;
1813 STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
1814 STAT(HIT_TIME, this) = STAT(HIT_TIME, spectatee);
1815 STAT(AIR_FINISHED, this) = STAT(AIR_FINISHED, spectatee);
1816 STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
1817 STAT(WEAPONS, this) = STAT(WEAPONS, spectatee);
1818 this.punchangle = spectatee.punchangle;
1819 this.view_ofs = spectatee.view_ofs;
1820 this.velocity = spectatee.velocity;
1821 this.dmg_take = spectatee.dmg_take;
1822 this.dmg_save = spectatee.dmg_save;
1823 this.dmg_inflictor = spectatee.dmg_inflictor;
1824 this.v_angle = spectatee.v_angle;
1825 this.angles = spectatee.v_angle;
1826 this.viewloc = spectatee.viewloc;
1827 if(!PHYS_INPUT_BUTTON_USE(this) && STAT(CAMERA_SPECTATOR, this) != 2)
1828 this.fixangle = true;
1829 setorigin(this, spectatee.origin);
1830 setsize(this, spectatee.mins, spectatee.maxs);
1831 SetZoomState(this, CS(spectatee).zoomstate);
1832
1833 anticheat_spectatecopy(this, spectatee);
1834 STAT(HUD, this) = STAT(HUD, spectatee);
1835 if(spectatee.vehicle)
1836 {
1837 this.angles = spectatee.v_angle;
1838
1839 //this.fixangle = false;
1840 //this.velocity = spectatee.vehicle.velocity;
1841 this.vehicle_health = spectatee.vehicle_health;
1842 this.vehicle_shield = spectatee.vehicle_shield;
1843 this.vehicle_energy = spectatee.vehicle_energy;
1844 this.vehicle_ammo1 = spectatee.vehicle_ammo1;
1845 this.vehicle_ammo2 = spectatee.vehicle_ammo2;
1846 this.vehicle_reload1 = spectatee.vehicle_reload1;
1847 this.vehicle_reload2 = spectatee.vehicle_reload2;
1848
1849 //msg_entity = this;
1850
1851 // WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
1852 //WriteAngle(MSG_ONE, spectatee.v_angle.x);
1853 // WriteAngle(MSG_ONE, spectatee.v_angle.y);
1854 // WriteAngle(MSG_ONE, spectatee.v_angle.z);
1855
1856 //WriteByte (MSG_ONE, SVC_SETVIEW);
1857 // WriteEntity(MSG_ONE, this);
1858 //makevectors(spectatee.v_angle);
1859 //setorigin(this, spectatee.origin - v_forward * 400 + v_up * 300);*/
1860 }
1861}
1862
1864{
1865 if(!this.enemy)
1866 return false;
1867
1868 if(!IS_PLAYER(this.enemy) || this == this.enemy)
1869 {
1870 SetSpectatee(this, NULL);
1871 return false;
1872 }
1873
1874 SpectateCopy(this, this.enemy);
1875 if (IS_OBSERVER(this))
1876 TRANSMUTE(Spectator, this);
1877
1878 return true;
1879}
1880
1882{
1883 if(!IS_PLAYER(this.enemy))
1884 return false;
1885
1886 ClientData_Touch(this.enemy, true);
1887
1888 msg_entity = this;
1890 WriteEntity(MSG_ONE, this.enemy);
1892 accuracy_resend(this);
1893
1894 if(!SpectateUpdate(this))
1895 PutObserverInServer(this, false, true);
1896
1897 return true;
1898}
1899
1900void SetSpectatee_status(entity this, int spectatee_num)
1901{
1902 int oldspectatee_status = CS(this).spectatee_status;
1903 CS(this).spectatee_status = spectatee_num;
1904
1905 if (CS(this).spectatee_status != oldspectatee_status)
1906 {
1907 if (STAT(PRESSED_KEYS, this))
1908 {
1909 CS(this).pressedkeys = 0;
1910 STAT(PRESSED_KEYS, this) = 0;
1911 }
1912
1913 ClientData_Touch(this, true);
1914
1915 // init or clear race data
1916 if ((g_race || g_cts) && g_race_qualifying && IS_REAL_CLIENT(this))
1917 {
1918 msg_entity = this;
1919
1920 if (this.enemy && this.enemy.race_laptime)
1921 {
1922 // init
1924 }
1925 else
1926 {
1927 // send reset to this spectator
1928 WriteHeader(MSG_ONE, TE_CSQC_RACE);
1930 }
1931 }
1932 }
1933}
1934
1935void SetSpectatee(entity this, entity spectatee)
1936{
1937 if(IS_BOT_CLIENT(this))
1938 return; // bots abuse .enemy, this code is useless to them
1939
1940 entity old_spectatee = this.enemy;
1941
1942 this.enemy = spectatee;
1943
1944 // WEAPONTODO
1945 // these are required to fix the spectator bug with arc
1946 if(old_spectatee)
1947 {
1948 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
1949 {
1950 .entity weaponentity = weaponentities[slot];
1951 if(old_spectatee.(weaponentity).arc_beam)
1952 old_spectatee.(weaponentity).arc_beam.SendFlags |= ARC_SF_UPDATE;
1953 }
1954 }
1955 if(spectatee)
1956 {
1957 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
1958 {
1959 .entity weaponentity = weaponentities[slot];
1960 if(spectatee.(weaponentity).arc_beam)
1961 spectatee.(weaponentity).arc_beam.SendFlags |= ARC_SF_UPDATE;
1962 }
1963 }
1964
1965 if (spectatee)
1966 SetSpectatee_status(this, etof(spectatee));
1967
1968 // needed to update spectator list
1969 if(old_spectatee)
1970 ClientData_Touch(old_spectatee, true);
1971}
1972
1973bool Spectate(entity this, entity pl)
1974{
1975 if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
1976 return false;
1977 pl = M_ARGV(1, entity);
1978
1979 SetSpectatee(this, pl);
1980 return SpectateSet(this);
1981}
1982
1984{
1985 entity ent = find(this.enemy, classname, STR_PLAYER);
1986
1987 if (MUTATOR_CALLHOOK(SpectateNext, this, ent))
1988 ent = M_ARGV(1, entity);
1989 else if (!ent)
1990 ent = find(ent, classname, STR_PLAYER);
1991
1992 if(ent) SetSpectatee(this, ent);
1993
1994 return SpectateSet(this);
1995}
1996
1998{
1999 // NOTE: chain order is from the highest to the lower entnum (unlike find)
2000 entity ent = findchain(classname, STR_PLAYER);
2001 if (!ent) // no player
2002 return false;
2003
2004 entity first = ent;
2005 // skip players until current spectated player
2006 if(this.enemy)
2007 while(ent && ent != this.enemy)
2008 ent = ent.chain;
2009
2010 switch (MUTATOR_CALLHOOK(SpectatePrev, this, ent, first))
2011 {
2012 case MUT_SPECPREV_FOUND:
2013 ent = M_ARGV(1, entity);
2014 break;
2016 return true;
2018 default:
2019 {
2020 if(ent.chain)
2021 ent = ent.chain;
2022 else
2023 ent = first;
2024 break;
2025 }
2026 }
2027
2028 SetSpectatee(this, ent);
2029 return SpectateSet(this);
2030}
2031
2032/*
2033=============
2034ShowRespawnCountdown()
2035
2036Update a respawn countdown display.
2037=============
2038*/
2040{
2041 float number;
2042 if(!IS_DEAD(this)) // just respawned?
2043 return;
2044 else
2045 {
2046 number = ceil(this.respawn_time - time);
2047 if(number <= 0)
2048 return;
2049 if(number <= this.respawn_countdown)
2050 {
2051 this.respawn_countdown = number - 1;
2052 if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
2053 Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number));
2054 }
2055 }
2056}
2057
2059{
2061 return false;
2062 if (QueuedPlayersReady(this, true))
2063 return false;
2064 if (frametime) // once per frame is more than enough
2065 stuffcmd(this, "_scoreboard_team_selection 1\n");
2066 return true;
2067}
2068
2070void Join(entity this, bool queued_join)
2071{
2072 entity player_with_dibs = NULL;
2073
2075 {
2077 ReadyRestart(true);
2079 }
2080
2081 if(queued_join
2082 && TeamBalance_AreEqual(this, true)) // if a player couldn't tag in for balance, don't join them here as it would cause a stack
2083 {
2084 // First we must join player(s) queued for specific team(s) (they chose first)
2085 // so TeamBalance_JoinBestTeam() (if necessary) won't select the same team(s).
2086 // Relies on `this` skipping the queue (this.team already set, this.wants_join not set) or using autoselect.
2087 FOREACH_CLIENT(it != this && it.wants_join > 0,
2088 {
2089 // detect any conflict between `this` and a queued player (queuePlayer() handles other conflicts)
2090 if (this.team < 0 && this.team_selected > 0 // `this` can't have their preference
2091 && it.wants_join == this.team_selected) // `it` is the player who already chose the team `this` wanted
2092 player_with_dibs = it;
2093
2094 Join(it, false);
2095 });
2096
2097 // Second pass: queued players whose team will be autoselected
2098 FOREACH_CLIENT(it != this && it.wants_join < 0,
2099 {
2100 Join(it, false);
2101 });
2102 }
2103
2104 Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
2105
2106 TRANSMUTE(Player, this);
2107 PutClientInServer(this);
2108
2109 if(IS_PLAYER(this)) // could be false due to PutClientInServer() mutator hook
2110 {
2111 if (!teamplay)
2112 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_PLAY, this.netname);
2113 else if (player_with_dibs)
2114 // limitation: notifications support only 1 translated team name
2115 // so the team `this` preferred can't be mentioned, only the team they got assigned to.
2116 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_JOIN_PLAY_TEAM_QUEUECONFLICT), player_with_dibs.netname);
2117 else
2118 {
2119 if (this.wants_join && game_starttime < time && !warmup_stage) // No countdown running && not returning to warmup via ReadyRestart_force
2120 Send_Notification(NOTIF_ONE_ONLY, this, MSG_ANNCE, ANNCE_BEGIN); // Get queued player's attention
2121 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_JOIN_PLAY_TEAM));
2122 }
2123 }
2124
2125 this.team_selected = 0;
2126 this.wants_join = 0;
2127}
2128
2130{
2131 if(g_duel)
2132 return 2; // TODO: this workaround is needed since the mutator hook from duel can't be activated before the gametype is loaded (e.g. switching modes via gametype vote screen)
2133 // don't return map_maxplayers during intermission as it would interfere with MapHasRightSize()
2135 MUTATOR_CALLHOOK(GetPlayerLimit, player_limit);
2136 player_limit = M_ARGV(0, int);
2137 return player_limit < maxclients && player_limit > 0 ? player_limit : 0;
2138}
2139
2146{
2147 if(!this)
2148 // this is called that way when checking if anyone may be able to join (to build qcstatus)
2149 // so report 0 free slots if restricted
2150 {
2151 if(autocvar_g_forced_team_otherwise == "spectate"
2152 || autocvar_g_forced_team_otherwise == "spectator"
2153 || (teamplay && lockteams))
2154 return 0;
2155 }
2156
2157 int totalClients = 0;
2158 int currentlyPlaying = 0;
2159 FOREACH_CLIENT(it != this,
2160 {
2161 ++totalClients;
2162 if(IS_PLAYER(it) || INGAME(it))
2163 ++currentlyPlaying;
2164 });
2165
2166 int player_limit = GetPlayerLimit();
2167
2168 int free_slots = max(0, (player_limit ? player_limit : maxclients) - currentlyPlaying);
2169 if (this || maxclients - totalClients) // don't add bot slots in the getstatus case if nobody can connect
2170 free_slots += bots_would_leave;
2171 if (!this) // getstatus case
2172 free_slots = min(free_slots, maxclients - totalClients);
2173
2174 if(this && !free_slots)
2175 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT, player_limit);
2176
2177 return free_slots;
2178}
2179
2180// Callsites other than ClientCommand_selectteam() should pass this.wants_join as team_index
2181// so the player won't accidentally reset a specific preference by pressing +jump
2182// and will see the centreprint with their current preference each time they press +jump.
2183bool queuePlayer(entity this, int team_index)
2184{
2185 // check if a queued player already chose the selected team
2186 if (team_index > 0)
2187 {
2188 FOREACH_CLIENT(it != this && it.wants_join == team_index,
2189 {
2190 if (QueuedPlayersReady(this, false))
2191 {
2192 // Join() will handle the notification so it can mention the team `player` will actually get
2193 this.team = -1; // force autoselect in Join() (last player skips queue)
2194 this.team_selected = team_index; // tell it which team to check for to find the conflict
2195 }
2196 else // > 2 teams
2197 {
2198 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(Team_IndexToTeam(team_index), CENTER_JOIN_PREVENT_QUEUE_TEAM_CONFLICT), it.netname);
2199 this.wants_join = -1; // force autoselect in Join()
2200 this.team_selected = -1; // prevents clobbering by CENTER_JOIN_PREVENT_QUEUE
2201 }
2202 return true;
2203 });
2204 }
2205
2206 if (QueuedPlayersReady(this, false))
2207 return false;
2208
2209 if (team_index <= 0) // team auto select deferred until Join()
2210 {
2211 if (team_index != this.wants_join || !this.wants_join) // prevents chatcon spam
2212 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_WANTS, this.netname);
2213 if (this.team_selected >= 0) // prevents CENTER_JOIN_PREVENT_QUEUE_TEAM_CONFLICT getting clobbered
2214 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT_QUEUE);
2215 this.wants_join = -1;
2216 this.team_selected = 0;
2217 }
2218 else
2219 {
2220 int team_num = Team_IndexToTeam(team_index);
2221 if (team_index != this.wants_join) // prevents chatcon spam
2222 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(team_num, INFO_JOIN_WANTS_TEAM), this.netname);
2223 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(team_num, CENTER_JOIN_PREVENT_QUEUE_TEAM));
2224 this.wants_join = team_index; // Player queued to join
2225 this.team_selected = team_index;
2226 }
2227
2228 return true;
2229}
2230
2232bool joinAllowed(entity this, int team_index)
2233{
2234 if (CS(this).version_mismatch)
2235 {
2236 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT_VERSIONMISMATCH);
2237 return false;
2238 }
2239 if (time < CS(this).jointime + MIN_SPEC_TIME) return false;
2240 if (teamplay && lockteams)
2241 {
2242 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_LOCKED);
2243 return false;
2244 }
2245
2246 if (Player_GetForcedTeamIndex(this) == TEAM_FORCE_SPECTATOR) return false;
2247
2248 if (!INGAME(this) && PlayerInList(this, autocvar_g_playban_list))
2249 {
2250 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PLAYBAN);
2251 return false;
2252 }
2253
2254 // IS_PLAYER for most gametypes, INGAME for ca, lms, surv
2255 if (autocvar_g_maxping && !(IS_PLAYER(this) || INGAME(this)) && !this.wants_join)
2256 {
2257 if (this.ping <= 0) return false; // too soon
2258 if (this.ping > autocvar_g_maxping)
2259 {
2260 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT_PING);
2261 return false;
2262 }
2263 }
2264
2265 if (QueueNeeded(this))
2266 {
2267 if (team_index == 0) // so ClientCommand_selectteam() can check joinAllowed() before calling SetPlayerTeam() without chicken/egg problem
2268 if (ShowTeamSelection(this)) return false; // only needed by callsites other than selectteam
2269 // queuePlayer called here so that only conditions above block queuing (g_maxplayers shouldn't)
2270 if (queuePlayer(this, team_index)) return false;
2271 if (!nJoinAllowed(this)) return false;
2272 }
2273 else
2274 {
2275 if (!nJoinAllowed(this)) return false;
2276 if (team_index == 0) // so ClientCommand_selectteam() can check joinAllowed() before calling SetPlayerTeam() without chicken/egg problem
2277 if (ShowTeamSelection(this)) return false; // only needed by callsites other than selectteam
2278 }
2279
2280 return true;
2281}
2282
2284{
2285 // waypoint editor implements a similar feature for waypoints
2287 return;
2288
2289 if (wasfreed(this.wp_aimed))
2290 this.wp_aimed = NULL;
2291
2293 entity ent = NULL;
2294 if (trace_ent)
2295 {
2296 ent = trace_ent;
2297 if (ent != this.wp_aimed)
2298 {
2299 string str = sprintf(
2300 "^7ent #%d\n^8 netname: ^3%s\n^8 classname: ^5%s\n^8 origin: ^2'%s'",
2301 etof(ent), ent.netname, ent.classname, vtos(ent.origin));
2302 debug_text_3d((ent.absmin + ent.absmax) * 0.5, str, 0, 7, '0 0 0');
2303 }
2304 }
2305 if (this.wp_aimed != ent)
2306 this.wp_aimed = ent;
2307}
2308
2311{
2313 {
2314 this.modelflags &= ~MF_ROCKET;
2316 IntermissionThink(this);
2317 return false;
2318 }
2319
2321 {
2322 // don't allow the player to turn around while game is paused
2323 // FIXME turn this into CSQC stuff
2324 this.v_angle = this.lastV_angle;
2325 this.angles = this.lastV_angle;
2326 this.fixangle = true;
2327 }
2328
2329 if (frametime) player_powerups(this);
2330
2332
2333 if (IS_DEAD(this))
2334 {
2335 if (this.personal && g_race_qualifying
2336 && (autocvar_g_allow_checkpoints || CheatsAllowed(this, CHIMPULSE_SPEEDRUN.impulse, 0, 0, false, true)))
2337 {
2338 if (time > this.respawn_time)
2339 {
2340 STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
2341 respawn(this);
2342 CS(this).impulse = CHIMPULSE_SPEEDRUN.impulse;
2343 }
2344 }
2345 else
2346 {
2347 if (frametime) player_anim(this);
2348
2349 if (this.respawn_flags & RESPAWN_DENY)
2350 {
2351 STAT(RESPAWN_TIME, this) = 0;
2352 return false;
2353 }
2354
2355 bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
2356
2357 switch(this.deadflag)
2358 {
2359 case DEAD_DYING:
2360 {
2361 if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max))
2363 else if (!button_pressed || (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)))
2364 this.deadflag = DEAD_DEAD;
2365 break;
2366 }
2367 case DEAD_DEAD:
2368 {
2369 if (button_pressed)
2371 else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE))
2373 break;
2374 }
2375 case DEAD_RESPAWNABLE:
2376 {
2377 if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE))
2379 break;
2380 }
2381 case DEAD_RESPAWNING:
2382 {
2383 if (time > this.respawn_time)
2384 {
2385 this.respawn_time = time + 1; // only retry once a second
2386 this.respawn_time_max = this.respawn_time;
2387 respawn(this);
2388 }
2389 break;
2390 }
2391 }
2392
2394
2395 if (this.respawn_flags & RESPAWN_SILENT)
2396 STAT(RESPAWN_TIME, this) = 0;
2397 else if ((this.respawn_flags & RESPAWN_FORCE) && this.respawn_time < this.respawn_time_max)
2398 {
2399 if (time < this.respawn_time)
2400 STAT(RESPAWN_TIME, this) = this.respawn_time;
2401 else if (this.deadflag != DEAD_RESPAWNING)
2402 STAT(RESPAWN_TIME, this) = -this.respawn_time_max;
2403 }
2404 else
2405 STAT(RESPAWN_TIME, this) = this.respawn_time;
2406 }
2407
2408 // if respawning, invert stat_respawn_time to indicate this, the client translates it
2409 if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
2410 STAT(RESPAWN_TIME, this) *= -1;
2411
2412 return false;
2413 }
2414
2415 FixPlayermodel(this);
2416
2418 {
2420 stuffcmd(this, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
2421 }
2422
2423 // reset gun alignment when dual wielding status changes
2424 // to ensure guns are always aligned right and left
2425 bool dualwielding = W_DualWielding(this);
2426 if(this.dualwielding_prev != dualwielding)
2427 {
2428 W_ResetGunAlign(this, CS_CVAR(this).cvar_cl_gunalign);
2429 this.dualwielding_prev = dualwielding;
2430 }
2431
2432 // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
2433 //if(frametime)
2434 {
2435 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
2436 {
2437 .entity weaponentity = weaponentities[slot];
2438 if(WEP_CVAR(WEP_VORTEX, charge_always))
2439 W_Vortex_Charge(this, weaponentity, frametime);
2440 W_WeaponFrame(this, weaponentity);
2441 }
2442 }
2443
2444 if (frametime)
2445 {
2446 // WEAPONTODO: Add a weapon request for this
2447 // rot vortex charge to the charge limit
2448 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
2449 {
2450 .entity weaponentity = weaponentities[slot];
2451 if (WEP_CVAR(WEP_VORTEX, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(WEP_VORTEX, charge_limit) && this.(weaponentity).vortex_charge_rottime < time)
2452 this.(weaponentity).vortex_charge = bound(WEP_CVAR(WEP_VORTEX, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(WEP_VORTEX, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
2453 }
2454
2455 player_regen(this);
2456 player_anim(this);
2458 }
2459
2460 monsters_setstatus(this);
2461
2462 return true;
2463}
2464
2466// merged SpectatorThink and ObserverThink (old names are here so you can grep for them)
2468{
2469 bool is_spec = IS_SPEC(this);
2470 if ( CS(this).impulse )
2471 {
2472 int r = MinigameImpulse(this, CS(this).impulse);
2473 if (!is_spec || r)
2474 CS(this).impulse = 0;
2475
2476 if (is_spec && CS(this).impulse == IMP_weapon_drop.impulse)
2477 {
2478 STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
2479 CS(this).impulse = 0;
2480 return;
2481 }
2482 }
2483
2485
2486 if (IS_BOT_CLIENT(this) && !CS(this).autojoin_checked)
2487 {
2488 CS(this).autojoin_checked = 1;
2489 TRANSMUTE(Player, this);
2490 PutClientInServer(this);
2491
2492 .entity weaponentity = weaponentities[0];
2493 if(this.(weaponentity).m_weapon == WEP_Null)
2494 W_NextWeapon(this, 0, weaponentity);
2495
2496 return;
2497 }
2498
2499 if (this.flags & FL_JUMPRELEASED)
2500 {
2501 if (PHYS_INPUT_BUTTON_JUMP(this) && (joinAllowed(this, this.wants_join) || time < CS(this).jointime + MIN_SPEC_TIME))
2502 {
2503 this.flags &= ~FL_JUMPRELEASED;
2504 this.flags |= FL_SPAWNING;
2505 }
2506 else if((is_spec && (PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)))
2507 || (!is_spec && ((PHYS_INPUT_BUTTON_ATCK(this) && !CS(this).version_mismatch) || this.would_spectate)))
2508 {
2509 this.flags &= ~FL_JUMPRELEASED;
2510 if (autocvar_sv_spectate == 2 && !warmup_stage && !this.vote_master)
2511 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_SPECTATE_SPEC_NOTALLOWED);
2512 else if(SpectateNext(this))
2513 { }
2514 else if (is_spec)
2515 {
2516 TRANSMUTE(Observer, this);
2517 PutClientInServer(this);
2518 }
2519 else
2520 this.would_spectate = false; // unable to spectate anyone
2521
2522 if (is_spec)
2523 CS(this).impulse = 0;
2524 }
2525 else if (is_spec)
2526 {
2527 if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19 || (CS(this).impulse >= 220 && CS(this).impulse <= 229))
2528 {
2529 this.flags &= ~FL_JUMPRELEASED;
2530 if (!SpectatePrev(this))
2531 {
2532 TRANSMUTE(Observer, this);
2533 PutClientInServer(this);
2534 }
2535 CS(this).impulse = 0;
2536 }
2537 else if(PHYS_INPUT_BUTTON_ATCK2(this))
2538 {
2540 {
2541 this.would_spectate = false;
2542 this.flags &= ~FL_JUMPRELEASED;
2543 TRANSMUTE(Observer, this);
2544 PutClientInServer(this);
2545 }
2546 }
2547 else if(!SpectateUpdate(this) && !SpectateNext(this))
2548 {
2549 PutObserverInServer(this, false, true);
2550 this.would_spectate = true;
2551 }
2552 }
2553 else
2554 {
2555 bool wouldclip = CS_CVAR(this).cvar_cl_clippedspectating;
2556 if (PHYS_INPUT_BUTTON_USE(this))
2557 wouldclip = !wouldclip;
2558 int preferred_movetype = (wouldclip ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
2559 set_movetype(this, preferred_movetype);
2560 }
2561 }
2562 else
2563 { // jump pressed
2564 if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this)))
2565 || (!is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))))
2566 {
2567 this.flags |= FL_JUMPRELEASED;
2568 // primary attack pressed
2569 if(this.flags & FL_SPAWNING)
2570 {
2571 this.flags &= ~FL_SPAWNING;
2572 if(joinAllowed(this, this.wants_join))
2573 Join(this, teamplay);
2574 else if(time < CS(this).jointime + MIN_SPEC_TIME)
2575 CS(this).autojoin_checked = -1;
2576 return;
2577 }
2578 }
2579 if(is_spec && !SpectateUpdate(this))
2580 PutObserverInServer(this, false, true);
2581 }
2582 if (is_spec)
2583 this.flags |= FL_CLIENT | FL_NOTARGET;
2584}
2585
2587{
2588 if (!IS_PLAYER(this))
2589 return;
2590
2591 if(this.vehicle)
2592 {
2593 if(!game_stopped)
2594 {
2596 return;
2597 }
2598 }
2599 else if(autocvar_g_vehicles_enter)
2600 {
2601 if(!game_stopped && !STAT(FROZEN, this) && !StatusEffects_active(STATUSEFFECT_Frozen, this) && !IS_DEAD(this) && !IS_INDEPENDENT_PLAYER(this))
2602 {
2603 entity head, closest_target = NULL;
2605
2606 while(head) // find the closest acceptable target to enter
2607 {
2608 if(IS_VEHICLE(head) && !IS_DEAD(head) && head.takedamage != DAMAGE_NO)
2609 if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
2610 {
2611 if(closest_target)
2612 {
2613 if(vlen2(this.origin - head.origin) < vlen2(this.origin - closest_target.origin))
2614 closest_target = head;
2615 }
2616 else
2617 closest_target = head;
2618 }
2619
2620 head = head.chain;
2621 }
2622
2623 if(closest_target)
2624 {
2625 vehicles_enter(this, closest_target);
2626 return;
2627 }
2628 }
2629 }
2630
2631 // a use key was pressed; call handlers
2633}
2634
2635
2636/*
2637=============
2638PlayerPreThink
2639
2640Called every frame for each real client by DP (and for each bot by StartFrame()),
2641and when executing every asynchronous move, so only include things that MUST be done then.
2642Use PlayerFrame() instead for code that only needs to run once per server frame.
2643frametime == 0 in the asynchronous code path.
2644
2645TODO: move more stuff from here and PlayerThink() and ObserverOrSpectatorThink() to PlayerFrame() (frametime is always set there)
2646=============
2647*/
2650{
2652
2653 zoomstate_set = false;
2654
2656
2657 if(PHYS_INPUT_BUTTON_USE(this) && !CS(this).usekeypressed)
2658 PlayerUseKey(this);
2659 CS(this).usekeypressed = PHYS_INPUT_BUTTON_USE(this);
2660
2661 if (IS_PLAYER(this))
2662 {
2663 if (IS_REAL_CLIENT(this) && time < CS(this).jointime + MIN_SPEC_TIME)
2664 error("Client can't be spawned as player on connection!");
2665 if(!PlayerThink(this))
2666 return;
2667 }
2669 {
2671 IntermissionThink(this);
2672 return;
2673 }
2674 else if (IS_REAL_CLIENT(this) && CS(this).autojoin_checked <= 0 && time >= CS(this).jointime + MIN_SPEC_TIME
2675 && this.ping > 0) // delay until centreprints could work (still on loading screen but timers start when it disappears)
2676 {
2677 bool early_join_requested = (CS(this).autojoin_checked < 0);
2678 CS(this).autojoin_checked = 1;
2679 // don't do this in ClientConnect
2680 // many things can go wrong if a client is spawned as player on connection
2681 if (early_join_requested || MUTATOR_CALLHOOK(AutoJoinOnConnection, this)
2684 {
2685 if(joinAllowed(this, this.wants_join))
2686 Join(this, teamplay);
2687 else if (!autocvar_sv_spectate) // we really want to join and some blockers may be brief (g_maxping)
2688 if (time < CS(this).spectatortime + MIN_SPEC_TIME) // centreprints don't appear while spamming
2689 CS(this).autojoin_checked = -1; // keep trying for MIN_SPEC_TIME
2690 return;
2691 }
2692 }
2693 else if (IS_OBSERVER(this) || IS_SPEC(this))
2695
2696 // WEAPONTODO: Add weapon request for this
2697 if (!zoomstate_set)
2698 {
2699 bool wep_zoomed = false;
2700 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
2701 {
2702 .entity weaponentity = weaponentities[slot];
2703 Weapon thiswep = this.(weaponentity).m_weapon;
2704 if(thiswep != WEP_Null && thiswep.wr_zoom)
2705 wep_zoomed += thiswep.wr_zoom(thiswep, this);
2706 }
2707 SetZoomState(this, PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this) || wep_zoomed);
2708 }
2709
2710 // Voice sound effects
2711 if (CS(this).teamkill_soundtime && time > CS(this).teamkill_soundtime)
2712 {
2713 CS(this).teamkill_soundtime = 0;
2714
2715 entity e = CS(this).teamkill_soundsource;
2716 entity oldpusher = e.pusher;
2717 e.pusher = this;
2718 PlayerSound(e, playersound_teamshoot, CH_VOICE, VOL_BASEVOICE, VOICETYPE_LASTATTACKER_ONLY, 1);
2719 e.pusher = oldpusher;
2720 }
2721
2722 if (CS(this).taunt_soundtime && time > CS(this).taunt_soundtime)
2723 {
2724 CS(this).taunt_soundtime = 0;
2725 PlayerSound(this, playersound_taunt, CH_VOICE, VOL_BASEVOICE, VOICETYPE_AUTOTAUNT, 1);
2726 }
2727
2729}
2730
2732{
2733 // TODO: mutator hook to prevent drowning?
2734 if(IS_DEAD(this) || game_stopped || time < game_starttime || this.vehicle
2735 || STAT(FROZEN, this) || this.watertype != CONTENT_WATER)
2736 {
2737 STAT(AIR_FINISHED, this) = 0;
2738 return;
2739 }
2740
2741 if (this.waterlevel != WATERLEVEL_SUBMERGED)
2742 {
2743 if(STAT(AIR_FINISHED, this) && STAT(AIR_FINISHED, this) < time)
2744 PlayerSound(this, playersound_gasp, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND, 1);
2745 STAT(AIR_FINISHED, this) = 0;
2746 }
2747 else
2748 {
2749 if (!STAT(AIR_FINISHED, this))
2750 STAT(AIR_FINISHED, this) = time + autocvar_g_balance_contents_drowndelay;
2751 if (STAT(AIR_FINISHED, this) < time)
2752 { // drown!
2753 if (this.pain_finished < time)
2754 {
2756 this.pain_finished = time + 0.5;
2757 }
2758 }
2759 }
2760}
2761
2763
2765{
2767
2768 if(!this.move_qcphysics)
2769 return;
2770
2771 if(!frametime && !CS(this).pm_frametime)
2772 return;
2773
2774 Movetype_Physics_NoMatchTicrate(this, CS(this).pm_frametime, true);
2775}
2776
2777/*
2778=============
2779PlayerPostThink
2780
2781Called every frame for each real client by DP (and for each bot by StartFrame()),
2782and when executing every asynchronous move, so only include things that MUST be done then.
2783Use PlayerFrame() instead for code that only needs to run once per server frame.
2784frametime == 0 in the asynchronous code path.
2785=============
2786*/
2788{
2789 Player_Physics(this);
2790
2791 if (IS_PLAYER(this))
2792 {
2793 DrownPlayer(this);
2794 UpdateChatBubble(this);
2795 if (CS(this).impulse)
2796 ImpulseCommands(this);
2797 GetPressedKeys(this);
2798 }
2799 else if (IS_OBSERVER(this) && STAT(PRESSED_KEYS, this))
2800 {
2801 CS(this).pressedkeys = 0;
2802 STAT(PRESSED_KEYS, this) = 0;
2803 }
2804
2806 CS(this).pm_frametime = 0; // CSQCModel_CheckUpdate() and Player_Physics() both read it
2807}
2808
2809/*
2810=============
2811PlayerFrame
2812
2813Called every frame for each client by StartFrame().
2814Use this for code that only needs to run once per server frame.
2815frametime is always set here.
2816=============
2817*/
2819{
2820 Physics_UpdateStats(this);
2821
2822// formerly PreThink code
2823
2824 if (this.score_frame_dmg)
2825 {
2827 GameRules_scoring_add(this, DMG, this.score_frame_dmg);
2828 this.score_frame_dmg = 0;
2829 }
2830 if (this.score_frame_dmgtaken)
2831 {
2833 GameRules_scoring_add(this, DMGTAKEN, this.score_frame_dmgtaken);
2834 this.score_frame_dmgtaken = 0;
2835 }
2836
2837 STAT(GUNALIGN, this) = CS_CVAR(this).cvar_cl_gunalign; // TODO
2838 STAT(MOVEVARS_CL_TRACK_CANJUMP, this) = CS_CVAR(this).cvar_cl_movement_track_canjump;
2839
2840 // physics frames: update anticheat stuff
2841 anticheat_prethink(this);
2842
2843 // Check if spectating is allowed
2844 // cvar hook/callback TODO: make this event-driven
2846 && (IS_SPEC(this) || IS_OBSERVER(this)) && !INGAME(this))
2847 {
2848 float cutoff = CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime;
2849 if (time > cutoff + MIN_SPEC_TIME * 0.5 // sv_spectate was disabled recently (or the server was stalled far too long)
2850 || CS(this).autojoin_checked == 0) // or too soon to have tried to autojoin
2851 {
2852 CS(this).spectatortime = time; // reset the grace period
2853 if (CS(this).autojoin_checked) // only notify when sv_spectate was disabled recently, to prevent spam
2854 Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
2855 }
2856 else if (time > cutoff)
2857 if (dropclient_schedule(this))
2858 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
2859 }
2860
2861 // Check for nameless players
2862 if (this.netname == "" || this.netname != CS(this).netname_previous)
2863 {
2864 bool assume_unchanged = (CS(this).netname_previous == "");
2865 if (autocvar_sv_name_maxlength > 0 && strlennocol(this.netname) > autocvar_sv_name_maxlength)
2866 {
2867 int new_length = textLengthUpToLength(this.netname, autocvar_sv_name_maxlength, strlennocol);
2868 this.netname = strzone(strcat(substring(this.netname, 0, new_length), "^7"));
2869 sprint(this, sprintf("Warning: your name is longer than %d characters, it has been truncated.\n", autocvar_sv_name_maxlength));
2870 assume_unchanged = false;
2871 // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
2872 }
2873 if (isInvisibleString(this.netname))
2874 {
2875 this.netname = strzone(sprintf("Player#%d", this.playerid));
2876 sprint(this, "Warning: invisible names are not allowed.\n");
2877 assume_unchanged = false;
2878 // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
2879 }
2880 if (!assume_unchanged && autocvar_sv_eventlog)
2881 GameLogEcho(strcat(":name:", ftos(this.playerid), ":", playername(this.netname, this.team, false)));
2882 strcpy(CS(this).netname_previous, this.netname);
2883 }
2884
2885 // version nagging
2886 if (CS(this).version_nagtime && CS_CVAR(this).cvar_g_xonoticversion && time > CS(this).version_nagtime)
2887 {
2888 CS(this).version_nagtime = 0;
2889 if (strstrofs(CS_CVAR(this).cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(CS_CVAR(this).cvar_g_xonoticversion, "autobuild", 0) >= 0)
2890 {
2891 // git client
2892 }
2893 else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
2894 {
2895 // git server
2896 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
2897 }
2898 else
2899 {
2900 int r = vercmp(CS_CVAR(this).cvar_g_xonoticversion, autocvar_g_xonoticversion);
2901 if (r < 0) // old client
2902 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
2903 else if (r > 0) // old server
2904 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, CS_CVAR(this).cvar_g_xonoticversion);
2905 }
2906 }
2907
2908 if (this.ignore_list_send_time > 0 && time > this.ignore_list_send_time)
2909 ignore_list_send(this);
2910
2911 // GOD MODE info
2912 if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
2913 {
2914 Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
2915 this.max_armorvalue = 0;
2916 }
2917
2918 // Vehicles
2919 if(autocvar_g_vehicles_enter && (time > this.last_vehiclecheck) && !game_stopped && !this.vehicle)
2920 if(IS_PLAYER(this) && !STAT(FROZEN, this) && !StatusEffects_active(STATUSEFFECT_Frozen, this) && !IS_DEAD(this) && !IS_INDEPENDENT_PLAYER(this))
2921 {
2923 {
2924 if(!it.owner)
2925 {
2926 if(!it.team || SAME_TEAM(this, it))
2927 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
2928 else if(autocvar_g_vehicles_steal)
2929 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
2930 }
2931 else if((it.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(it.owner, this))
2932 {
2933 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
2934 }
2935 });
2936
2937 this.last_vehiclecheck = time + 1;
2938 }
2939
2940
2941
2942// formerly PostThink code
2944 if (IS_REAL_CLIENT(this))
2946 if (!intermission_running) // NextLevel() kills all centerprints after setting this true
2947 {
2948 int totalClients = 0;
2950 {
2951 // maxidle disabled in local matches by not counting clients (totalClients 0)
2953 {
2955 {
2956 ++totalClients;
2957 });
2958 if (maxclients - totalClients > autocvar_sv_maxidle_slots)
2959 totalClients = 0;
2960 }
2961 }
2962 else if ((IS_PLAYER(this) || this.wants_join) && autocvar_sv_maxidle_playertospectator > 0)
2963 {
2965 {
2966 ++totalClients;
2967 });
2968 }
2969
2970 if (totalClients < autocvar_sv_maxidle_minplayers)
2971 {
2972 // idle kick disabled
2973 CS(this).parm_idlesince = time;
2974 }
2975 else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
2976 {
2977 if (CS(this).idlekick_lasttimeleft)
2978 {
2979 CS(this).idlekick_lasttimeleft = 0;
2980 Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
2981 }
2982 }
2983 else
2984 {
2985 float maxidle_time = autocvar_sv_maxidle;
2986 if ((IS_PLAYER(this) || this.wants_join)
2989 float timeleft = ceil(maxidle_time - (time - CS(this).parm_idlesince));
2990 float countdown_time = max(min(10, maxidle_time - 1), ceil(maxidle_time * 0.33)); // - 1 to support maxidle_time <= 10
2991 if (timeleft == countdown_time && !CS(this).idlekick_lasttimeleft)
2992 {
2994 {
2995 if (!this.wants_join) // no countdown centreprint when getting kicked off the join queue
2996 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOVETOSPEC_IDLING, timeleft);
2997 }
2998 else
2999 Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
3000 }
3001 if (timeleft <= 0)
3002 {
3003 if ((IS_PLAYER(this) || this.wants_join)
3005 {
3006 if (this.wants_join)
3007 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING_QUEUE, this.netname, maxidle_time);
3008 else
3009 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_MOVETOSPEC_IDLING, this.netname, maxidle_time);
3010 PutObserverInServer(this, true, true);
3011 // Can't do this in PutObserverInServer() or SetPlayerTeam() cos it causes
3012 // mouse2 (change spectate mode) to kick the player off the join queue.
3013 this.wants_join = 0;
3014 this.team_selected = 0;
3015 // when the player is kicked off the server, these are called in ClientDisconnect()
3019 }
3020 else
3021 {
3022 if (dropclient_schedule(this))
3023 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname, maxidle_time);
3024 }
3025 return;
3026 }
3027 else if (timeleft <= countdown_time
3028 && !this.wants_join) // no countdown bangs when getting kicked off the join queue
3029 {
3030 if (timeleft != CS(this).idlekick_lasttimeleft)
3031 play2(this, SND(TALK2));
3032 CS(this).idlekick_lasttimeleft = timeleft;
3033 }
3034 }
3035 }
3036
3037 CheatFrame(this);
3038
3039 if (game_stopped)
3040 {
3041 this.solid = SOLID_NOT;
3042 this.takedamage = DAMAGE_NO;
3044 CS(this).teamkill_complain = 0;
3045 CS(this).teamkill_soundtime = 0;
3046 CS(this).teamkill_soundsource = NULL;
3047 }
3048
3050 float hp = healtharmor_maxdamage(GetResource(this, RES_HEALTH), GetResource(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x;
3052 }
3053}
3054
3055// hack to copy the button fields from the client entity to the Client State
3057{
3058 if(this.impulse)
3059 store.impulse = this.impulse;
3060 this.impulse = 0;
3061
3062 bool typing = this.buttonchat || this.button12;
3063
3064 store.button0 = (typing) ? 0 : this.button0;
3065 //button1?!
3066 store.button2 = (typing) ? 0 : this.button2;
3067 store.button3 = (typing) ? 0 : this.button3;
3068 store.button4 = this.button4;
3069 store.button5 = (typing) ? 0 : this.button5;
3070 store.button6 = this.button6;
3071 store.button7 = this.button7;
3072 store.button8 = this.button8;
3073 store.button9 = this.button9;
3074 store.button10 = this.button10;
3075 store.button11 = this.button11;
3076 store.button12 = this.button12;
3077 store.button13 = this.button13;
3078 store.button14 = this.button14;
3079 store.button15 = this.button15;
3080 store.button16 = this.button16;
3081 store.buttonuse = this.buttonuse;
3082 store.buttonchat = this.buttonchat;
3083
3084 store.cursor_active = this.cursor_active;
3085 store.cursor_screen = this.cursor_screen;
3086 store.cursor_trace_start = this.cursor_trace_start;
3087 store.cursor_trace_endpos = this.cursor_trace_endpos;
3088 store.cursor_trace_ent = this.cursor_trace_ent;
3089
3090 store.ping = this.ping;
3091 store.ping_packetloss = this.ping_packetloss;
3092 store.ping_movementloss = this.ping_movementloss;
3093
3094 store.v_angle = this.v_angle;
3095 store.movement = this.movement;
3096}
3097
3098NET_HANDLE(fpsreport, bool)
3099{
3100 int fps = ReadShort();
3101 PlayerScore_Set(sender, SP_FPS, fps);
3102 return true;
3103}
void accuracy_resend(entity e)
force a resend of a player's accuracy stats
Definition accuracy.qc:80
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
void anticheat_spectatecopy(entity this, entity spectatee)
Definition anticheat.qc:166
void anticheat_prethink(entity this)
Definition anticheat.qc:172
void antilag_clear(entity e, entity store)
Definition antilag.qc:114
int autocvar_g_antilag
Definition antilag.qh:3
float bot_forced_team
Definition api.qh:41
void navigation_dynamicgoal_init(entity this, bool initially_static)
Definition navigation.qc:77
float bot_attack
Definition api.qh:38
IntrusiveList g_bot_targets
Definition api.qh:149
void bot_aim_reset(entity this)
Definition aim.qc:134
int bots_would_leave
how many bots would leave so humans can replace them
Definition api.qh:101
int player_count
Definition api.qh:103
void bot_relinkplayerlist()
Definition bot.qc:424
const int ARC_SF_UPDATE
Definition arc.qh:120
vector arc_shotorigin[4]
Definition arc.qh:104
entity arc_beam
Definition arc.qh:128
#define g_assault
Definition assault.qh:27
string autocvar_g_playban_list
Definition banning.qh:14
string autocvar_g_chatban_list
Definition banning.qh:13
#define MUTATOR_CALLHOOK(id,...)
Definition base.qh:143
#define MUTATOR_IS_ENABLED(this)
Definition base.qh:193
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
#define BITSET(var, mask, flag)
Definition bits.qh:11
#define boolean(value)
Definition bool.qh:9
float CheatFrame(entity this)
Definition cheats.qc:709
bool drag_undraggable(entity draggee, entity dragger)
Definition cheats.qc:903
float CheatsAllowed(entity this, float imp, int argc, float cheatframe, bool logattempt, bool ignoredead)
Definition cheats.qc:59
bool speedrunning
Definition cheats.qh:22
entity personal
Definition cheats.qh:24
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector punchangle
float pain_finished
entity active_minigame
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
const int MAX_AXH
entity AuxiliaryXhair[MAX_AXH]
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition weapon.qh:44
virtual void wr_zoom()
(BOTH) weapon specific zoom reticle
Definition weapon.qh:116
string netname
Definition powerups.qc:20
float cnt
Definition powerups.qc:24
vector colormod
Definition powerups.qc:21
float count
Definition powerups.qc:22
float alpha
Definition items.qc:13
float ping
Definition main.qh:169
float ping_movementloss
Definition main.qh:169
float ping_packetloss
Definition main.qh:169
entity owner
Definition main.qh:87
bool ready
Definition main.qh:88
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
Definition main.qh:197
string ignore_list
Definition main.qh:130
bool warmup_stage
Definition main.qh:120
int serverflags
Definition main.qh:211
vector hook_shotorigin[4]
Definition main.qh:205
int team
Definition main.qh:188
entity killindicator
Definition clientkill.qh:7
void ignore_list_update_on_connection(entity this)
Updates ignore list of all the players.
Definition cmd.qc:153
void ignore_list_send(entity this)
Definition cmd.qc:168
void ignore_remove_player(entity this, entity ignore, bool from_db_too)
Removes a player from the ignore list of another player.
Definition cmd.qc:47
float ignore_list_send_time
Definition cmd.qh:9
const int IGNORE_LIST_SEND_NOW
Definition cmd.qh:8
#define debug_text_3d(...)
Definition debug.qh:486
#define g_race
Definition race.qh:48
const int IT_USING_JETPACK
Definition item.qh:27
const int IT_SUPERWEAPON
Definition item.qh:41
string mdl
Definition item.qh:89
const int IT_UNLIMITED_AMMO
Definition item.qh:23
const int IT_UNLIMITED_SUPERWEAPONS
Definition item.qh:24
#define setmodel(this, m)
Definition model.qh:26
#define M_ARGV(x, type)
Definition events.qh:17
void Physics_UpdateStats(entity this)
Definition player.qc:44
int items
Definition player.qh:226
vector autocvar_sv_player_viewoffset
Definition player.qh:337
vector movement
Definition player.qh:228
#define IS_CLIENT(s)
Definition player.qh:241
#define IS_DEAD(s)
Definition player.qh:244
#define UNSET_DUCKED(s)
Definition player.qh:214
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition player.qh:153
float autocvar_sv_jumpspeedcap_min
Definition player.qh:49
#define PHYS_INPUT_BUTTON_HOOK(s)
Definition player.qh:157
#define PHYS_INPUT_BUTTON_CHAT(s)
Definition player.qh:161
vector v_angle
Definition player.qh:236
float watertype
Definition player.qh:224
float waterlevel
Definition player.qh:225
#define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)
Definition player.qh:163
#define IS_DUCKED(s)
Definition player.qh:212
#define PHYS_INPUT_BUTTON_MINIGAME(s)
Definition player.qh:166
#define IS_PLAYER(s)
Definition player.qh:242
float autocvar_sv_jumpspeedcap_max
Definition player.qh:47
#define PHYS_INPUT_BUTTON_USE(s)
Definition player.qh:160
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:152
#define PHYS_INPUT_BUTTON_ZOOM(s)
Definition player.qh:155
entity conveyor
Definition player.qh:57
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition player.qh:154
int timeout_status
Definition stats.qh:87
float game_starttime
Definition stats.qh:82
float game_stopped
Definition stats.qh:81
string playername(string thename, int teamid, bool team_colorize)
Definition util.qc:2188
vector healtharmor_maxdamage(float h, float a, float armorblock, int deathtype)
Definition util.qc:1395
Notification Announcer_PickNumber(int type, int num)
Definition util.qc:1933
float compressShotOrigin(vector v)
Definition util.qc:1354
float textLengthUpToLength(string theText, int maxLength, textLengthUpToLength_lenFunction_t w)
Definition util.qc:924
float get_model_parameters(string m, float sk)
Definition util.qc:1500
string mi_shortname
Definition util.qh:126
float get_model_parameters_species
Definition util.qh:180
string strtolower(string s)
const int CNT_RESPAWN
Definition util.qh:255
const int FL_CLIENT
Definition constants.qh:72
const int KEY_JUMP
Definition constants.qh:39
const int KEY_ATCK2
Definition constants.qh:42
const int KEY_RIGHT
Definition constants.qh:38
const int FL_PICKUPITEMS
Definition constants.qh:88
const int FL_NOTARGET
Definition constants.qh:76
const int FL_JUMPRELEASED
Definition constants.qh:81
const int KEY_BACKWARD
Definition constants.qh:36
const int FL_SPAWNING
Definition constants.qh:87
const int HUD_NORMAL
Definition constants.qh:47
const int KEY_FORWARD
Definition constants.qh:35
const int FL_GODMODE
Definition constants.qh:75
const int KEY_LEFT
Definition constants.qh:37
const int KEY_CROUCH
Definition constants.qh:40
const int FRAGS_PLAYER
Definition constants.qh:3
const int KEY_ATCK
Definition constants.qh:41
const int SPECIES_HUMAN
Definition constants.qh:22
const int FRAGS_SPECTATOR
Definition constants.qh:4
#define EFMASK_CHEAP
Definition constants.qh:107
IntrusiveList g_conveyed
Definition conveyor.qh:4
float counter_cnt
Definition counter.qh:6
IntrusiveList g_counters
Definition counter.qh:8
string classname
float movetype
float flags
const float SOLID_SLIDEBOX
float maxclients
entity trace_ent
float DPCONTENTS_BOTCLIP
float DPCONTENTS_SOLID
vector avelocity
float frametime
vector velocity
float DPCONTENTS_BODY
const float CONTENT_WATER
const float EF_FULLBRIGHT
const float SOLID_NOT
float effects
float DPCONTENTS_PLAYERCLIP
float skin
float time
float nextthink
const float EF_NODEPTHTEST
vector origin
vector oldorigin
const float CONTENT_EMPTY
const float EF_NODRAW
float dphitcontentsmask
int modelflags
float death_time
const int EF_TELEPORT_BIT
const int MF_ROCKET
const int EF_RESTARTANIM_BIT
#define CSQCMODEL_AUTOUPDATE(e)
#define CSQCMODEL_EF_RESPAWNGHOST
#define CSQCMODEL_AUTOINIT(e)
#define g_cts
Definition cts.qh:36
int autocvar_bot_vs_human
Definition cvars.qh:67
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:503
float taunt_soundtime
Definition damage.qh:59
float dmg_team
Definition damage.qh:53
float damagedbycontents
Definition damage.qh:45
float autocvar_g_balance_armor_blockpercent
Definition damage.qh:21
IntrusiveList g_damagedbycontents
Definition damage.qh:135
float autocvar_g_teamdamage_resetspeed
Definition damage.qh:22
float teamkill_soundtime
Definition damage.qh:55
#define DMG_NOWEP
Definition damage.qh:104
float autocvar_g_balance_damagepush_speedfactor
Definition damage.qh:18
float damageforcescale
string clientstatus
float disableclientprediction
float button10
float button12
float button3
float button7
float button11
float button16
entity drawonlytoclient
float button4
vector cursor_screen
float button6
string netaddress
string crypto_idfp
entity cursor_trace_ent
float EF_LOWPRECISION
float button8
float buttonchat
float buttonuse
float crypto_idfp_signed
float button9
float button15
float button13
vector punchvector
float button14
vector cursor_trace_start
float button5
vector cursor_trace_endpos
#define strstrofs
#define strlen
#define tokenize_console
#define g_duel
Definition duel.qh:32
bool move_qcphysics
Definition physics.qh:25
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:124
RES_ARMOR
Definition ent_cs.qc:130
ent angles
Definition ent_cs.qc:121
model
Definition ent_cs.qc:139
solid
Definition ent_cs.qc:165
void entcs_update_players(entity player)
Definition ent_cs.qc:183
int frags
Definition ent_cs.qh:71
int wants_join
Definition ent_cs.qh:73
ERASEABLE bool fexists(string f)
Definition file.qh:4
string GameLog_ProcessIP(string s)
Definition gamelog.qc:8
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3
void UpdatePlayerSounds(entity this)
const int VOICETYPE_LASTATTACKER_ONLY
bool autocvar_g_debug_globalsounds
Use new sound handling.
Definition globalsound.qh:9
const int VOICETYPE_PLAYERSOUND
#define PlayerSound(this, def, chan, vol, voicetype, pitchscale)
const int VOICETYPE_AUTOTAUNT
Weapons
Definition guide.qh:113
void Handicap_Initialize(entity player)
Initializes handicap to its default value.
Definition handicap.qc:16
float Handicap_GetTotalHandicap(entity player, bool receiving)
Returns the total handicap of the player.
Definition handicap.qc:96
Header file that describes the handicap system.
float handicap_avg_taken_sum
Definition handicap.qh:72
float handicap_avg_given_sum
Definition handicap.qh:71
void IntermissionThink(entity this)
void Send_NextMap_To_Player(entity pl)
bool intermission_running
#define get_nextmap()
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
bool Ban_MaybeEnforceBanOnce(entity client)
Definition ipban.qc:471
#define FOREACH_WORD(words, cond, body)
Definition iter.qh:33
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
#define FOREACH(list, cond, body)
Definition iter.qh:19
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
float pushltime
Definition jumppads.qh:21
bool istypefrag
Definition jumppads.qh:22
entity ladder_entity
Definition ladder.qh:11
IntrusiveList g_ladderents
Definition ladder.qh:3
#define PlayerPostThink
Definition _all.inc:258
#define ClientConnect
Definition _all.inc:238
#define PlayerPreThink
Definition _all.inc:254
#define SetChangeParms
Definition _all.inc:228
#define PutClientInServer
Definition _all.inc:246
#define ClientDisconnect
Definition _all.inc:242
#define TC(T, sym)
Definition _all.inc:82
#define SetNewParms
Definition _all.inc:224
int SendFlags
Definition net.qh:118
#define NET_HANDLE(id, param)
Definition net.qh:15
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
#define STAT(...)
Definition stats.qh:82
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
Definition common.qc:686
#define LOG_FATAL(...)
Definition log.qh:53
#define assert(expr,...)
Definition log.qh:8
int MapInfo_Get_ByName(string pFilename, float pAllowGenerate, Gametype pGametypeToSet)
Definition mapinfo.qc:1385
void MapInfo_ClearTemps()
Definition mapinfo.qc:1634
int map_minplayers
Definition mapinfo.qh:190
int map_maxplayers
Definition mapinfo.qh:191
string MapInfo_Map_author
Definition mapinfo.qh:10
string MapInfo_Map_titlestring
Definition mapinfo.qh:8
entity viewloc
Definition viewloc.qh:13
bool autocvar_g_campaign
Definition menu.qc:752
void localcmd(string command,...)
float ceil(float f)
float MSG_ONE
Definition menudefs.qc:56
float stof(string val,...)
float bound(float min, float value, float max)
string substring(string s, float start, float length)
void WriteString(string data, float dest, float desto)
float cvar(string name)
void sprint(float clientnum, string text,...)
entity find(entity start,.string field, string match)
float random(void)
void WriteEntity(entity data, float dest, float desto)
vector randomvec(void)
void WriteCoord(float data, float dest, float desto)
string vtos(vector v)
float min(float f,...)
string ftos(float f)
void WriteByte(float data, float dest, float desto)
float floor(float f)
const string cvar_defstring(string name)
string strzone(string s)
string argv(float n)
float max(float f,...)
#define etof(e)
Definition misc.qh:25
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient)
Definition movetypes.qc:779
const int MOVETYPE_WALK
Definition movetypes.qh:132
const int MOVETYPE_NONE
Definition movetypes.qh:129
const int MOVETYPE_QCPLAYER
Definition movetypes.qh:150
const int WATERLEVEL_SUBMERGED
Definition movetypes.qh:14
const int WATERLEVEL_NONE
Definition movetypes.qh:11
const int MOVETYPE_FLY_WORLDONLY
Definition movetypes.qh:143
float move_movetype
Definition movetypes.qh:76
const int MOVETYPE_NOCLIP
Definition movetypes.qh:137
const int MOVETYPE_FLY
Definition movetypes.qh:134
@ STATUSEFFECT_REMOVE_CLEAR
Effect is being forcibly removed without calling any additional mechanics.
Definition all.qh:30
@ STATUSEFFECT_REMOVE_NORMAL
Effect is being removed by a function, calls regular removal mechanics.
Definition all.qh:28
@ STATUSEFFECT_REMOVE_TIMEOUT
Definition all.qh:29
const int RACE_NET_CHECKPOINT_CLEAR
Definition net_linked.qh:12
void sv_notice_join(entity _to)
Definition net_notice.qc:14
var void func_null()
string string_null
Definition nil.qh:9
s1 s2 s1 s2 FLAG s1 s2 FLAG spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 CPID_PREVENT_JOIN
Definition all.inc:730
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
s1 s2 s1 s2 FLAG s1 s2 FLAG spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 CPID_IDLING
Definition all.inc:688
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
Definition all.qc:1537
#define APP_TEAM_NUM(num, prefix)
Definition all.qh:84
#define TRANSMUTE(cname, this,...)
Definition oo.qh:136
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define STATIC_METHOD(cname, name, prototype)
Definition oo.qh:278
void PlayerStats_GameReport_FinalizePlayer(entity p)
void PlayerStats_GameReport_AddPlayer(entity e)
void PlayerStats_GameReport_AddEvent(string event_id)
const string PLAYERSTATS_ALIVETIME
#define PlayerStats_GameReport_Event_Player(ent, eventid, val)
void Portal_ClearAll(entity own)
Definition portals.qc:589
#define NULL
Definition post.qh:14
#define world
Definition post.qh:15
#define error
Definition pre.qh:6
#define setcolor
Definition pre.qh:11
float DEAD_DYING
Definition progsdefs.qc:275
float parm1
Definition progsdefs.qc:45
float button2
Definition progsdefs.qc:156
float button0
Definition progsdefs.qc:154
entity msg_entity
Definition progsdefs.qc:63
vector view_ofs
Definition progsdefs.qc:151
float DEAD_NO
Definition progsdefs.qc:274
float fixangle
Definition progsdefs.qc:160
float deadflag
Definition progsdefs.qc:149
float DEAD_RESPAWNABLE
Definition progsdefs.qc:277
float impulse
Definition progsdefs.qc:158
float DEAD_RESPAWNING
Definition progsdefs.qc:278
string weaponmodel
Definition progsdefs.qc:140
float dmg_save
Definition progsdefs.qc:199
float DEAD_DEAD
Definition progsdefs.qc:276
float armortype
Definition progsdefs.qc:178
entity dmg_inflictor
Definition progsdefs.qc:200
#define stuffcmd(cl,...)
Definition progsdefs.qh:23
float scale
Definition projectile.qc:14
q3compat
Definition quake3.qc:59
bool autocvar_sv_q3compat_changehitbox
Definition quake3.qh:7
int fragsfilter_cnt
Definition quake3.qh:11
ERASEABLE void RandomSelection_Init()
Definition random.qc:4
#define RandomSelection_AddEnt(e, weight, priority)
Definition random.qh:14
entity RandomSelection_chosen_ent
Definition random.qh:5
ERASEABLE ACCUMULATE void Registry_send_all()
Definition registry.qh:167
float PlayerScore_Set(entity player, PlayerScoreField scorefield, float score)
Sets the player's score to the score parameter.
Definition scores.qc:384
bool PlayerScore_Clear(entity player)
Initialize the score of this player if needed.
Definition scores.qc:285
#define AVAILABLE_TEAMS
void W_NextWeapon(entity this, int list,.entity weaponentity)
Definition selection.qc:322
#define w_getbestweapon(ent, wepent)
Definition selection.qh:23
bool autocvar_g_weaponswitch_debug
Definition selection.qh:7
#define setthink(e, f)
vector
Definition self.qh:92
int Campaign_GetLevelNum()
Definition campaign.qc:44
bool campaign_bots_may_start
campaign mode: bots shall spawn but wait for the player to spawn before they do anything in other gam...
Definition campaign.qh:26
#define CHAT_NOSPECTATORS()
Definition chat.qh:30
void player_powerups_remove_all(entity this, bool allow_poweroff_sound)
Definition client.qc:1537
int player_getspecies(entity this)
Definition client.qc:444
bool SpectateSet(entity this)
Definition client.qc:1881
void play_countdown(entity this, float finished, Sound samp)
Definition client.qc:1528
entity chatbubbleentity
Definition client.qc:1264
void SpectateCopy(entity this, entity spectatee)
Definition client.qc:1795
void WriteSpectators(entity player, entity to)
Definition client.qc:114
int CountSpectators(entity player, entity to)
Definition client.qc:100
float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
Definition client.qc:1633
void GiveWarmupResources(entity this)
Definition client.qc:568
entity SelectObservePoint(entity this)
Definition client.qc:250
bool ShowTeamSelection(entity this)
Definition client.qc:2058
int GetPlayerLimit()
Definition client.qc:2129
bool SpectateUpdate(entity this)
Definition client.qc:1863
void DrownPlayer(entity this)
Definition client.qc:2731
void GetPressedKeys(entity this)
Definition client.qc:1763
void PlayerUseKey(entity this)
Definition client.qc:2586
float autocvar_g_maxping
Definition client.qc:2231
void ClientData_Detach(entity this)
Definition client.qc:179
void player_powerups(entity this)
Definition client.qc:1553
void SetNewParms()
Definition client.qc:960
void SendWelcomeMessage(entity this, int msg_type)
Definition client.qc:1077
bool zoomstate_set
Definition client.qc:1752
void UpdateChatBubble(entity this)
Definition client.qc:1372
void FixClientCvars(entity e)
Definition client.qc:999
bool PlayerInIDList(entity p, string idlist)
Definition client.qc:1038
bool would_spectate
Definition client.qc:2465
void SetZoomState(entity this, float newzoom)
Definition client.qc:1753
float model_randomizer
Definition client.qc:453
string CheckPlayerModel(string plyermodel)
Definition client.qc:208
void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
putting a client as observer in the server
Definition client.qc:261
void player_regen(entity this)
Definition client.qc:1684
float last_vehiclecheck
Definition client.qc:2648
void Player_Physics(entity this)
Definition client.qc:2764
bool SpectateNext(entity this)
Definition client.qc:1983
void ChatBubbleThink(entity this)
Definition client.qc:1346
void respawn(entity this)
Definition client.qc:1498
void PutPlayerInServer(entity this)
Definition client.qc:580
void calculate_player_respawn_time(entity this)
Definition client.qc:1394
float CalcRot(float current, float stable, float rotfactor, float rotframetime)
Definition client.qc:1643
void ClientInit_CheckUpdate(entity this)
Definition client.qc:931
bool PlayerThink(entity this)
Definition client.qc:2310
bool ClientInit_SendEntity(entity this, entity to, int sf)
Definition client.qc:895
void ObserverOrSpectatorThink(entity this)
Definition client.qc:2467
bool PlayerInIPList(entity p, string iplist)
Definition client.qc:1029
bool queuePlayer(entity this, int team_index)
Definition client.qc:2183
void ShowRespawnCountdown(entity this)
Definition client.qc:2039
int nJoinAllowed(entity this)
Determines how many player slots are free.
Definition client.qc:2145
void PM_UpdateButtons(entity this, entity store)
Definition client.qc:3056
void SetSpectatee_status(entity this, int spectatee_num)
Definition client.qc:1900
bool Spectate(entity this, entity pl)
Definition client.qc:1973
bool joinAllowed(entity this, int team_index)
Definition client.qc:2232
bool dualwielding_prev
Definition client.qc:2309
bool findinlist_abbrev(string tofind, string list)
Definition client.qc:1015
void FixPlayermodel(entity player)
Definition client.qc:454
bool SpectatePrev(entity this)
Definition client.qc:1997
void PlayerFrame(entity this)
Definition client.qc:2818
bool PlayerInList(entity player, string list)
Definition client.qc:1047
void ClientInit_Spawn()
Definition client.qc:946
void ClientData_Attach(entity this)
Definition client.qc:172
void RotRegen(entity this, Resource res, float limit_mod, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime)
Definition client.qc:1653
void DecodeLevelParms(entity this)
Definition client.qc:986
void show_entnum(entity this)
Definition client.qc:2283
string shootfromfixedorigin
Definition client.qc:1263
void Join(entity this, bool queued_join)
it's assumed this isn't called for bots (campaign_bots_may_start, centreprints)
Definition client.qc:2070
void ClientInit_misc(entity this)
Definition client.qc:907
void SetSpectatee(entity this, entity spectatee)
Definition client.qc:1935
void setplayermodel(entity e, string modelname)
Definition client.qc:241
string FallbackPlayerModel
Definition client.qc:207
void ClientData_Touch(entity e, bool to_spectators_too)
Definition client.qc:185
bool ClientData_Send(entity this, entity to, int sf)
Definition client.qc:128
int killcount
Definition client.qh:315
string autocvar_sv_quickmenu_file
Definition client.qh:54
float autocvar_sv_foginterval
Definition client.qh:36
float autocvar_sv_maxidle
Definition client.qh:37
float respawn_time_max
Definition client.qh:322
string autocvar_g_xonoticversion
Definition client.qh:46
int respawn_flags
Definition client.qh:320
const int RESPAWN_SILENT
Definition client.qh:327
bool autocvar_g_respawn_ghosts
Definition client.qh:28
bool autocvar_g_forced_respawn
Definition client.qh:43
string weaponorder_byimpulse
Definition client.qh:62
float autocvar_g_balance_pause_health_rot_spawn
Definition client.qh:15
string autocvar_sv_motd
Definition client.qh:52
bool autocvar_sv_servermodelsonly
Definition client.qh:55
int playerid
Definition client.qh:82
bool autocvar_sv_teamnagger
Definition client.qh:58
string autocvar_g_mutatormsg
Definition client.qh:35
bool autocvar_sv_spectate
Definition client.qh:57
#define INDEPENDENT_PLAYERS
Definition client.qh:311
bool autocvar_g_fullbrightplayers
Definition client.qh:17
const int MIN_SPEC_TIME
Definition client.qh:403
IntrusiveList g_observepoints
Definition client.qh:371
int team_selected
Definition client.qh:75
bool autocvar_g_botclip_collisions
Definition client.qh:16
float autocvar_sv_player_scale
Definition client.qh:59
bool just_joined
Definition client.qh:76
float autocvar_g_balance_pause_armor_rot_spawn
Definition client.qh:12
int autocvar_sv_maxidle_minplayers
Definition client.qh:38
IntrusiveList g_initforplayer
Definition client.qh:370
int autocvar_g_balance_armor_start
Definition client.qh:11
float autocvar_sv_maxidle_playertospectator
Definition client.qh:39
float autocvar_g_balance_pause_fuel_rot_spawn
Definition client.qh:13
bool autocvar__notarget
Definition client.qh:9
float autocvar_g_maxplayers_spectator_blocktime
Definition client.qh:45
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
string autocvar_hostname
Definition client.qh:50
const int RESPAWN_DENY
Definition client.qh:328
float jointime
Definition client.qh:66
float pauserotfuel_finished
Definition client.qh:340
float autocvar_g_respawn_ghosts_time
Definition client.qh:31
bool zoomstate
Definition client.qh:72
float respawn_time
Definition client.qh:321
float autocvar_g_respawn_ghosts_alpha
Definition client.qh:29
bool autocvar_sv_maxidle_slots_countbots
Definition client.qh:42
int autocvar_spawn_debug
Definition client.qh:51
bool autocvar_g_playerclip_collisions
Definition client.qh:18
bool autocvar_g_nodepthtestplayers
Definition client.qh:34
float pauseregen_finished
Definition client.qh:337
#define GAMETYPE_DEFAULTED_SETTING(str)
Definition client.qh:347
#define MAKE_INDEPENDENT_PLAYER(e)
Definition client.qh:313
int autocvar_g_maxplayers
Definition client.qh:44
float pauserothealth_finished
Definition client.qh:338
float autocvar_g_respawn_ghosts_speed
Definition client.qh:32
const int SVC_SETVIEW
Definition client.qh:334
float respawn_countdown
Definition client.qh:324
float autocvar_g_player_brightness
Definition client.qh:20
float autocvar_g_player_damageforcescale
Definition client.qh:21
float pauserotarmor_finished
Definition client.qh:339
float spectatortime
Definition client.qh:330
const int RESPAWN_FORCE
Definition client.qh:326
int autocvar_sv_name_maxlength
Definition client.qh:53
float autocvar_gameversion
Definition client.qh:47
int autocvar_sv_maxidle_slots
Definition client.qh:41
float autocvar_g_respawn_ghosts_fadetime
Definition client.qh:30
bool autocvar_sv_show_entnum
Definition client.qh:10
float autocvar_g_balance_pause_health_regen_spawn
Definition client.qh:14
entity clientdata
Definition client.qh:64
bool autocvar_sv_maxidle_alsokickspectators
Definition client.qh:40
float alivetime_start
Definition client.qh:68
bool autocvar_sv_showspectators
Definition client.qh:56
int autocvar_sv_timeout_number
Definition common.qh:8
vector lastV_angle
Definition common.qh:62
const float TIMEOUT_ACTIVE
Definition common.qh:49
void ReadyCount()
Definition vote.qc:553
void VoteCount(float first_count)
Definition vote.qc:220
void ReadyRestart(bool forceWarmupEnd)
Definition vote.qc:526
string autocvar_sv_vote_master_ids
Definition vote.qh:14
bool vote_master
Definition vote.qh:51
int vote_called
Definition vote.qh:45
void RemoveGrapplingHooks(entity pl)
Definition hook.qc:30
void ImpulseCommands(entity this)
Definition impulse.qc:371
int int number
Definition impulse.qc:89
void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, entity ammo_entity)
Give several random weapons and ammo to the entity.
Definition items.qc:440
float autocvar_g_balance_superweapons_time
Definition items.qh:7
float max_armorvalue
Definition items.qh:26
bool dropclient_schedule(entity this)
Schedules dropclient for a player and returns true; if dropclient is already scheduled (for that play...
Definition main.qc:44
bool autocvar_sv_autopause
Definition main.qh:19
int autocvar_g_balance_contents_playerdamage_drowning
Definition main.qh:5
vector oldvelocity
Definition main.qh:42
float autocvar_g_balance_contents_drowndelay
Definition main.qh:4
float autocvar_g_balance_contents_damagerate
Definition main.qh:3
bool iscreature
Definition main.qh:46
@ MUT_SPECPREV_RETURN
Definition events.qh:985
@ MUT_SPECPREV_CONTINUE
Definition events.qh:984
@ MUT_SPECPREV_FOUND
Definition events.qh:986
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition player.qc:234
void player_anim(entity this)
Definition player.qc:153
bool PlayerHeal(entity targ, entity inflictor, float amount, float limit)
Definition player.qc:615
void player_setupanimsformodel(entity this)
Definition player.qc:146
void CopyBody(entity this, float keepvelocity)
Definition player.qc:64
string autocvar_sv_defaultplayermodel_blue
Definition player.qh:14
int autocvar_sv_defaultplayerskin_pink
Definition player.qh:9
float score_frame_dmgtaken
Definition player.qh:26
float score_frame_dmg
Definition player.qh:25
int autocvar_sv_defaultplayerskin_yellow
Definition player.qh:11
string autocvar_sv_defaultplayermodel_yellow
Definition player.qh:17
string autocvar_sv_defaultplayermodel_red
Definition player.qh:16
string autocvar_sv_defaultplayercolors
Definition player.qh:12
bool autocvar_sv_defaultcharacter
Definition player.qh:6
int autocvar_sv_defaultplayerskin_blue
Definition player.qh:8
float autocvar_g_spawnshieldtime
Definition player.qh:3
int autocvar_sv_defaultplayerskin_red
Definition player.qh:10
int autocvar_sv_defaultplayerskin
Definition player.qh:18
string autocvar_sv_defaultplayermodel
Definition player.qh:13
string autocvar_sv_defaultplayermodel_pink
Definition player.qh:15
bool autocvar_sv_defaultcharacterskin
Definition player.qh:7
void race_SendNextCheckpoint(entity e, float spec)
Definition race.qc:209
bool autocvar_g_allow_checkpoints
Definition race.qh:3
float race_completed
Definition race.qh:26
int g_race_qualifying
Definition race.qh:13
bool SpawnEvent_Send(entity this, entity to, int sf)
entity SelectSpawnPoint(entity this, bool anypoint)
bool W_DualWielding(entity player)
Definition common.qc:20
float fade_time
Definition common.qh:23
void WarpZone_PlayerPhysics_FixVAngle(entity this)
Definition server.qc:865
const float VOL_BASEVOICE
Definition sound.qh:37
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const int CH_PLAYER_SINGLE
Definition sound.qh:21
const float VOL_BASE
Definition sound.qh:36
const int CH_INFO
Definition sound.qh:6
const int CH_VOICE
Definition sound.qh:10
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52
const int CH_PLAYER
Definition sound.qh:20
void play2(entity e, string filename)
Definition all.qc:116
void stopsound(entity e, int chan)
Definition all.qc:109
#define SND(id)
Definition all.qh:35
entity spawnpoint_targ
Definition spawnpoint.qh:4
void PlayerState_attach(entity this)
Definition state.qc:12
void bot_clientconnect(entity this)
Definition bot.qc:469
void ClientState_detach(entity this)
Definition state.qc:73
void PlayerState_detach(entity this)
Definition state.qc:22
void DecodeLevelParms(entity this)
Definition client.qc:986
#define CS_CVAR(this)
Definition state.qh:51
#define PS(this)
Definition state.qh:18
ClientState CS(Client this)
Definition state.qh:47
void StatusEffects_remove(StatusEffect this, entity actor, int removal_type)
float StatusEffects_gettime(StatusEffect this, entity actor)
bool StatusEffects_active(StatusEffect this, entity actor)
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
void ONREMOVE(entity this)
#define strfree(this)
Definition string.qh:59
ERASEABLE int vercmp(string v1, string v2)
Definition string.qh:557
#define strcpy(this, s)
Definition string.qh:52
ERASEABLE bool isInvisibleString(string s)
Definition string.qh:387
void SUB_SetFade(entity ent, float vanish_time, float fading_time)
Definition subs.qc:77
const int DAMAGE_NO
Definition subs.qh:79
const int DAMAGE_AIM
Definition subs.qh:81
float takedamage
Definition subs.qh:78
entity enemy
Definition sv_ctf.qh:153
bool MinigameImpulse(entity this, int imp)
void part_minigame(entity player)
void monsters_setstatus(entity this)
bool monster_attack
float spawn_time
IntrusiveList g_monster_targets
int oldskin
float g_nexball_meter_period
Definition sv_nexball.qh:54
float GetResourceLimit(entity e, Resource res_type)
Returns the maximum amount of the given resource.
Header file that describes the resource system.
float autocvar_g_balance_armor_rotlinear
int autocvar_g_balance_fuel_rotstable
float autocvar_g_balance_fuel_regen
float autocvar_g_balance_armor_regen
float autocvar_g_balance_fuel_regenlinear
float autocvar_g_balance_health_rotstable
float autocvar_g_balance_health_regenstable
int autocvar_g_balance_armor_regenstable
float autocvar_g_balance_health_rotlinear
float autocvar_g_balance_health_regenlinear
float autocvar_g_balance_fuel_rotlinear
int autocvar_g_balance_fuel_regenstable
float autocvar_g_balance_armor_rot
float autocvar_g_balance_health_regen
int autocvar_g_balance_armor_rotstable
float autocvar_g_balance_health_rot
float autocvar_g_balance_fuel_rot
float autocvar_g_balance_armor_regenlinear
#define INGAME(it)
Definition sv_rules.qh:24
#define GameRules_scoring_add(client, fld, value)
Definition sv_rules.qh:85
void vehicles_enter(entity pl, entity veh)
void vehicles_exit(entity vehic, bool eject)
const float vehicle_shield
If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehicle,...
const float vehicle_reload2
If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehicle,...
const float vehicle_ammo1
If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehicle,...
const float vehicle_health
const float vehicle_energy
If ent is player this is 0..100 indicating precentage of health left on vehicle. Vehicle's value is t...
const int VHEF_NORMAL
const int VHEF_RELEASE
User pressed exit key 3 times fast (not implemented) or vehicle is dying.
entity vehicle
Entity to disply the shild effect on damage.
const float vehicle_ammo2
If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehicle,...
float autocvar_g_vehicles_enter_radius
const float vehicle_reload1
If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already st...
entity swampslug
Definition swamp.qh:7
float swamp_interval
Definition swamp.qh:9
IntrusiveList g_swamped
Definition swamp.qh:4
bool QueuedPlayersReady(entity this, bool checkspecificteam)
Returns true when enough players are queued that the next will join directly to the only available te...
Definition teamplay.qc:238
bool TeamBalance_QueuedPlayersTagIn(entity ignore)
Joins queued player(s) to team(s) with a shortage, this should be more robust than only replacing the...
Definition teamplay.qc:775
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
Definition teamplay.qc:599
void TeamBalance_RemoveExcessPlayers(entity ignore)
Definition teamplay.qc:712
void Player_DetermineForcedTeam(entity player)
Determines the forced team of the player using current global config.
Definition teamplay.qc:348
void TeamBalance_JoinBestTeam(entity player)
Assigns the given player to a team that will make the game most balanced.
Definition teamplay.qc:423
bool Player_HasRealForcedTeam(entity player)
Returns whether player has real forced team.
Definition teamplay.qc:313
bool QueueNeeded(entity ignore)
Definition teamplay.qc:1325
bool SetPlayerTeam(entity player, int team_index, int type)
Sets the team of the player.
Definition teamplay.qc:255
int Player_GetForcedTeamIndex(entity player)
Returns the index of the forced team of the given player.
Definition teamplay.qc:318
int TeamBalance_GetAllowedTeams(entity balance)
Returns the bitmask of allowed teams.
Definition teamplay.qc:612
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
Definition teamplay.qc:459
bool TeamBalance_AreEqual(entity ignore, bool would_leave)
Definition teamplay.qc:656
string autocvar_g_forced_team_otherwise
Definition teamplay.qh:13
@ TEAM_FORCE_SPECTATOR
Force the player to spectator team.
Definition teamplay.qh:137
bool autocvar_g_balance_teams_remove
Definition teamplay.qh:10
@ TEAM_CHANGE_MANUAL
Player has manually selected their team.
Definition teamplay.qh:115
@ TEAM_CHANGE_SPECTATOR
Player is joining spectators. //TODO: Remove?
Definition teamplay.qh:116
bool autocvar_g_balance_teams
Definition teamplay.qh:7
bool lockteams
Definition teamplay.qh:15
#define SAME_TEAM(a, b)
Definition teams.qh:241
const int NUM_TEAM_2
Definition teams.qh:14
const int NUM_TEAM_4
Definition teams.qh:16
const int NUM_TEAM_3
Definition teams.qh:15
int Team_IndexToTeam(int index)
Converts team index into team value.
Definition teams.qh:169
bool teamplay
Definition teams.qh:59
const int NUM_TEAM_1
Definition teams.qh:13
const int TELEPORT_NORMAL
float teleportable
const int TELEPORT_SIMPLE
void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
Definition tracing.qc:559
float autocvar_g_trueaim_minrange
Definition tracing.qh:17
float autocvar_g_ballistics_density_player
Definition tracing.qh:7
#define IS_OBSERVER(v)
Definition utils.qh:11
#define IS_SPEC(v)
Definition utils.qh:10
const string STR_PLAYER
Definition utils.qh:5
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52
#define IS_VEHICLE(v)
Definition utils.qh:24
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition utils.qh:15
#define vlen2(v)
Definition vector.qh:4
#define vec2(...)
Definition vector.qh:90
const int VHF_MULTISLOT
Add random head angles each frame if health < 50%.
Definition vehicle.qh:96
int cursor_active
Definition view.qh:112
float dmg_take
Definition view.qh:123
void target_voicescript_next(entity pl)
void target_voicescript_clear(entity pl)
Definition voicescript.qc:8
void W_Vortex_Charge(entity actor,.entity weaponentity, float dt)
Definition vortex.qc:173
float vortex_charge_rottime
Definition vortex.qh:88
bool waypointeditor_enabled
Definition waypoints.qh:3
entity wp_aimed
Definition waypoints.qh:47
void WaypointSprite_PlayerGone(entity this)
void WaypointSprite_PlayerDead(entity this)
void WaypointSprite_UpdateHealth(entity e, float f)
entity waypointsprite_attachedforcarrier
void W_PROP_reload(int chan, entity to)
Definition all.qh:112
#define WEPSET(id)
Definition all.qh:45
string autocvar_g_shootfromfixedorigin
Definition all.qh:417
entity exteriorweaponentity
Definition all.qh:377
#define WEP_CVAR(wep, name)
Definition all.qh:321
WepSet WEPSET_SUPERWEAPONS
Definition all.qh:329
vector spawnorigin
Definition all.qh:391
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
const int WEP_FLAG_RELOADABLE
Definition weapon.qh:217
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
void W_WeaponFrame(Player actor,.entity weaponentity)
void CL_SpawnWeaponentity(entity actor,.entity weaponentity)
void W_ResetGunAlign(entity player, int preferred_alignment)
const int W_TICSPERFRAME
float weapon_load[REGISTRY_MAX(Weapons)]
float vortex_charge
Definition wepent.qh:6
Weapon m_weapon
Definition wepent.qh:26
WepSet start_weapons
Definition world.qh:80
float warmup_start_ammo_cells
Definition world.qh:105
string clientstuff
Definition world.qh:61
#define WARMUP_START_WEAPONS
Definition world.qh:101
entity random_start_ammo
Entity that contains amount of ammo to give with random start weapons.
Definition world.qh:95
string autocvar_g_random_start_weapons
Holds a list of possible random start weapons.
Definition world.qh:92
bool autocvar_g_jetpack
Definition world.qh:8
float start_ammo_shells
Definition world.qh:84
float warmup_start_ammo_rockets
Definition world.qh:104
float warmup_start_ammo_shells
Definition world.qh:102
float start_ammo_fuel
Definition world.qh:88
int start_items
Definition world.qh:83
bool autocvar_sv_mapformat_is_quake3
Definition world.qh:32
int random_start_weapons_count
Number of random start weapons to give to players.
Definition world.qh:90
float warmup_start_ammo_nails
Definition world.qh:103
float default_weapon_alpha
Definition world.qh:73
WepSet g_weaponarena_weapons
Definition world.qh:76
float default_player_alpha
Definition world.qh:72
float start_ammo_cells
Definition world.qh:87
string cache_lastmutatormsg
Definition world.qh:70
float g_weaponarena
Definition world.qh:75
float warmup_start_health
Definition world.qh:107
bool autocvar_sv_dedicated
Definition world.qh:41
float start_ammo_rockets
Definition world.qh:86
float g_weapon_stay
Definition world.qh:109
float start_armorvalue
Definition world.qh:97
int autocvar_g_warmup
Definition world.qh:9
bool observe_blocked_if_eliminated
Definition world.qh:160
float warmup_start_ammo_fuel
Definition world.qh:106
string g_weaponarena_list
Definition world.qh:78
float start_health
Definition world.qh:96
bool sv_ready_restart_after_countdown
Definition world.qh:116
float warmup_start_armorvalue
Definition world.qh:108
float start_ammo_nails
Definition world.qh:85
string cache_mutatormsg
Definition world.qh:69