1 .float wantswelcomemessage;
3 void info_player_survivor (void)
5 info_player_deathmatch();
8 void info_player_start (void)
10 info_player_deathmatch();
13 void info_player_deathmatch (void)
15 self.classname = "info_player_deathmatch";
16 relocate_spawnpoint();
19 void() spawnpoint_use =
24 self.team = activator.team;
25 some_spawn_has_been_used = 1;
31 entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindist, float teamcheck)
33 local entity spot, player, nextspot, previousspot, newfirstspot;
42 nextspot = spot.chain;
43 // count team mismatches as bad spots
45 local float spotactive;
48 // filter out spots for assault
49 if(spot.target != "") {
51 ent = find(world, targetname, spot.target);
53 if(ent.classname == "target_objective")
54 if(ent.health < 0 || ent.health >= ASSAULT_VALUE_INACTIVE)
56 ent = find(ent, targetname, spot.target);
60 if ((!teamcheck || spot.team == teamcheck) && spotactive > 0)
67 if (vlen(player.origin - spot.origin) < mindist)
69 player = player.chain;
75 previousspot.chain = spot;
82 spawn_allgood = FALSE;
86 // if we couldn't find ANY good points, return world
90 entity Spawn_RandomPoint(entity firstspot)
94 // count number of spots
99 numspots = numspots + 1;
103 numspots = numspots * random();
105 while (spot.chain && numspots >= 1)
107 numspots = numspots - 1;
113 entity Spawn_FurthestPoint(entity firstspot, entity playerlist)
115 local entity best, spot, player;
116 local float bestrating, rating;
118 bestrating = -1000000;
127 rating = min(rating, vlen(player.origin - spot.origin));
128 player = player.chain;
130 rating = rating + random() * 16;
131 if (bestrating < rating)
145 Finds a point to respawn
148 entity SelectSpawnPoint (float anypoint)
150 local float teamcheck;
151 local entity firstspot_new;
152 local entity spot, firstspot, playerlist;
154 spot = find (world, classname, "testplayerstart");
160 if(!anypoint && have_team_spawns)
161 teamcheck = self.team;
163 // get the list of players
164 playerlist = findchain(classname, "player");
165 // get the entire list of spots
166 firstspot = findchain(classname, "info_player_deathmatch");
167 // filter out the bad ones
168 // (note this returns the original list if none survived)
169 firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 100, teamcheck);
171 firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, -1, teamcheck);
172 firstspot = firstspot_new;
174 // there is 50/50 chance of choosing a random spot or the furthest spot
175 // (this means that roughly every other spawn will be furthest, so you
176 // usually won't get fragged at spawn twice in a row)
177 if (arena_roundbased)
179 firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 800, teamcheck);
181 firstspot = firstspot_new;
182 spot = Spawn_RandomPoint(firstspot);
184 else if (random() > 0.5 || spawn_allbad || spawn_allgood)
185 spot = Spawn_RandomPoint(firstspot);
187 spot = Spawn_FurthestPoint(firstspot, playerlist);
191 if(cvar("spawn_debug"))
195 if(some_spawn_has_been_used)
196 return world; // team can't spawn any more, because of actions of other team
198 error("Cannot find a spawn point - please fix the map!");
209 Checks if the argument string can be a valid playermodel.
210 Returns a valid one in doubt.
213 string FallbackPlayerModel = "models/player/marine.zym";
214 string CheckPlayerModel(string plyermodel) {
215 if(strlen(plyermodel) < 4)
216 return FallbackPlayerModel;
217 if( substring(plyermodel,0,14) != "models/player/")
218 return FallbackPlayerModel;
219 else if(cvar("sv_servermodelsonly"))
221 if(substring(plyermodel,strlen(plyermodel)-4,4) != ".zym")
222 if(substring(plyermodel,strlen(plyermodel)-4,4) != ".dpm")
223 if(substring(plyermodel,strlen(plyermodel)-4,4) != ".md3")
224 if(substring(plyermodel,strlen(plyermodel)-4,4) != ".psk")
225 return FallbackPlayerModel;
226 if(!fexists(plyermodel))
227 return FallbackPlayerModel;
234 Client_customizeentityforclient
239 float Client_customizeentityforclient()
241 #ifdef ALLOW_VARIABLE_LOD
243 // other: the player viewing me
247 if(self.flags & FL_NOTARGET) // we don't need LOD for spectators
250 if(other.cvar_cl_playerdetailreduction <= 0)
252 if(other.cvar_cl_playerdetailreduction <= -2)
253 self.modelindex = self.modelindex_lod2;
254 else if(other.cvar_cl_playerdetailreduction <= -1)
255 self.modelindex = self.modelindex_lod1;
257 self.modelindex = self.modelindex_lod0;
261 distance = vlen(self.origin - other.origin);
262 f = (distance + 100.0) * other.cvar_cl_playerdetailreduction;
264 self.modelindex = self.modelindex_lod2;
266 self.modelindex = self.modelindex_lod1;
268 self.modelindex = self.modelindex_lod0;
275 void UpdatePlayerSounds();
276 void setmodel_lod(entity e, string modelname)
278 #ifdef ALLOW_VARIABLE_LOD
281 // FIXME: this only supports 3-letter extensions
282 s = strcat(substring(modelname, 0, strlen(modelname) - 4), "_1", substring(modelname, 0, strlen(modelname) - 4));
286 setmodel(e, s); // players have high precision
287 self.modelindex_lod1 = self.modelindex;
290 self.modelindex_lod1 = -1;
292 s = strcat(substring(modelname, 0, strlen(modelname) - 4), "_2", substring(modelname, 0, strlen(modelname) - 4));
296 setmodel(e, s); // players have high precision
297 self.modelindex_lod2 = self.modelindex;
300 self.modelindex_lod2 = -1;
302 precache_model(modelname);
303 setmodel(e, modelname); // players have high precision
304 self.modelindex_lod0 = self.modelindex;
306 if(self.modelindex_lod1 < 0)
307 self.modelindex_lod1 = self.modelindex;
309 if(self.modelindex_lod2 < 0)
310 self.modelindex_lod2 = self.modelindex;
312 precache_model(modelname);
313 setmodel(e, modelname); // players have high precision
315 player_setupanimsformodel();
316 UpdatePlayerSounds();
323 putting a client as observer in the server
326 void PutObserverInServer (void)
329 spot = SelectSpawnPoint (TRUE);
331 error("No spawnpoints for observers?!?\n");
332 RemoveGrapplingHook(self); // Wazat's Grappling Hook
334 if(clienttype(self) == CLIENTTYPE_REAL)
337 WriteByte(MSG_ONE, SVC_SETVIEW);
338 WriteEntity(MSG_ONE, self);
342 kh_Key_DropAll(self, TRUE);
345 DropFlag(self.flagcarried);
347 WaypointSprite_PlayerDead();
349 DistributeFragsAmongTeam(self, self.team, 1);
351 if(self.frags <= 0 && self.frags > -666 && g_lms && self.killcount != -666)
352 bprint ("^4", self.netname, "^4 has no more lives left\n");
353 else if(self.killcount != -666)
354 bprint ("^4", self.netname, "^4 is spectating now\n");
356 self.spectatortime = time;
358 self.classname = "observer";
360 self.takedamage = DAMAGE_NO;
361 self.solid = SOLID_NOT;
362 self.movetype = MOVETYPE_NOCLIP;
363 self.flags = FL_CLIENT | FL_NOTARGET;
364 self.armorvalue = 666;
366 self.armorvalue = cvar("g_balance_armor_start");
367 self.pauserotarmor_finished = 0;
368 self.pauserothealth_finished = 0;
369 self.pauseregen_finished = 0;
370 self.damageforcescale = 0;
378 self.pain_finished = 0;
379 self.strength_finished = 0;
380 self.invincible_finished = 0;
382 self.think = SUB_Null;
386 self.deadflag = DEAD_NO;
387 self.angles = spot.angles;
389 self.fixangle = TRUE;
392 self.view_ofs = PL_VIEW_OFS;
393 setorigin (self, spot.origin);
394 setsize (self, '0 0 0', '0 0 0');
395 self.oldorigin = self.origin;
400 self.weaponmodel = "";
401 self.weaponentity = world;
402 self.killcount = -666;
403 self.velocity = '0 0 0';
404 self.avelocity = '0 0 0';
405 self.punchangle = '0 0 0';
406 self.punchvector = '0 0 0';
407 self.oldvelocity = self.velocity;
408 self.customizeentityforclient = Client_customizeentityforclient;
410 self.wantswelcomemessage = 1;
416 Spawnqueue_Insert(self);
420 Spawnqueue_Unmark(self);
421 Spawnqueue_Remove(self);
428 float RestrictSkin(float s)
437 void FixPlayermodel()
439 local string defaultmodel;
440 local float defaultskin;
445 if(cvar("sv_defaultcharacter") == 1) {
450 defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", Team_ColorNameLowerCase(self.team)));
451 defaultskin = cvar(strcat("sv_defaultplayerskin_", Team_ColorNameLowerCase(self.team)));
454 if(defaultmodel == "")
456 defaultmodel = cvar_string("sv_defaultplayermodel");
457 defaultskin = cvar("sv_defaultplayerskin");
461 if(defaultmodel != "")
463 if (defaultmodel != self.model)
467 setmodel_lod (self, defaultmodel);
468 setsize (self, m1, m2);
471 self.skin = defaultskin;
473 if (self.playermodel != self.model)
475 self.playermodel = CheckPlayerModel(self.playermodel);
478 setmodel_lod (self, self.playermodel);
479 setsize (self, m1, m2);
482 self.skin = RestrictSkin(stof(self.playerskin));
486 if(strlen(cvar_string("sv_defaultplayercolors")))
487 if(self.clientcolors != cvar("sv_defaultplayercolors"))
488 setcolor(self, cvar("sv_defaultplayercolors"));
495 Called when a client spawns in the server
498 void PutClientInServer (void)
500 if(clienttype(self) == CLIENTTYPE_BOT)
502 self.classname = "player";
504 else if(clienttype(self) == CLIENTTYPE_REAL)
507 WriteByte(MSG_ONE, SVC_SETVIEW);
508 WriteEntity(MSG_ONE, self);
511 // player is dead and becomes observer
512 if(g_lms && self.frags < 1)
513 self.classname = "observer";
517 self.classname = "observer";
519 if(self.classname == "player") {
522 spot = SelectSpawnPoint (FALSE);
525 centerprint(self, "Sorry, no spawnpoints available!\nHope your team can fix it...");
526 return; // spawn failed
529 RemoveGrapplingHook(self); // Wazat's Grappling Hook
531 self.classname = "player";
532 self.iscreature = TRUE;
533 self.movetype = MOVETYPE_WALK;
534 self.solid = SOLID_SLIDEBOX;
535 self.flags = FL_CLIENT;
536 self.takedamage = DAMAGE_AIM;
538 self.effects = EF_FULLBRIGHT;
541 self.air_finished = time + 12;
544 self.ammo_shells = start_ammo_shells;
545 self.ammo_nails = start_ammo_nails;
546 self.ammo_rockets = start_ammo_rockets;
547 self.ammo_cells = start_ammo_cells;
548 self.health = start_health;
549 self.armorvalue = start_armorvalue;
550 self.items = start_items;
551 self.switchweapon = start_switchweapon;
552 self.cnt = start_switchweapon;
554 self.jump_interval = time;
556 self.spawnshieldtime = time + cvar("g_spawnshieldtime");
557 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
558 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
559 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
560 //extend the pause of rotting if client was reset at the beginning of the countdown
561 if(!cvar("sv_ready_restart_after_countdown") && time < restart_countdown) {
562 self.spawnshieldtime += RESTART_COUNTDOWN;
563 self.pauserotarmor_finished += RESTART_COUNTDOWN;
564 self.pauserothealth_finished += RESTART_COUNTDOWN;
565 self.pauseregen_finished += RESTART_COUNTDOWN;
567 self.damageforcescale = 2;
574 self.pain_finished = 0;
575 self.strength_finished = 0;
576 self.invincible_finished = 0;
578 //self.speed_finished = 0;
579 //self.slowmo_finished = 0;
580 // players have no think function
581 self.think = SUB_Null;
587 self.deadflag = DEAD_NO;
589 self.angles = spot.angles;
591 self.angles_z = 0; // never spawn tilted even if the spot says to
592 self.fixangle = TRUE; // turn this way immediately
593 self.velocity = '0 0 0';
594 self.avelocity = '0 0 0';
595 self.punchangle = '0 0 0';
596 self.punchvector = '0 0 0';
597 self.oldvelocity = self.velocity;
602 self.customizeentityforclient = Client_customizeentityforclient;
608 self.view_ofs = PL_VIEW_OFS;
609 setsize (self, PL_MIN, PL_MAX);
610 self.spawnorigin = spot.origin;
611 setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24));
612 // don't reset back to last position, even if new position is stuck in solid
613 self.oldorigin = self.origin;
617 Spawnqueue_Remove(self);
618 Spawnqueue_Mark(self);
621 self.event_damage = PlayerDamage;
623 self.bot_attack = TRUE;
625 self.statdraintime = time + 5;
626 self.button0 = self.button1 = self.button2 = self.button3 = 0;
628 if(self.killcount == -666) {
635 self.cnt = WEP_LASER;
636 self.nixnex_lastchange_id = -1;
638 CL_SpawnWeaponentity();
639 self.alpha = default_player_alpha;
640 self.colormod = '1 1 1' * cvar("g_player_brightness");
641 self.exteriorweaponentity.alpha = default_weapon_alpha;
643 self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2;
644 self.lms_traveled_distance = 0;
645 self.speedrunning = FALSE;
647 if(cvar("spawn_debug"))
649 sprint(self, strcat("spawnpoint origin: ", vtos(spot.origin), "\n"));
650 remove(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
653 //stuffcmd(self, "chase_active 0");
654 //stuffcmd(self, "set viewsize $tmpviewsize \n");
656 if (cvar("g_spawnsound"))
657 sound (self, CHAN_AUTO, "misc/spawn.wav", 1, ATTN_NORM);
660 if(self.team == assault_attacker_team)
661 centerprint(self, "You are attacking!\n");
663 centerprint(self, "You are defending!\n");
666 } else if(self.classname == "observer") {
667 PutObserverInServer ();
676 void SetNewParms (void)
686 void SetChangeParms (void)
695 Called when a client types 'kill' in the console
699 void ClientKill_Now_TeamChange()
701 if(self.killindicator_teamchange == -1)
704 JoinBestTeam( self, FALSE, FALSE );
708 SV_ChangeTeam(self.killindicator_teamchange - 1);
712 void ClientKill_Now()
714 if(self.killindicator_teamchange)
715 ClientKill_Now_TeamChange();
718 Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0');
720 void KillIndicator_Think()
722 if (!self.owner.modelindex)
724 self.owner.killindicator = world;
732 ClientKill_Now(); // no oldself needed
739 setmodel(self, strcat("models/sprites/", ftos(self.cnt), ".spr32"));
740 play2(self.owner, strcat("announcer/robotic/", ftos(self.cnt), ".ogg"));
742 if(self.owner.killindicator_teamchange)
744 if(self.owner.killindicator_teamchange == -1)
745 centerprint(self.owner, strcat("Changing team in ", ftos(self.cnt), " seconds"));
747 centerprint(self.owner, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds"));
750 centerprint(self.owner, strcat("^1Suicide in ", ftos(self.cnt), " seconds"));
751 self.nextthink = time + 1;
756 void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto
759 killtime = cvar("g_balance_kill_delay");
761 self.killindicator_teamchange = targetteam;
763 if(!self.killindicator)
765 if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO)
771 self.killindicator = spawn();
772 self.killindicator.owner = self;
773 self.killindicator.scale = 0.5;
774 setattachment(self.killindicator, self, "");
775 setorigin(self.killindicator, '0 0 52');
776 self.killindicator.think = KillIndicator_Think;
777 self.killindicator.nextthink = time;
778 self.killindicator.cnt = ceil(killtime);
779 sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
782 if(self.killindicator)
785 self.killindicator.colormod = TeamColor(targetteam);
787 self.killindicator.colormod = '0 0 0';
791 void ClientKill (void)
793 ClientKill_TeamChange(0);
796 void DoTeamChange(float destteam)
798 if(!cvar("teamplay"))
801 SetPlayerColors(self, destteam);
804 if(destteam == self.team && !self.killindicator)
806 ClientKill_TeamChange(destteam);
809 void FixClientCvars(entity e)
811 // send prediction settings to the client
812 stuffcmd(e, "\nin_bindmap 0 0\n");
814 * we no longer need to stuff this. Remove this comment block if you feel
815 * 2.3 and higher (or was it 2.2.3?) don't need these any more
816 stuffcmd(e, strcat("cl_gravity ", ftos(cvar("sv_gravity")), "\n"));
817 stuffcmd(e, strcat("cl_movement_accelerate ", ftos(cvar("sv_accelerate")), "\n"));
818 stuffcmd(e, strcat("cl_movement_friction ", ftos(cvar("sv_friction")), "\n"));
819 stuffcmd(e, strcat("cl_movement_maxspeed ", ftos(cvar("sv_maxspeed")), "\n"));
820 stuffcmd(e, strcat("cl_movement_airaccelerate ", ftos(cvar("sv_airaccelerate")), "\n"));
821 stuffcmd(e, strcat("cl_movement_maxairspeed ", ftos(cvar("sv_maxairspeed")), "\n"));
822 stuffcmd(e, strcat("cl_movement_stopspeed ", ftos(cvar("sv_stopspeed")), "\n"));
823 stuffcmd(e, strcat("cl_movement_jumpvelocity ", ftos(cvar("sv_jumpvelocity")), "\n"));
824 stuffcmd(e, strcat("cl_movement_stepheight ", ftos(cvar("sv_stepheight")), "\n"));
825 stuffcmd(e, strcat("set cl_movement_friction_on_land ", ftos(cvar("sv_friction_on_land")), "\n"));
826 stuffcmd(e, strcat("set cl_movement_airaccel_qw ", ftos(cvar("sv_airaccel_qw")), "\n"));
827 stuffcmd(e, strcat("set cl_movement_airaccel_sideways_friction ", ftos(cvar("sv_airaccel_sideways_friction")), "\n"));
828 stuffcmd(e, "cl_movement_edgefriction 1\n");
836 Called when a client connects to the server
839 string ColoredTeamName(float t);
840 //void dom_player_join_team(entity pl);
841 void ClientConnect (void)
846 if(Ban_IsClientBanned(self))
848 s = strcat("^1NOTE:^7 banned client ", self.netaddress, " just tried to enter\n");
854 self.classname = "player_joining";
855 self.flags = self.flags | FL_CLIENT;
856 self.version_nagtime = time + 10 + random() * 10;
860 dprint("BUG player count is lower than zero, this cannot happen!\n");
867 // dom_player_join_team(self);
869 //JoinBestTeam(self, FALSE, FALSE);
871 if((cvar("sv_spectate") == 1 && !g_lms) || cvar("g_campaign")) {
872 self.classname = "observer";
874 self.classname = "player";
875 campaign_bots_may_start = 1;
878 self.playerid = (playerid_last = playerid_last + 1);
879 if(cvar("sv_eventlog"))
881 if(clienttype(self) == CLIENTTYPE_REAL)
885 GameLogEcho(strcat(":join:", ftos(self.playerid), ":", s, ":", self.netname), TRUE);
886 s = strcat(":team:", ftos(self.playerid), ":");
887 s = strcat(s, ftos(self.team));
888 GameLogEcho(s, FALSE);
891 //stuffcmd(self, "set tmpviewsize $viewsize \n");
893 bprint ("^4",self.netname);
894 bprint ("^4 connected");
896 if(g_domination || g_ctf)
898 bprint(" and joined the ");
899 bprint(ColoredTeamName(self.team));
904 self.welcomemessage_time = 0;
906 stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n"));
907 // TODO: is this being used for anything else than cd tracks?
908 // Remember: SVC_CDTRACK exists. Maybe it should be used.
910 stuffcmd(self, "cl_particles_reloadeffects\n");
912 FixClientCvars(self);
915 WaypointSprite_InitClient(self);
917 // Wazat's grappling hook
918 SetGrappleHookBindings();
920 // get autoswitch state from player when he toggles it
921 stuffcmd(self, "alias autoswitch \"set cl_autoswitch $1 ; cmd autoswitch $1\"\n"); // default.cfg-ed in 2.4.1
923 // get version info from player
924 stuffcmd(self, "cmd clientversion $gameversion\n");
926 // send all weapon info strings
927 stuffcmd(self, "register_bestweapon clear\n"); // clear the Quake stuff
929 while (wep <= WEP_LAST)
931 weapon_action(wep, WR_REGISTER);
935 // get other cvars from player
938 // set cvar for team scoreboard
942 t = cvar("teamplay");
943 // we have to stuff the correct teamplay value because if this is a listen server, this changes the teamplay mode of the server itself, which is bad
944 stuffcmd(self, strcat("set teamplay ", ftos(t), "\n"));
947 stuffcmd(self, "set teamplay 0\n");
949 // notify about available teams
952 CheckAllowedTeams(self);
953 t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8;
954 stuffcmd(self, strcat("set _teams_available ", ftos(t), "\n"));
957 stuffcmd(self, "set _teams_available 0\n");
959 stuffcmd(self, strcat("set gametype ", ftos(game), "\n"));
963 self.frags = LMS_NewPlayerLives();
969 self.classname = "observer";
970 Spawnqueue_Insert(self);
973 bot_relinkplayerlist();
975 self.spectatortime = time;
978 sprint(self, strcat("^7You have to become a player within the next ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n"));
981 self.jointime = time;
988 Called when a client disconnects from the server
991 void(entity e) DropFlag;
992 .entity chatbubbleentity;
993 .entity teambubbleentity;
994 void ClientDisconnect (void)
997 if(cvar("sv_eventlog"))
998 GameLogEcho(strcat(":part:", ftos(self.playerid)), FALSE);
999 bprint ("^4",self.netname);
1000 bprint ("^4 disconnected\n");
1002 if (self.chatbubbleentity)
1004 remove (self.chatbubbleentity);
1005 self.chatbubbleentity = world;
1008 if (self.teambubbleentity)
1010 remove (self.teambubbleentity);
1011 self.teambubbleentity = world;
1014 if (self.killindicator)
1016 remove (self.killindicator);
1017 self.killindicator = world;
1020 WaypointSprite_PlayerGone();
1023 kh_Key_DropAll(self, TRUE);
1025 if(self.flagcarried)
1026 DropFlag(self.flagcarried);
1028 DistributeFragsAmongTeam(self, self.team, 1);
1031 self.flags = self.flags - (self.flags & FL_CLIENT);
1032 bot_relinkplayerlist();
1036 if(self.weaponentity)
1037 if(self.weaponentity.lasertarget)
1038 remove(self.weaponentity.lasertarget);
1042 Spawnqueue_Unmark(self);
1043 Spawnqueue_Remove(self);
1051 void() ChatBubbleThink =
1053 self.nextthink = time;
1054 if (!self.owner.modelindex || self.owner.chatbubbleentity != self)
1056 self.owner.chatbubbleentity = world;
1060 setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1');
1061 if (self.owner.buttonchat && !self.owner.deadflag)
1062 self.model = self.mdl;
1067 void() UpdateChatBubble =
1069 if (!self.modelindex)
1071 // spawn a chatbubble entity if needed
1072 if (!self.chatbubbleentity)
1074 self.chatbubbleentity = spawn();
1075 self.chatbubbleentity.owner = self;
1076 self.chatbubbleentity.exteriormodeltoclient = self;
1077 self.chatbubbleentity.think = ChatBubbleThink;
1078 self.chatbubbleentity.nextthink = time;
1079 setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); // precision set below
1080 setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
1081 self.chatbubbleentity.mdl = self.chatbubbleentity.model;
1082 self.chatbubbleentity.model = "";
1083 self.chatbubbleentity.effects = EF_LOWPRECISION;
1088 void() TeamBubbleThink =
1090 self.nextthink = time;
1091 if (!self.owner.modelindex || self.owner.teambubbleentity != self)
1093 self.owner.teambubbleentity = world;
1097 // setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); // bandwidth hog. setattachment does this now
1098 if (self.owner.buttonchat || self.owner.deadflag || self.owner.killindicator)
1101 self.model = self.mdl;
1105 float() TeamBubble_customizeentityforclient
1107 return (self.owner != other && self.owner.team == other.team && other.killcount > -666);
1110 void() UpdateTeamBubble =
1112 if (!self.modelindex || !cvar("teamplay"))
1114 // spawn a teambubble entity if needed
1115 if (!self.teambubbleentity && cvar("teamplay"))
1117 self.teambubbleentity = spawn();
1118 self.teambubbleentity.owner = self;
1119 self.teambubbleentity.exteriormodeltoclient = self;
1120 self.teambubbleentity.think = TeamBubbleThink;
1121 self.teambubbleentity.nextthink = time;
1122 setmodel(self.teambubbleentity, "models/misc/teambubble.spr"); // precision set below
1123 // setorigin(self.teambubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
1124 setorigin(self.teambubbleentity, self.teambubbleentity.origin + '0 0 15' + self.maxs_z * '0 0 1');
1125 setattachment(self.teambubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
1126 self.teambubbleentity.mdl = self.teambubbleentity.model;
1127 self.teambubbleentity.model = self.teambubbleentity.mdl;
1128 self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient;
1129 self.teambubbleentity.effects = EF_LOWPRECISION;
1133 // LordHavoc: this hack will be removed when proper _pants/_shirt layers are
1134 // added to the model skins
1135 /*void() UpdateColorModHack =
1138 c = self.clientcolors & 15;
1139 // LordHavoc: only bothering to support white, green, red, yellow, blue
1140 if (teamplay == 0) self.colormod = '0 0 0';
1141 else if (c == 0) self.colormod = '1.00 1.00 1.00';
1142 else if (c == 3) self.colormod = '0.10 1.73 0.10';
1143 else if (c == 4) self.colormod = '1.73 0.10 0.10';
1144 else if (c == 12) self.colormod = '1.22 1.22 0.10';
1145 else if (c == 13) self.colormod = '0.10 0.10 1.73';
1146 else self.colormod = '1 1 1';
1152 self.effects |= EF_NODRAW; // prevent another CopyBody
1153 PutClientInServer();
1156 void player_powerups (void)
1160 if (self.items & IT_STRENGTH)
1162 if (time > self.strength_finished)
1164 if (g_minstagib_invis_alpha > 0)
1166 self.alpha = default_player_alpha;
1167 self.exteriorweaponentity.alpha = default_weapon_alpha;
1168 self.effects = self.effects | EF_FULLBRIGHT;
1172 self.effects -= self.effects & EF_NODRAW;
1174 self.items = self.items - (self.items & IT_STRENGTH);
1175 sprint(self, "^3Invisibility has worn off\n");
1180 if (time < self.strength_finished)
1182 if (g_minstagib_invis_alpha > 0)
1184 self.alpha = g_minstagib_invis_alpha;
1185 self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
1186 self.effects -= self.effects & EF_FULLBRIGHT;
1190 self.effects = self.effects | EF_NODRAW;
1192 self.items = self.items | IT_STRENGTH;
1193 sprint(self, "^3You are invisible\n");
1197 if (self.items & IT_INVINCIBLE)
1199 if (time > self.invincible_finished)
1201 self.items = self.items - (self.items & IT_INVINCIBLE);
1202 sprint(self, "^3Speed has worn off\n");
1207 if (time < self.invincible_finished)
1209 self.items = self.items | IT_INVINCIBLE;
1210 sprint(self, "^3You are on speed\n");
1216 self.effects = self.effects - (self.effects & (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT));
1217 if (self.items & IT_STRENGTH)
1219 self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
1220 if (time > self.strength_finished)
1222 self.items = self.items - (self.items & IT_STRENGTH);
1223 sprint(self, "^3Strength has worn off\n");
1228 if (time < self.strength_finished)
1230 self.items = self.items | IT_STRENGTH;
1231 sprint(self, "^3Strength infuses your weapons with devastating power\n");
1234 if (self.items & IT_INVINCIBLE)
1236 self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
1237 if (time > self.invincible_finished)
1239 self.items = self.items - (self.items & IT_INVINCIBLE);
1240 sprint(self, "^3Shield has worn off\n");
1245 if (time < self.invincible_finished)
1247 self.items = self.items | IT_INVINCIBLE;
1248 sprint(self, "^3Shield surrounds you\n");
1252 if (cvar("g_fullbrightplayers"))
1253 self.effects = self.effects | EF_FULLBRIGHT;
1255 // midair gamemode: damage only while in the air
1256 // if in midair mode, being on ground grants temporary invulnerability
1257 // (this is so that multishot weapon don't clear the ground flag on the
1258 // first damage in the frame, leaving the player vulnerable to the
1259 // remaining hits in the same frame)
1260 if (self.flags & FL_ONGROUND)
1262 self.spawnshieldtime = max(self.spawnshieldtime, time + cvar("g_midair_shieldtime"));
1264 if (time < self.spawnshieldtime)
1265 self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
1268 float CalcRegen(float current, float stable, float regenfactor)
1270 if(current > stable)
1272 else if(current > stable - 0.25) // when close enough, "snap"
1275 return min(stable, current + (stable - current) * regenfactor * frametime);
1278 void player_regen (void)
1280 float maxh, maxa, limith, limita, max_mod, regen_mod, rot_mod, limit_mod;
1281 maxh = cvar("g_balance_health_stable");
1282 maxa = cvar("g_balance_armor_stable");
1283 limith = cvar("g_balance_health_limit");
1284 limita = cvar("g_balance_armor_limit");
1286 if (g_minstagib || (g_lms && !cvar("g_lms_regenerate")))
1289 max_mod = regen_mod = rot_mod = limit_mod = 1;
1291 if (self.runes & RUNE_REGEN)
1293 if (self.runes & CURSE_VENOM) // do we have both rune/curse?
1295 regen_mod = cvar("g_balance_rune_regen_combo_regenrate");
1296 max_mod = cvar("g_balance_rune_regen_combo_hpmod");
1297 limit_mod = cvar("g_balance_rune_regen_combo_limitmod");
1301 regen_mod = cvar("g_balance_rune_regen_regenrate");
1302 max_mod = cvar("g_balance_rune_regen_hpmod");
1303 limit_mod = cvar("g_balance_rune_regen_limitmod");
1306 else if (self.runes & CURSE_VENOM)
1308 max_mod = cvar("g_balance_curse_venom_hpmod");
1309 if (self.runes & RUNE_REGEN) // do we have both rune/curse?
1310 rot_mod = cvar("g_balance_rune_regen_combo_rotrate");
1312 rot_mod = cvar("g_balance_curse_venom_rotrate");
1313 limit_mod = cvar("g_balance_curse_venom_limitmod");
1314 //if (!self.runes & RUNE_REGEN)
1315 // rot_mod = cvar("g_balance_curse_venom_rotrate");
1317 maxh = maxh * max_mod;
1318 //maxa = maxa * max_mod;
1319 limith = limith * limit_mod;
1320 limita = limita * limit_mod;
1322 if (self.armorvalue > maxa)
1324 if (time > self.pauserotarmor_finished)
1326 self.armorvalue = max(maxa, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime);
1327 self.armorvalue = max(maxa, self.armorvalue - cvar("g_balance_armor_rotlinear") * frametime);
1330 else if (self.armorvalue < maxa)
1332 if (time > self.pauseregen_finished)
1334 self.armorvalue = CalcRegen(self.armorvalue, maxa, cvar("g_balance_armor_regen"));
1335 self.armorvalue = min(maxa, self.armorvalue + cvar("g_balance_armor_regenlinear") * frametime);
1338 if (self.health > maxh)
1340 if (time > self.pauserothealth_finished)
1342 self.health = max(maxh, self.health + (maxh - self.health) * rot_mod*cvar("g_balance_health_rot") * frametime);
1343 self.health = max(maxh, self.health - rot_mod*cvar("g_balance_health_rotlinear") * frametime);
1346 else if (self.health < maxh)
1348 if (time > self.pauseregen_finished)
1350 self.health = CalcRegen(self.health, maxh, regen_mod * cvar("g_balance_health_regen"));
1351 self.health = min(maxh, self.health + regen_mod*cvar("g_balance_health_regenlinear") * frametime);
1355 if (self.health > limith)
1356 self.health = limith;
1357 if (self.armorvalue > limita)
1358 self.armorvalue = limita;
1360 // if player rotted to death... die!
1362 self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
1366 ======================
1367 spectate mode routines
1368 ======================
1370 void SpectateCopy(entity spectatee) {
1371 self.armortype = spectatee.armortype;
1372 self.armorvalue = spectatee.armorvalue;
1373 self.currentammo = spectatee.currentammo;
1374 self.effects = spectatee.effects;
1375 self.health = spectatee.health;
1377 self.items = spectatee.items;
1378 self.punchangle = spectatee.punchangle;
1379 self.view_ofs = spectatee.view_ofs;
1380 self.v_angle = spectatee.v_angle;
1381 self.viewzoom = spectatee.viewzoom;
1382 self.velocity = spectatee.velocity;
1383 self.dmg_take = spectatee.dmg_take;
1384 self.dmg_save = spectatee.dmg_save;
1385 self.dmg_inflictor = spectatee.dmg_inflictor;
1386 self.angles = spectatee.v_angle;
1387 self.fixangle = TRUE;
1388 setorigin(self, spectatee.origin);
1389 setsize(self, spectatee.mins, spectatee.maxs);
1392 void SpectateUpdate() {
1394 PutObserverInServer();
1396 if (self != self.enemy) {
1397 if(self.enemy.flags & FL_NOTARGET)
1398 PutObserverInServer();
1399 SpectateCopy(self.enemy);
1400 //msg_entity = self;
1401 //WriteByte(MSG_ONE, SVC_SETANGLE);
1402 //WriteAngle(MSG_ONE, self.enemy.v_angle_x);
1403 //WriteAngle(MSG_ONE, self.enemy.v_angle_y);
1404 //WriteAngle(MSG_ONE, self.enemy.v_angle_z);
1408 float SpectateNext() {
1409 other = find(self.enemy, classname, "player");
1411 other = find(other, classname, "player");
1416 if(self.enemy.classname == "player") {
1418 WriteByte(MSG_ONE, SVC_SETVIEW);
1419 WriteEntity(MSG_ONE, self.enemy);
1420 self.wantswelcomemessage = 1;
1421 //stuffcmd(self, "set viewsize $tmpviewsize \n");
1431 ShowRespawnCountdown()
1433 Update a respawn countdown display.
1436 void ShowRespawnCountdown()
1439 if(self.deadflag == DEAD_NO) // just respawned?
1443 number = ceil(self.death_time - time);
1446 if(number <= self.respawn_countdown)
1448 self.respawn_countdown = number - 1;
1449 if(ceil(self.death_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
1450 play2(self, strcat("announcer/robotic/", ftos(number), ".ogg"));
1455 void LeaveSpectatorMode()
1457 if(isJoinAllowed()) {
1458 if(!cvar("teamplay") || cvar("g_campaign") || cvar("g_balance_teams")) {
1459 self.classname = "player";
1460 if(cvar("g_campaign") || cvar("g_balance_teams") || cvar("g_balance_teams_force"))
1461 JoinBestTeam(self, FALSE, TRUE);
1462 if(cvar("g_campaign"))
1463 campaign_bots_may_start = 1;
1464 PutClientInServer();
1465 if(!(self.flags & FL_NOTARGET))
1466 bprint ("^4", self.netname, "^4 is playing now\n");
1467 centerprint(self,"");
1470 stuffcmd(self,"menu_showteamselect\n");
1475 //player may not join because of g_maxplayers is set
1476 centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT);
1481 * Determines whether the player is allowed to join. This depends on cvar
1482 * g_maxplayers, if it isn't used this function always return TRUE, otherwise
1483 * it checks whether the number of currently playing players exceeds g_maxplayers.
1484 * @return bool TRUE if the player is allowed to join, false otherwise
1486 float isJoinAllowed() {
1487 if (!cvar("g_maxplayers"))
1491 local float currentlyPlaying;
1492 FOR_EACH_REALPLAYER(e) {
1493 if(e.classname == "player")
1494 currentlyPlaying += 1;
1496 if(currentlyPlaying < cvar("g_maxplayers"))
1503 * Checks whether the client is an observer or spectator, if so, he will get kicked after
1504 * g_maxplayers_spectator_blocktime seconds
1506 void checkSpectatorBlock() {
1507 if(self.classname == "spectator" || self.classname == "observer") {
1508 if( time > (self.spectatortime + cvar("g_maxplayers_spectator_blocktime")) ) {
1509 sprint(self, "^7You were kicked from the server because you are spectator and spectators aren't allowed at the moment.\n");
1519 Called every frame for each client before the physics are run
1522 void() ctf_setstatus;
1523 .float vote_nagtime;
1524 void PlayerPreThink (void)
1527 checkSpectatorBlock();
1530 if(self.version_nagtime)
1531 if(self.cvar_g_nexuizversion)
1532 if(time > self.version_nagtime)
1534 if(strstr(self.cvar_g_nexuizversion, "svn", 0) < 0)
1535 if(self.cvar_g_nexuizversion != cvar_string("g_nexuizversion"))
1537 dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "\n");
1538 sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "\n"));
1540 self.version_nagtime = 0;
1544 if(self.cvar_scr_centertime)
1545 if(time > self.vote_nagtime)
1548 self.vote_nagtime = time + self.cvar_scr_centertime * 0.6;
1552 if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
1554 sprint(self, strcat("godmode saved you ", ftos(self.max_armorvalue), " units of damage, cheater!\n"));
1555 self.max_armorvalue = 0;
1559 antilag_record(self);
1561 if(self.classname == "player") {
1562 // if(self.netname == "Wazat")
1563 // bprint(self.classname, "\n");
1565 CheckRules_Player();
1568 PrintWelcomeMessage(self);
1570 if(g_lms || !cvar("sv_spectate"))
1571 if((time - self.jointime) <= cvar("welcome_message_time"))
1572 PrintWelcomeMessage(self);
1574 if (intermission_running)
1576 IntermissionThink (); // otherwise a button could be missed between
1577 return; // the think tics
1580 if(self.teleport_time)
1581 if(time > self.teleport_time)
1583 self.teleport_time = 0;
1584 self.effects = self.effects - (self.effects & EF_NODRAW);
1585 if(self.weaponentity)
1586 self.weaponentity.flags = self.weaponentity.flags - (self.weaponentity.flags & EF_NODRAW);
1589 Nixnex_GiveCurrentWeapon();
1591 if(frametime > 0) // don't do this in cl_movement frames, just in server ticks
1592 UpdateSelectedPlayer();
1594 if (self.deadflag != DEAD_NO)
1596 float button_pressed, force_respawn;
1598 button_pressed = (self.button0 || self.button2 || self.button3 || self.button6 || self.buttonuse);
1599 force_respawn = (g_lms || cvar("g_forced_respawn"));
1600 if (self.deadflag == DEAD_DYING)
1603 self.deadflag = DEAD_RESPAWNING;
1604 else if(!button_pressed)
1605 self.deadflag = DEAD_DEAD;
1607 else if (self.deadflag == DEAD_DEAD)
1610 self.deadflag = DEAD_RESPAWNABLE;
1612 else if (self.deadflag == DEAD_RESPAWNABLE)
1615 self.deadflag = DEAD_RESPAWNING;
1617 else if (self.deadflag == DEAD_RESPAWNING)
1619 if(time > self.death_time)
1621 self.death_time = time + 1; // only retry once a second
1625 ShowRespawnCountdown();
1629 if(g_lms && !self.deadflag && cvar("g_lms_campcheck_interval"))
1633 // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
1634 dist = self.oldorigin - self.origin;
1636 self.lms_traveled_distance += fabs(vlen(dist));
1638 if((cvar("g_campaign") && !campaign_bots_may_start) || (time < restart_countdown))
1640 self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2;
1641 self.lms_traveled_distance = 0;
1644 if(time > self.lms_nextcheck)
1646 //sprint(self, "distance: ", ftos(self.lms_traveled_distance), "\n");
1647 if(self.lms_traveled_distance < cvar("g_lms_campcheck_distance"))
1649 centerprint(self, cvar_string("g_lms_campcheck_message"));
1650 // FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3
1651 // I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :(
1652 Damage(self, self, self, bound(0, cvar("g_lms_campcheck_damage"), self.health + self.armorvalue * cvar("g_balance_armor_blockpercent") + 5), DEATH_CAMP, self.origin, '0 0 0');
1654 self.lms_nextcheck = time + cvar("g_lms_campcheck_interval");
1655 self.lms_traveled_distance = 0;
1659 if (self.button5 && !self.hook.state)
1664 self.view_ofs = PL_CROUCH_VIEW_OFS;
1665 setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX);
1666 player_setanim(self.anim_duck, FALSE, TRUE, TRUE);
1673 tracebox(self.origin, PL_MIN, PL_MAX, self.origin, FALSE, self);
1674 if (!trace_startsolid)
1676 self.crouch = FALSE;
1677 self.view_ofs = PL_VIEW_OFS;
1678 setsize (self, PL_MIN, PL_MAX);
1685 GrapplingHookFrame();
1690 float zoomfactor, zoomspeed, zoomdir;
1691 zoomfactor = self.cvar_cl_zoomfactor;
1692 if(zoomfactor < 1 || zoomfactor > 16)
1694 zoomspeed = self.cvar_cl_zoomspeed;
1695 if(zoomspeed >= 0) // < 0 is instant zoom
1696 if(zoomspeed < 0.5 || zoomspeed > 16)
1699 zoomdir = self.button4;
1701 if(self.weapon == WEP_NEX)
1706 self.has_zoomed = 1;
1710 if(zoomspeed <= 0) // instant zoom
1713 self.viewzoom = 1 / zoomfactor;
1719 // geometric zoom would be:
1720 // self.viewzoom = bound(1 / zoomfactor, self.viewzoom * pow(zoomfactor, (zoomdir ? -1 : 1) * frametime * zoomspeed), 1);
1721 // however, testing showed that arithmetic/harmonic zoom works better
1723 // self.viewzoom = 1 / bound(1, 1 / self.viewzoom + (zoomdir ? 1 : -1) * frametime * zoomspeed * (zoomfactor - 1), zoomfactor);
1724 // zoom in = arithmetic: 1x, 2x, 3x, 4x, ..., 8x
1725 self.viewzoom = 1 / bound(1, 1 / self.viewzoom + frametime * zoomspeed * (zoomfactor - 1), zoomfactor);
1727 // self.viewzoom = bound(1 / zoomfactor, self.viewzoom + (zoomdir ? -1 : 1) * frametime * zoomspeed * (1 - 1 / zoomfactor), 1);
1728 // zoom out = harmonic: 8/1x, 8/2x, 8/3x, 8/4x, ..., 8/8x
1729 self.viewzoom = bound(1 / zoomfactor, self.viewzoom + frametime * zoomspeed * (1 - 1 / zoomfactor), 1);
1733 self.viewzoom = min(1, self.viewzoom + frametime); // spawn zoom-in
1741 minstagib_ammocheck();
1746 //self.angles_y=self.v_angle_y + 90; // temp
1748 //if (TetrisPreFrame()) return;
1749 } else if(gameover) {
1750 if (intermission_running)
1751 IntermissionThink (); // otherwise a button could be missed between
1753 } else if(self.classname == "observer") {
1754 if (self.flags & FL_JUMPRELEASED) {
1755 if (self.button2 && self.version == cvar("gameversion")) {
1756 self.welcomemessage_time = 0;
1757 self.flags = self.flags - FL_JUMPRELEASED;
1758 LeaveSpectatorMode();
1760 } else if(self.button0 && self.version == cvar("gameversion")) {
1761 self.welcomemessage_time = 0;
1762 self.flags = self.flags - FL_JUMPRELEASED;
1763 if(SpectateNext() == 1) {
1764 self.classname = "spectator";
1768 if (!(self.button0 || self.button2)) {
1769 self.flags = self.flags | FL_JUMPRELEASED;
1773 self.wantswelcomemessage = 0;
1774 if(self.wantswelcomemessage)
1775 PrintWelcomeMessage(self);
1776 } else if(self.classname == "spectator") {
1777 if (self.flags & FL_JUMPRELEASED) {
1778 if (self.button2 && self.version == cvar("gameversion")) {
1779 self.welcomemessage_time = 0;
1780 self.flags = self.flags - FL_JUMPRELEASED;
1781 LeaveSpectatorMode();
1783 } else if(self.button0) {
1784 self.welcomemessage_time = 0;
1785 self.flags = self.flags - FL_JUMPRELEASED;
1786 if(SpectateNext() == 1) {
1787 self.classname = "spectator";
1789 self.classname = "observer";
1790 PutClientInServer();
1792 } else if (self.button3) {
1793 self.welcomemessage_time = 0;
1794 self.flags = self.flags - FL_JUMPRELEASED;
1795 self.classname = "observer";
1796 PutClientInServer();
1801 if (!(self.button0 || self.button3)) {
1802 self.flags = self.flags | FL_JUMPRELEASED;
1806 self.wantswelcomemessage = 0;
1807 if(self.wantswelcomemessage)
1808 PrintWelcomeMessage(self);
1809 self.flags = self.flags | FL_CLIENT | FL_NOTARGET;
1818 Called every frame for each client after the physics are run
1821 void PlayerPostThink (void)
1823 // Savage: Check for nameless players
1824 if (strlen(self.netname) < 1) {
1825 self.netname = "Player";
1826 stuffcmd(self, "seta _cl_name Player\n");
1829 if(self.classname == "player") {
1830 CheckRules_Player();
1835 if (intermission_running)
1836 return; // intermission or finale
1838 //PrintWelcomeMessage(self);
1839 //if (TetrisPostFrame()) return;
1841 // restart countdown
1842 if (restart_countdown) {
1843 if(time < restart_countdown) {
1844 if (!cvar("sv_ready_restart_after_countdown"))
1846 self.movetype = MOVETYPE_NONE;
1847 self.velocity = '0 0 0';
1848 self.avelocity = '0 0 0';
1849 self.movement = '0 0 0';
1854 //allow the player to move again if sv_ready_restart_after_countdown is not used and countdown is over
1855 if (!cvar("sv_ready_restart_after_countdown"))
1857 if(self.movetype == MOVETYPE_NONE)
1859 self.movetype = MOVETYPE_WALK;
1865 } else if (self.classname == "observer") {
1867 } else if (self.classname == "spectator") {