X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=897f2c5a3671fe58069d4ff05db075b3fb5bf352;hb=b6dbff7c90680fafc5903395d5e12e40ada2197d;hp=3ba9b3f8907b26488069d8dc7c9fc7d20761c463;hpb=ead48decf431922779263afaded66ac23a13802a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 3ba9b3f89..897f2c5a3 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -112,7 +112,7 @@ void spawnfunc_info_player_deathmatch (void) void spawnpoint_use() { - if(teams_matter) + if(teamplay) if(have_team_spawns > 0) { self.team = activator.team; @@ -333,7 +333,7 @@ entity SelectSpawnPoint (float anypoint) { // we request a spawn for a team, and we have team // spawns, but that team has no spawns? - if(have_team_spawns[0]) + if(have_team_spawns_forteam[0]) // try noteam spawns teamcheck = 0; else @@ -343,7 +343,7 @@ entity SelectSpawnPoint (float anypoint) else teamcheck = self.team; // MUST be team } - else if(have_team_spawns == 0 && have_team_spawns[0]) + else if(have_team_spawns == 0 && have_team_spawns_forteam[0]) teamcheck = 0; // MUST be noteam else teamcheck = -1; @@ -596,7 +596,7 @@ void FixPlayermodel(); void PutObserverInServer (void) { entity spot; - + self.hud = HUD_NORMAL; race_PreSpawnObserver(); spot = SelectSpawnPoint (TRUE); @@ -614,6 +614,9 @@ void PutObserverInServer (void) DropAllRunes(self); MUTATOR_CALLHOOK(MakePlayerObserver); + if (g_minstagib) + minstagib_stop_countdown(); + Portal_ClearAll(self); if(self.alivetime) @@ -622,6 +625,9 @@ void PutObserverInServer (void) self.alivetime = 0; } + if(self.vehicle) + vehicles_exit(VHEF_RELESE); + if(self.flagcarried) DropFlag(self.flagcarried, world, world); @@ -748,7 +754,7 @@ void FixPlayermodel() if(autocvar_sv_defaultcharacter == 1) { defaultskin = 0; - if(teams_matter) + if(teamplay) { string s; s = Team_ColorNameLowerCase(self.team); @@ -804,7 +810,7 @@ void FixPlayermodel() if(chmdl || oldskin != self.skinindex) self.species = player_getspecies(); // model or skin has changed - if(!teams_matter) + if(!teamplay) if(strlen(autocvar_sv_defaultplayercolors)) if(self.clientcolors != stof(autocvar_sv_defaultplayercolors)) setcolor(self, stof(autocvar_sv_defaultplayercolors)); @@ -1084,7 +1090,11 @@ void PutClientInServer (void) oldself = self; self = spot; activator = oldself; + string s; + s = self.target; + self.target = string_null; SUB_UseTargets(); + self.target = s; activator = world; self = oldself; @@ -1134,7 +1144,7 @@ float ClientInit_SendEntity(entity to, float sf) WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_grenadelauncher_bouncefactor WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_grenadelauncher_bouncestop WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not - WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not + WriteByte(MSG_ENTITY, autocvar_g_balance_rifle_secondary); // client has to know if it should zoom or not WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines WriteByte(MSG_ENTITY, autocvar_g_balance_hagar_secondary_load_max); // hagar max loadable rockets @@ -1260,6 +1270,16 @@ void ClientKill_Now_TeamChange() void ClientKill_Now() { + if(self.vehicle) + { + vehicles_exit(VHEF_RELESE); + if(!self.killindicator_teamchange) + { + self.vehicle_health = -1; + Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0'); + } + } + remove(self.killindicator); self.killindicator = world; @@ -1299,17 +1319,6 @@ void KillIndicator_Think() { if(self.cnt <= 10) AnnounceTo(self.owner, strcat(ftos(self.cnt), "")); - if(self.owner.killindicator_teamchange) - { - if(self.owner.killindicator_teamchange == -1) - centerprint(self.owner, strcat("Changing team in ", ftos(self.cnt), " seconds")); - else if(self.owner.killindicator_teamchange == -2) - centerprint(self.owner, strcat("Spectating in ", ftos(self.cnt), " seconds")); - else - centerprint(self.owner, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds")); - } - else - centerprint(self.owner, strcat("^1Suicide in ", ftos(self.cnt), " seconds")); } self.nextthink = time + 1; self.cnt -= 1; @@ -1380,14 +1389,31 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 if(self.killindicator) { if(targetteam == 0) // just die + { self.killindicator.colormod = '0 0 0'; + if(clienttype(self) == CLIENTTYPE_REAL) + Send_CSQC_Centerprint_Generic(self, CPID_KILL, "^1Suicide in %d seconds", 1, self.killindicator.cnt); + } else if(targetteam == -1) // auto + { self.killindicator.colormod = '0 1 0'; + if(clienttype(self) == CLIENTTYPE_REAL) + Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.killindicator.cnt); + } else if(targetteam == -2) // spectate + { self.killindicator.colormod = '0.5 0.5 0.5'; + if(clienttype(self) == CLIENTTYPE_REAL) + Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.killindicator.cnt); + } else + { self.killindicator.colormod = TeamColor(targetteam); + if(clienttype(self) == CLIENTTYPE_REAL) + Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(targetteam), " in %d seconds"), 1, self.killindicator.cnt); + } } + } void ClientKill (void) @@ -1418,7 +1444,7 @@ void CTS_ClientKill (entity e) // silent version of ClientKill, used when player void DoTeamChange(float destteam) { float t, c0; - if(!teams_matter) + if(!teamplay) { if(destteam >= 0) SetPlayerColors(self, destteam); @@ -1525,6 +1551,7 @@ Called when a client connects to the server string ColoredTeamName(float t); void DecodeLevelParms (void); //void dom_player_join_team(entity pl); +void set_dom_state(entity e); void ClientConnect (void) { float t; @@ -1564,7 +1591,7 @@ void ClientConnect (void) playerdemo_init(); anticheat_init(); - + race_PreSpawnObserver(); //if(g_domination) @@ -1608,7 +1635,7 @@ void ClientConnect (void) else self.team_forced = 0; - if(!teams_matter) + if(!teamplay) if(self.team_forced > 0) self.team_forced = 0; @@ -1617,7 +1644,7 @@ void ClientConnect (void) if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) { self.classname = "observer"; } else { - if(teams_matter) + if(teamplay) { if(autocvar_g_balance_teams || autocvar_g_balance_teams_force) { @@ -1638,6 +1665,9 @@ void ClientConnect (void) self.playerid = (playerid_last = playerid_last + 1); + if(clienttype(self) == CLIENTTYPE_BOT) + PlayerStats_AddPlayer(self); + if(autocvar_sv_eventlog) GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname)); @@ -1654,8 +1684,6 @@ void ClientConnect (void) bprint("\n"); - self.welcomemessage_time = 0; - stuffcmd(self, strcat(clientstuff, "\n")); stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n")); stuffcmd(self, "cl_particles_reloadeffects\n"); @@ -1678,7 +1706,7 @@ void ClientConnect (void) GetCvars(0); // notify about available teams - if(teams_matter) + if(teamplay) { CheckAllowedTeams(self); t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8; @@ -1700,8 +1728,7 @@ void ClientConnect (void) ctf_clientconnect(); }*/ - if(teams_matter || radar_showennemies) - attach_entcs(); + attach_entcs(); bot_relinkplayerlist(); @@ -1766,9 +1793,13 @@ void ClientConnect (void) else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca send_CSQC_teamnagger(); + if (g_domination) + set_dom_state(self); + CheatInitClient(); - PlayerStats_AddPlayer(self); + if(!autocvar_g_campaign) + Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), autocvar_welcome_message_time, 0); } /* @@ -1779,10 +1810,12 @@ Called when a client disconnects from the server ============= */ .entity chatbubbleentity; -.entity teambubbleentity; void ReadyCount(); void ClientDisconnect (void) { + if(self.vehicle) + vehicles_exit(VHEF_RELESE); + if not(self.flags & FL_CLIENT) { print("Warning: ClientDisconnect without ClientConnect\n"); @@ -1833,9 +1866,6 @@ void ClientDisconnect (void) if (self.chatbubbleentity) remove (self.chatbubbleentity); - if (self.teambubbleentity) - remove (self.teambubbleentity); - if (self.killindicator) remove (self.killindicator); @@ -1916,52 +1946,6 @@ void UpdateChatBubble() } -void TeamBubbleThink() -{ - self.nextthink = time; - if (!self.owner.modelindex || self.owner.teambubbleentity != self) - { - if(self.owner) // but why can that ever be world? - self.owner.teambubbleentity = world; - remove(self); - return; - } -// setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); // bandwidth hog. setattachment does this now - if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator) - self.model = ""; - else - self.model = self.mdl; - -}; - -float TeamBubble_customizeentityforclient() -{ - return (self.owner != other && self.owner.team == other.team && other.killcount > -666); -} - -void UpdateTeamBubble() -{ - if (!self.modelindex || !teams_matter) - return; - // spawn a teambubble entity if needed - if (!self.teambubbleentity && teams_matter) - { - self.teambubbleentity = spawn(); - self.teambubbleentity.owner = self; - self.teambubbleentity.exteriormodeltoclient = self; - self.teambubbleentity.think = TeamBubbleThink; - self.teambubbleentity.nextthink = time; - setmodel(self.teambubbleentity, "models/misc/teambubble.spr"); // precision set below -// setorigin(self.teambubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1'); - setorigin(self.teambubbleentity, '0 0 15' + self.maxs_z * '0 0 1'); - setattachment(self.teambubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth - self.teambubbleentity.mdl = self.teambubbleentity.model; - self.teambubbleentity.model = self.teambubbleentity.mdl; - self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient; - self.teambubbleentity.effects = EF_LOWPRECISION; - } -} - // LordHavoc: this hack will be removed when proper _pants/_shirt layers are // added to the model skins /*void UpdateColorModHack() @@ -1969,7 +1953,7 @@ void UpdateTeamBubble() local float c; c = self.clientcolors & 15; // LordHavoc: only bothering to support white, green, red, yellow, blue - if (!teams_matter) self.colormod = '0 0 0'; + if (!teamplay) self.colormod = '0 0 0'; else if (c == 0) self.colormod = '1.00 1.00 1.00'; else if (c == 3) self.colormod = '0.10 1.73 0.10'; else if (c == 4) self.colormod = '1.73 0.10 0.10'; @@ -2014,52 +1998,11 @@ void play_countdown(float finished, string samp) sound (self, CHAN_AUTO, samp, VOL_BASE, ATTN_NORM); } -/** - * When sv_timeout is used this function returs strings like - * "Timeout begins in 2 seconds!\n" or "Timeout ends in 23 seconds!\n". - * Called by centerprint functions - * @param addOneSecond boolean, set to 1 if the welcome-message centerprint asks for the text - */ -string getTimeoutText(float addOneSecond) { - if (!autocvar_sv_timeout || !timeoutStatus) - return ""; - - local string retStr; - if (timeoutStatus == 1) { - if (addOneSecond == 1) { - retStr = strcat("Timeout begins in ", ftos(remainingLeadTime + 1), " seconds!\n"); - } - else { - retStr = strcat("Timeout begins in ", ftos(remainingLeadTime), " seconds!\n"); - } - return retStr; - } - else if (timeoutStatus == 2) { - if (addOneSecond) { - retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime + 1), " seconds!\n"); - //don't show messages like "Timeout ends in 0 seconds"... - if ((remainingTimeoutTime + 1) > 0) - return retStr; - else - return ""; - } - else { - retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime), " seconds!\n"); - //don't show messages like "Timeout ends in 0 seconds"... - if (remainingTimeoutTime > 0) - return retStr; - else - return ""; - } - } - else return ""; -} - void player_powerups (void) { // add a way to see what the items were BEFORE all of these checks for the mutator hook olditems = self.items; - + if((self.items & IT_USING_JETPACK) && !self.deadflag) { SoundEntity_StartSound(self, CHAN_PLAYER, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation); @@ -2075,7 +2018,7 @@ void player_powerups (void) if(!self.modelindex || self.deadflag) // don't apply the flags if the player is gibbed return; - + Fire_ApplyDamage(self); Fire_ApplyEffect(self); @@ -2181,7 +2124,7 @@ void player_powerups (void) if (time < self.spawnshieldtime) self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); } - + MUTATOR_CALLHOOK(PlayerPowerups); } @@ -2396,17 +2339,40 @@ void SpectateCopy(entity spectatee) { self.dmg_save = spectatee.dmg_save; self.dmg_inflictor = spectatee.dmg_inflictor; self.angles = spectatee.v_angle; - self.fixangle = TRUE; + //self.fixangle = TRUE; setorigin(self, spectatee.origin); setsize(self, spectatee.mins, spectatee.maxs); SetZoomState(spectatee.zoomstate); anticheat_spectatecopy(spectatee); + + //self.vehicle = spectatee.vehicle; + + self.hud = spectatee.hud; + if(spectatee.vehicle) + { + setorigin(self, spectatee.origin); + self.velocity = spectatee.vehicle.velocity; + //self.v_angle += spectatee.vehicle.angles; + //self.v_angle_x *= -1; + self.vehicle_health = spectatee.vehicle_health; + self.vehicle_shield = spectatee.vehicle_shield; + self.vehicle_energy = spectatee.vehicle_energy; + self.vehicle_ammo1 = spectatee.vehicle_ammo1; + self.vehicle_ammo2 = spectatee.vehicle_ammo2; + self.vehicle_reload1 = spectatee.vehicle_reload1; + self.vehicle_reload2 = spectatee.vehicle_reload2; + + msg_entity = self; + WriteByte (MSG_ONE, SVC_SETVIEWPORT); + WriteEntity(MSG_ONE, spectatee); + //self.tur_head = spectatee.vehicle.vehicle_viewport; + } } float SpectateUpdate() { if(!self.enemy) - return 0; + return 0; if (self == self.enemy) return 0; @@ -2429,17 +2395,28 @@ float SpectateNext() { self.enemy = other; if(self.enemy.classname == "player") { - msg_entity = self; - WriteByte(MSG_ONE, SVC_SETVIEW); - WriteEntity(MSG_ONE, self.enemy); - //stuffcmd(self, "set viewsize $tmpviewsize \n"); - self.movetype = MOVETYPE_NONE; - accuracy_resend(self); - - if(!SpectateUpdate()) - PutObserverInServer(); - - return 1; + if(self.enemy.vehicle) + { + msg_entity = self; + WriteByte(MSG_ONE, SVC_SETVIEWPORT); + WriteEntity(MSG_ONE, self.enemy); + //stuffcmd(self, "set viewsize $tmpviewsize \n"); + self.movetype = MOVETYPE_NONE; + accuracy_resend(self); + } + else + { + msg_entity = self; + WriteByte(MSG_ONE, SVC_SETVIEW); + WriteEntity(MSG_ONE, self.enemy); + //stuffcmd(self, "set viewsize $tmpviewsize \n"); + self.movetype = MOVETYPE_NONE; + accuracy_resend(self); + + if(!SpectateUpdate()) + PutObserverInServer(); + } + return 1; } else { return 0; } @@ -2474,7 +2451,7 @@ void ShowRespawnCountdown() void LeaveSpectatorMode() { if(nJoinAllowed(1)) { - if(!teams_matter || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) { + if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) { self.classname = "player"; if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) @@ -2489,7 +2466,7 @@ void LeaveSpectatorMode() bprint ("^4", self.netname, "^4 is playing now\n"); if(!autocvar_g_campaign) - centerprint(self,""); // clear MOTD + Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD); // clear MOTD return; } else { @@ -2502,7 +2479,7 @@ void LeaveSpectatorMode() } else { //player may not join because of g_maxplayers is set - centerprint_atprio(self, CENTERPRIO_MAPVOTE, PREVENT_JOIN_TEXT); + centerprint(self, PREVENT_JOIN_TEXT); } } @@ -2553,11 +2530,9 @@ void ObserverThink() { if (self.flags & FL_JUMPRELEASED) { if (self.BUTTON_JUMP && !self.version_mismatch) { - self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; self.flags |= FL_SPAWNING; } else if(self.BUTTON_ATCK && !self.version_mismatch) { - self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; if(SpectateNext() == 1) { self.classname = "spectator"; @@ -2574,18 +2549,15 @@ void ObserverThink() } } } - PrintWelcomeMessage(self); } void SpectatorThink() { if (self.flags & FL_JUMPRELEASED) { if (self.BUTTON_JUMP && !self.version_mismatch) { - self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; self.flags |= FL_SPAWNING; } else if(self.BUTTON_ATCK) { - self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; if(SpectateNext() == 1) { self.classname = "spectator"; @@ -2594,7 +2566,6 @@ void SpectatorThink() PutClientInServer(); } } else if (self.BUTTON_ATCK2) { - self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; self.classname = "observer"; PutClientInServer(); @@ -2614,10 +2585,28 @@ void SpectatorThink() } } - PrintWelcomeMessage(self); self.flags |= FL_CLIENT | FL_NOTARGET; } +float ctf_usekey(); +void PlayerUseKey() +{ + if(self.classname != "player") + return; + + if(self.vehicle) + { + vehicles_exit(VHEF_NORMAL); + return; + } + + // a use key was pressed; call handlers + if(ctf_usekey()) + return; + + MUTATOR_CALLHOOK(PlayerUseKey); +} + .float touchexplode_time; /* @@ -2627,9 +2616,11 @@ PlayerPreThink Called every frame for each client before the physics are run ============= */ +.float usekeypressed; void() ctf_setstatus; void() nexball_setstatus; .float items_added; +.float motd_actived_time; // used for both motd and campaign_message void PlayerPreThink (void) { WarpZone_PlayerPhysics_FixVAngle(); @@ -2704,25 +2695,59 @@ void PlayerPreThink (void) MUTATOR_CALLHOOK(PlayerPreThink); + if(self.BUTTON_USE && !self.usekeypressed) + PlayerUseKey(); + self.usekeypressed = self.BUTTON_USE; + + if (self.motd_actived_time == 0) { + if (autocvar_g_campaign) { + if (self.classname == "player" && self.BUTTON_INFO) { + self.motd_actived_time = time; + Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, -1, 0); + } + } else { + if ((self.classname == "player" || time - self.jointime > autocvar_welcome_message_time) && self.BUTTON_INFO) { + self.motd_actived_time = time; + Send_CSQC_Centerprint_Generic(self, CPID_MOTD, getwelcomemessage(), -1, 0); + } + } + } else { // showing MOTD or campaign message + if (autocvar_g_campaign) { + if (self.classname == "player") { + if (self.BUTTON_INFO) + self.motd_actived_time = time; + else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released + self.motd_actived_time = 0; + Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD); + } + } + } else { + if (self.classname == "player" || (time - self.jointime) > autocvar_welcome_message_time) { + if (self.BUTTON_INFO) + self.motd_actived_time = time; + else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released + self.motd_actived_time = 0; + Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD); + } + } + } + } + if(self.classname == "player") { // if(self.netname == "Wazat") // bprint(self.classname, "\n"); CheckRules_Player(); - PrintWelcomeMessage(self); - if (intermission_running) { IntermissionThink (); // otherwise a button could be missed between return; // the think tics } - if(frametime > 0) // don't do this in cl_movement frames, just in server ticks - UpdateSelectedPlayer(); - //don't allow the player to turn around while game is paused! if(timeoutStatus == 2) { + // FIXME turn this into CSQC stuff self.v_angle = self.lastV_angle; self.angles = self.lastV_angle; self.fixangle = TRUE; @@ -2769,6 +2794,9 @@ void PlayerPreThink (void) player_powerups(); } + if (g_minstagib) + minstagib_ammocheck(); + if (self.deadflag != DEAD_NO) { float button_pressed, force_respawn; @@ -2816,6 +2844,8 @@ void PlayerPreThink (void) } return; } + // FIXME from now on self.deadflag is always 0 (and self.health is never < 1) + // so (self.deadflag == DEAD_NO) is always true in the code below if(g_touchexplode) if(time > self.touchexplode_time) @@ -2927,9 +2957,6 @@ void PlayerPreThink (void) if(frametime) player_anim(); - if (g_minstagib) - minstagib_ammocheck(); - if(g_ctf) ctf_setstatus(); @@ -2950,7 +2977,7 @@ void PlayerPreThink (void) } if(!zoomstate_set) - SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0)); + SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && autocvar_g_balance_rifle_secondary == 0)); float oldspectatee_status; oldspectatee_status = self.spectatee_status; @@ -3056,7 +3083,21 @@ void PlayerPostThink (void) { // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). float timeleft; + if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10 + { + if(self.idlekick_lasttimeleft) + { + Send_CSQC_Centerprint_Generic_Expire(self, CPID_DISCONNECT_IDLING); + self.idlekick_lasttimeleft = 0; + } + return; + } timeleft = ceil(sv_maxidle - (time - self.parm_idlesince)); + if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10 + { + if(!self.idlekick_lasttimeleft) + Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft); + } if(timeleft <= 0) { bprint("^3", self.netname, "^3 was kicked for idling.\n"); @@ -3067,16 +3108,9 @@ void PlayerPostThink (void) else if(timeleft <= 10) { if(timeleft != self.idlekick_lasttimeleft) - { - centerprint_atprio(self, CENTERPRIO_IDLEKICK, strcat("^3Stop idling!\n^3Disconnecting in ", ftos(timeleft), "...")); - AnnounceTo(self, strcat(ftos(timeleft), "")); - } + AnnounceTo(self, ftos(timeleft)); + self.idlekick_lasttimeleft = timeleft; } - else - { - centerprint_expire(self, CENTERPRIO_IDLEKICK); - } - self.idlekick_lasttimeleft = timeleft; } #ifdef TETRIS @@ -3091,7 +3125,6 @@ void PlayerPostThink (void) if(self.classname == "player") { CheckRules_Player(); UpdateChatBubble(); - UpdateTeamBubble(); if (self.impulse) ImpulseCommands(); if (intermission_running) @@ -3125,7 +3158,7 @@ void PlayerPostThink (void) if(self.waypointsprite_attachedforcarrier) WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent)); - + if(self.classname == "player" && self.deadflag == DEAD_NO && autocvar_r_showbboxes) { if(!self.showheadshotbbox)