X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=2b8dc1881c77a9fca7d4dce51fda57ebbb6d2f8a;hp=2a79d6a4add237e2080e9fe345a3bee520dfc328;hb=58dbb346589df99e1ad757f6564b41ec1293d0b4;hpb=0fd5e3f9b0204f5e42a29184ceb881bb1125717a diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 2a79d6a4ad..2b8dc1881c 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -10,7 +10,7 @@ void send_CSQC_cr_maxbullets(entity e) { msg_entity = e; WriteByte(MSG_ONE, SVC_TEMPENTITY); WriteByte(MSG_ONE, TE_CSQC_CR_MAXBULLETS); - WriteByte(MSG_ONE, cvar("g_balance_campingrifle_magazinecapacity")); + WriteByte(MSG_ONE, autocvar_g_balance_campingrifle_magazinecapacity); } void Announce(string snd) { @@ -242,7 +242,7 @@ entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindis { spot.spawnpoint_score = Spawn_Score(spot, playerlist, teamcheck, anypoint); - if(cvar("spawn_debugview")) + if(autocvar_spawn_debugview) { setmodel(spot, "models/runematch/rune.mdl"); if(spot.spawnpoint_score_y < mindist) @@ -364,13 +364,13 @@ entity SelectSpawnPoint (float anypoint) firstspot = firstspot_new; spot = Spawn_WeightedPoint(firstspot, 1, 1, 1); } - else if (random() > cvar("g_spawn_furthest")) + else if (random() > autocvar_g_spawn_furthest) spot = Spawn_WeightedPoint(firstspot, 1, 1, 1); else spot = Spawn_WeightedPoint(firstspot, 1, 5000, 5); // chooses a far far away spawnpoint } - if(cvar("spawn_debugview")) + if(autocvar_spawn_debugview) { print("spot mindistance: ", vtos(spot.spawnpoint_score), "\n"); @@ -383,7 +383,7 @@ entity SelectSpawnPoint (float anypoint) if (!spot) { - if(cvar("spawn_debug")) + if(autocvar_spawn_debug) GotoNextMap(); else { @@ -418,7 +418,7 @@ string CheckPlayerModel(string plyermodel) { return FallbackPlayerModel; if( substring(plyermodel,0,14) != "models/player/") return FallbackPlayerModel; - else if(cvar("sv_servermodelsonly")) + else if(autocvar_sv_servermodelsonly) { if(substring(plyermodel,-4,4) != ".zym") if(substring(plyermodel,-4,4) != ".dpm") @@ -599,13 +599,20 @@ void PutObserverInServer (void) } DropAllRunes(self); + MUTATOR_CALLHOOK(MakePlayerObserver); Portal_ClearAll(self); + if(self.alivetime) + { + PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime); + self.alivetime = 0; + } + if(self.flagcarried) DropFlag(self.flagcarried, world, world); - if(self.ballcarried) + if(self.ballcarried && g_nexball) DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity); WaypointSprite_PlayerDead(); @@ -630,6 +637,8 @@ void PutObserverInServer (void) PlayerScore_Clear(self); // clear scores when needed + accuracy_resend(self); + self.spectatortime = time; self.classname = "observer"; @@ -641,7 +650,7 @@ void PutObserverInServer (void) self.flags = FL_CLIENT | FL_NOTARGET; self.armorvalue = 666; self.effects = 0; - self.armorvalue = cvar("g_balance_armor_start"); + self.armorvalue = autocvar_g_balance_armor_start; self.pauserotarmor_finished = 0; self.pauserothealth_finished = 0; self.pauseregen_finished = 0; @@ -713,8 +722,6 @@ void PutObserverInServer (void) } else self.frags = FRAGS_SPECTATOR; - - MUTATOR_CALLHOOK(MakePlayerObserver); } float RestrictSkin(float s) @@ -734,7 +741,7 @@ void FixPlayermodel() defaultmodel = ""; - if(cvar("sv_defaultcharacter") == 1) { + if(autocvar_sv_defaultcharacter == 1) { defaultskin = 0; if(teams_matter) @@ -750,8 +757,8 @@ void FixPlayermodel() if(defaultmodel == "") { - defaultmodel = cvar_string("sv_defaultplayermodel"); - defaultskin = cvar("sv_defaultplayerskin"); + defaultmodel = autocvar_sv_defaultplayermodel; + defaultskin = autocvar_sv_defaultplayerskin; } } @@ -794,9 +801,9 @@ void FixPlayermodel() self.species = player_getspecies(); // model or skin has changed if(!teams_matter) - if(strlen(cvar_string("sv_defaultplayercolors"))) - if(self.clientcolors != cvar("sv_defaultplayercolors")) - setcolor(self, cvar("sv_defaultplayercolors")); + if(strlen(autocvar_sv_defaultplayercolors)) + if(self.clientcolors != stof(autocvar_sv_defaultplayercolors)) + setcolor(self, stof(autocvar_sv_defaultplayercolors)); } void PlayerTouchExplode(entity p1, entity p2) @@ -854,6 +861,8 @@ void PutClientInServer (void) entity spot, oldself; float j; + accuracy_resend(self); + if(self.team < 0) JoinBestTeam(self, FALSE, TRUE); @@ -874,9 +883,9 @@ void PutClientInServer (void) self.movetype = MOVETYPE_WALK; self.solid = SOLID_SLIDEBOX; self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID; - if(cvar("g_playerclip_collisions")) + if(autocvar_g_playerclip_collisions) self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP; - if(clienttype(self) == CLIENTTYPE_BOT && cvar("g_botclip_collisions")) + if(clienttype(self) == CLIENTTYPE_BOT && autocvar_g_botclip_collisions) self.dphitcontentsmask |= DPCONTENTS_BOTCLIP; self.frags = FRAGS_PLAYER; if(independent_players) @@ -889,8 +898,12 @@ void PutClientInServer (void) self.effects = 0; self.air_finished = time + 12; self.dmg = 2; - if(cvar("g_balance_nex_charge")) - self.nex_charge = cvar("g_balance_nex_charge_start"); + if(autocvar_g_balance_nex_charge) + { + if(autocvar_g_balance_nex_secondary_chargepool) + self.nex_chargepool_ammo = 1; + self.nex_charge = autocvar_g_balance_nex_charge_start; + } if(inWarmupStage) { @@ -927,13 +940,13 @@ void PutClientInServer (void) self.items = start_items; self.jump_interval = time; - self.spawnshieldtime = time + cvar("g_spawnshieldtime"); - self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn"); - self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn"); - self.pauserotfuel_finished = time + cvar("g_balance_pause_fuel_rot_spawn"); - self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn"); + self.spawnshieldtime = time + autocvar_g_spawnshieldtime; + self.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot_spawn; + self.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot_spawn; + self.pauserotfuel_finished = time + autocvar_g_balance_pause_fuel_rot_spawn; + self.pauseregen_finished = time + autocvar_g_balance_pause_health_regen_spawn; //extend the pause of rotting if client was reset at the beginning of the countdown - if(!cvar("sv_ready_restart_after_countdown") && time < game_starttime) { // TODO why is this cvar NOTted? + if(!autocvar_sv_ready_restart_after_countdown && time < game_starttime) { // TODO why is this cvar NOTted? self.spawnshieldtime += game_starttime - time; self.pauserotarmor_finished += game_starttime - time; self.pauserothealth_finished += game_starttime - time; @@ -955,7 +968,7 @@ void PutClientInServer (void) self.nextthink = 0; self.hook_time = 0; self.dmg_team = 0; - self.ballistics_density = cvar("g_ballistics_density_player"); + self.ballistics_density = autocvar_g_ballistics_density_player; self.metertime = 0; @@ -1021,16 +1034,16 @@ void PutClientInServer (void) CL_SpawnWeaponentity(); self.alpha = default_player_alpha; - self.colormod = '1 1 1' * cvar("g_player_brightness"); + self.colormod = '1 1 1' * autocvar_g_player_brightness; self.exteriorweaponentity.alpha = default_weapon_alpha; - self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2; + self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2; self.lms_traveled_distance = 0; self.speedrunning = FALSE; race_PostSpawn(spot); - if(cvar("spawn_debug")) + if(autocvar_spawn_debug) { sprint(self, strcat("spawnpoint origin: ", vtos(spot.origin), "\n")); remove(spot); // usefull for checking if there are spawnpoints, that let drop through the floor @@ -1039,7 +1052,7 @@ void PutClientInServer (void) //stuffcmd(self, "chase_active 0"); //stuffcmd(self, "set viewsize $tmpviewsize \n"); - if (cvar("g_spawnsound")) + if (autocvar_g_spawnsound) sound (self, CHAN_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM); if(g_assault) { @@ -1067,6 +1080,9 @@ void PutClientInServer (void) self.switchweapon = w_getbestweapon(self); self.cnt = self.switchweapon; self.weapon = 0; + + if(!self.alivetime) + self.alivetime = time; } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) { PutObserverInServer (); } @@ -1075,6 +1091,9 @@ void PutClientInServer (void) // ctf_playerchanged(); } +.float ebouncefactor, ebouncestop; // electro's values +// TODO do we need all these fields, or should we stop autodetecting runtime +// changes and just have a console command to update this? float ClientInit_SendEntity(entity to, float sf) { WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); @@ -1099,8 +1118,10 @@ float ClientInit_SendEntity(entity to, float sf) WriteByte(MSG_ENTITY, self.cnt * 255.0); // g_balance_weaponswitchdelay WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_grenadelauncher_bouncefactor WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_grenadelauncher_bouncestop - WriteByte(MSG_ENTITY, cvar("g_balance_nex_secondary")); // client has to know if it should zoom or not - WriteByte(MSG_ENTITY, cvar("g_balance_campingrifle_secondary")); // client has to know if it should zoom or not + 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_campingrifle_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 return TRUE; } @@ -1108,24 +1129,34 @@ float ClientInit_SendEntity(entity to, float sf) void ClientInit_CheckUpdate() { self.nextthink = time; - if(self.count != cvar("g_balance_armor_blockpercent")) + if(self.count != autocvar_g_balance_armor_blockpercent) { - self.count = cvar("g_balance_armor_blockpercent"); + self.count = autocvar_g_balance_armor_blockpercent; self.SendFlags |= 1; } - if(self.cnt != cvar("g_balance_weaponswitchdelay")) + if(self.cnt != autocvar_g_balance_weaponswitchdelay) { - self.cnt = cvar("g_balance_weaponswitchdelay"); + self.cnt = autocvar_g_balance_weaponswitchdelay; self.SendFlags |= 1; } - if(self.bouncefactor != cvar("g_balance_grenadelauncher_bouncefactor")) + if(self.bouncefactor != autocvar_g_balance_grenadelauncher_bouncefactor) { - self.bouncefactor = cvar("g_balance_grenadelauncher_bouncefactor"); + self.bouncefactor = autocvar_g_balance_grenadelauncher_bouncefactor; self.SendFlags |= 1; } - if(self.bouncestop != cvar("g_balance_grenadelauncher_bouncestop")) + if(self.bouncestop != autocvar_g_balance_grenadelauncher_bouncestop) { - self.bouncestop = cvar("g_balance_grenadelauncher_bouncestop"); + self.bouncestop = autocvar_g_balance_grenadelauncher_bouncestop; + self.SendFlags |= 1; + } + if(self.ebouncefactor != autocvar_g_balance_electro_secondary_bouncefactor) + { + self.ebouncefactor = autocvar_g_balance_electro_secondary_bouncefactor; + self.SendFlags |= 1; + } + if(self.ebouncestop != autocvar_g_balance_electro_secondary_bouncestop) + { + self.ebouncestop = autocvar_g_balance_electro_secondary_bouncestop; self.SendFlags |= 1; } } @@ -1191,6 +1222,7 @@ Called when a client types 'kill' in the console ============= */ +.float clientkill_nexttime; void ClientKill_Now_TeamChange() { if(self.killindicator_teamchange == -1) @@ -1198,24 +1230,30 @@ void ClientKill_Now_TeamChange() self.team = -1; JoinBestTeam( self, FALSE, FALSE ); } + else if(self.killindicator_teamchange == -2) + { + if(g_ca) + self.caplayer = 0; + if(blockSpectators) + sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + PutObserverInServer(); + } else SV_ChangeTeam(self.killindicator_teamchange - 1); } void ClientKill_Now() { + remove(self.killindicator); + self.killindicator = world; + if(self.killindicator_teamchange) ClientKill_Now_TeamChange(); // in any case: Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); - if(self.killindicator) - { - dprint("Cleaned up after a leaked kill indicator.\n"); - remove(self.killindicator); - self.killindicator = world; - } + // now I am sure the player IS dead } void KillIndicator_Think() { @@ -1244,6 +1282,8 @@ void KillIndicator_Think() { 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")); } @@ -1255,11 +1295,11 @@ void KillIndicator_Think() } } -void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto +void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 = spec { float killtime; entity e; - killtime = cvar("g_balance_kill_delay"); + killtime = autocvar_g_balance_kill_delay; if(g_race_qualifying) killtime = 0; @@ -1268,6 +1308,12 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto if(!self.killindicator) { + if(self.modelindex && self.deadflag == DEAD_NO) + { + killtime = max(killtime, self.clientkill_nexttime - time); + self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam; + } + if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO) { ClientKill_Now(); @@ -1303,10 +1349,14 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto } if(self.killindicator) { - if(targetteam) - self.killindicator.colormod = TeamColor(targetteam); - else + if(targetteam == 0) // just die self.killindicator.colormod = '0 0 0'; + else if(targetteam == -1) // auto + self.killindicator.colormod = '0 1 0'; + else if(targetteam == -2) // spectate + self.killindicator.colormod = '0.5 0.5 0.5'; + else + self.killindicator.colormod = TeamColor(targetteam); } } @@ -1316,6 +1366,10 @@ void ClientKill (void) { // do nothing } + else if(g_freezetag && self.freezetag_frozen == 1) + { + // do nothing + } else ClientKill_TeamChange(0); } @@ -1391,25 +1445,25 @@ void FixClientCvars(entity e) stuffcmd(e, "\nin_bindmap 0 0\n"); if(g_race || g_cts) stuffcmd(e, "cl_cmd settemp cl_movecliptokeyboard 2\n"); - if(cvar("g_antilag") == 3) // client side hitscan + if(autocvar_g_antilag == 3) // client side hitscan stuffcmd(e, "cl_cmd settemp cl_prydoncursor_notrace 0\n"); if(sv_gentle) stuffcmd(e, "cl_cmd settemp cl_gentle 1\n"); /* * we no longer need to stuff this. Remove this comment block if you feel * 2.3 and higher (or was it 2.2.3?) don't need these any more - stuffcmd(e, strcat("cl_gravity ", ftos(cvar("sv_gravity")), "\n")); - stuffcmd(e, strcat("cl_movement_accelerate ", ftos(cvar("sv_accelerate")), "\n")); - stuffcmd(e, strcat("cl_movement_friction ", ftos(cvar("sv_friction")), "\n")); - stuffcmd(e, strcat("cl_movement_maxspeed ", ftos(cvar("sv_maxspeed")), "\n")); - stuffcmd(e, strcat("cl_movement_airaccelerate ", ftos(cvar("sv_airaccelerate")), "\n")); - stuffcmd(e, strcat("cl_movement_maxairspeed ", ftos(cvar("sv_maxairspeed")), "\n")); - stuffcmd(e, strcat("cl_movement_stopspeed ", ftos(cvar("sv_stopspeed")), "\n")); - stuffcmd(e, strcat("cl_movement_jumpvelocity ", ftos(cvar("sv_jumpvelocity")), "\n")); - stuffcmd(e, strcat("cl_movement_stepheight ", ftos(cvar("sv_stepheight")), "\n")); - stuffcmd(e, strcat("set cl_movement_friction_on_land ", ftos(cvar("sv_friction_on_land")), "\n")); - stuffcmd(e, strcat("set cl_movement_airaccel_qw ", ftos(cvar("sv_airaccel_qw")), "\n")); - stuffcmd(e, strcat("set cl_movement_airaccel_sideways_friction ", ftos(cvar("sv_airaccel_sideways_friction")), "\n")); + stuffcmd(e, strcat("cl_gravity ", ftos(autocvar_sv_gravity), "\n")); + stuffcmd(e, strcat("cl_movement_accelerate ", ftos(autocvar_sv_accelerate), "\n")); + stuffcmd(e, strcat("cl_movement_friction ", ftos(autocvar_sv_friction), "\n")); + stuffcmd(e, strcat("cl_movement_maxspeed ", ftos(autocvar_sv_maxspeed), "\n")); + stuffcmd(e, strcat("cl_movement_airaccelerate ", ftos(autocvar_sv_airaccelerate), "\n")); + stuffcmd(e, strcat("cl_movement_maxairspeed ", ftos(autocvar_sv_maxairspeed), "\n")); + stuffcmd(e, strcat("cl_movement_stopspeed ", ftos(autocvar_sv_stopspeed), "\n")); + stuffcmd(e, strcat("cl_movement_jumpvelocity ", ftos(autocvar_sv_jumpvelocity), "\n")); + stuffcmd(e, strcat("cl_movement_stepheight ", ftos(autocvar_sv_stepheight), "\n")); + stuffcmd(e, strcat("set cl_movement_friction_on_land ", ftos(autocvar_sv_friction_on_land), "\n")); + stuffcmd(e, strcat("set cl_movement_airaccel_qw ", ftos(autocvar_sv_airaccel_qw), "\n")); + stuffcmd(e, strcat("set cl_movement_airaccel_sideways_friction ", ftos(autocvar_sv_airaccel_sideways_friction), "\n")); stuffcmd(e, "cl_movement_edgefriction 1\n"); */ } @@ -1478,6 +1532,7 @@ void ClientConnect (void) PlayerScore_Attach(self); ClientData_Attach(); + accuracy_init(self); bot_clientconnect(); @@ -1491,25 +1546,39 @@ void ClientConnect (void) // dom_player_join_team(self); // identify the right forced team - if(PlayerInIDList(self, cvar_string("g_forced_team_red"))) + if(autocvar_g_campaign) + { + if(clienttype(self) == CLIENTTYPE_REAL) // only players, not bots + { + switch(autocvar_g_campaign_forceteam) + { + case 1: self.team_forced = COLOR_TEAM1; break; + case 2: self.team_forced = COLOR_TEAM2; break; + case 3: self.team_forced = COLOR_TEAM3; break; + case 4: self.team_forced = COLOR_TEAM4; break; + default: self.team_forced = 0; + } + } + } + else if(PlayerInIDList(self, autocvar_g_forced_team_red)) self.team_forced = COLOR_TEAM1; - else if(PlayerInIDList(self, cvar_string("g_forced_team_blue"))) + else if(PlayerInIDList(self, autocvar_g_forced_team_blue)) self.team_forced = COLOR_TEAM2; - else if(PlayerInIDList(self, cvar_string("g_forced_team_yellow"))) + else if(PlayerInIDList(self, autocvar_g_forced_team_yellow)) self.team_forced = COLOR_TEAM3; - else if(PlayerInIDList(self, cvar_string("g_forced_team_pink"))) + else if(PlayerInIDList(self, autocvar_g_forced_team_pink)) self.team_forced = COLOR_TEAM4; - else if(cvar_string("g_forced_team_otherwise") == "red") + else if(autocvar_g_forced_team_otherwise == "red") self.team_forced = COLOR_TEAM1; - else if(cvar_string("g_forced_team_otherwise") == "blue") + else if(autocvar_g_forced_team_otherwise == "blue") self.team_forced = COLOR_TEAM2; - else if(cvar_string("g_forced_team_otherwise") == "yellow") + else if(autocvar_g_forced_team_otherwise == "yellow") self.team_forced = COLOR_TEAM3; - else if(cvar_string("g_forced_team_otherwise") == "pink") + else if(autocvar_g_forced_team_otherwise == "pink") self.team_forced = COLOR_TEAM4; - else if(cvar_string("g_forced_team_otherwise") == "spectate") + else if(autocvar_g_forced_team_otherwise == "spectate") self.team_forced = -1; - else if(cvar_string("g_forced_team_otherwise") == "spectator") + else if(autocvar_g_forced_team_otherwise == "spectator") self.team_forced = -1; else self.team_forced = 0; @@ -1520,12 +1589,12 @@ void ClientConnect (void) JoinBestTeam(self, FALSE, FALSE); // if the team number is valid, keep it - if((cvar("sv_spectate") == 1 && !g_lms) || cvar("g_campaign") || self.team_forced < 0) { + if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) { self.classname = "observer"; } else { if(teams_matter) { - if(cvar("g_balance_teams") || cvar("g_balance_teams_force")) + if(autocvar_g_balance_teams || autocvar_g_balance_teams_force) { self.classname = "player"; campaign_bots_may_start = 1; @@ -1544,7 +1613,7 @@ void ClientConnect (void) self.playerid = (playerid_last = playerid_last + 1); - if(cvar("sv_eventlog")) + if(autocvar_sv_eventlog) GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname)); LogTeamchange(self.playerid, self.team, 1); @@ -1583,9 +1652,6 @@ void ClientConnect (void) // get other cvars from player GetCvars(0); - // set cvar for team scoreboard - stuffcmd(self, strcat("set teamplay ", ftos(teamplay), "\n")); - // notify about available teams if(teams_matter) { @@ -1617,15 +1683,15 @@ void ClientConnect (void) self.spectatortime = time; if(blockSpectators) { - 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")); + sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); } self.jointime = time; - self.allowedTimeouts = cvar("sv_timeout_number"); + self.allowedTimeouts = autocvar_sv_timeout_number; if(clienttype(self) == CLIENTTYPE_REAL) { - if(cvar("g_bugrigs") || g_weaponarena == WEPBIT_TUBA) + if(autocvar_g_bugrigs || g_weaponarena == WEPBIT_TUBA) stuffcmd(self, "cl_cmd settemp chase_active 1\n"); } @@ -1643,7 +1709,7 @@ void ClientConnect (void) SoundEntity_Attach(self); - if(cvar("g_hitplots") || strstrofs(strcat(" ", cvar_string("g_hitplots_individuals"), " "), strcat(" ", self.netaddress, " "), 0) >= 0) + if(autocvar_g_hitplots || strstrofs(strcat(" ", autocvar_g_hitplots_individuals, " "), strcat(" ", self.netaddress, " "), 0) >= 0) { self.hitplotfh = fopen(strcat("hits-", matchid, "-", self.netaddress, "-", ftos(self.playerid), ".plot"), FILE_WRITE); fputs(self.hitplotfh, strcat("#name ", self.netname, "\n")); @@ -1672,12 +1738,14 @@ void ClientConnect (void) race_SendRankings(i, 0, 0, MSG_ONE); } } - else if(cvar("sv_teamnagger") && !(cvar("bot_vs_human") && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca + else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca send_CSQC_teamnagger(); send_CSQC_cr_maxbullets(self); CheatInitClient(); + + PlayerStats_AddPlayer(self); } /* @@ -1698,6 +1766,8 @@ void ClientDisconnect (void) return; } + PlayerStats_AddGlobalInfo(self); + CheatShutdownClient(); if(self.hitplotfh >= 0) @@ -1716,7 +1786,7 @@ void ClientDisconnect (void) if(self.entcs) detach_entcs(); - if(cvar("sv_eventlog")) + if(autocvar_sv_eventlog) GameLogEcho(strcat(":part:", ftos(self.playerid))); bprint ("^4",self.netname); bprint ("^4 disconnected\n"); @@ -1730,7 +1800,7 @@ void ClientDisconnect (void) if(self.flagcarried) DropFlag(self.flagcarried, world, world); - if(self.ballcarried) + if(self.ballcarried && g_nexball) DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity); // Here, everything has been done that requires this player to be a client. @@ -1756,6 +1826,7 @@ void ClientDisconnect (void) Spawnqueue_Remove(self); } + accuracy_free(self); ClientData_Detach(); PlayerScore_Detach(self); @@ -1887,19 +1958,19 @@ void UpdateTeamBubble() .float oldcolormap; void respawn(void) { - if(self.modelindex != 0 && cvar("g_respawn_ghosts")) + if(self.modelindex != 0 && autocvar_g_respawn_ghosts) { self.solid = SOLID_NOT; self.takedamage = DAMAGE_NO; self.movetype = MOVETYPE_FLY; - self.velocity = '0 0 1' * cvar("g_respawn_ghosts_speed"); - self.avelocity = randomvec() * cvar("g_respawn_ghosts_speed") * 3 - randomvec() * cvar("g_respawn_ghosts_speed") * 3; + self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed; + self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3; self.effects |= EF_ADDITIVE; self.oldcolormap = self.colormap; self.colormap = 512; pointparticles(particleeffectnum("respawn_ghost"), self.origin, '0 0 0', 1); - if(cvar("g_respawn_ghosts_maxtime")) - SUB_SetFade (self, time + cvar("g_respawn_ghosts_maxtime") / 2 + random () * (cvar("g_respawn_ghosts_maxtime") - cvar("g_respawn_ghosts_maxtime") / 2), 1.5); + if(autocvar_g_respawn_ghosts_maxtime) + SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5); } CopyBody(1); @@ -1927,7 +1998,7 @@ void play_countdown(float finished, string samp) * @param addOneSecond boolean, set to 1 if the welcome-message centerprint asks for the text */ string getTimeoutText(float addOneSecond) { - if (!cvar("sv_timeout") || !timeoutStatus) + if (!autocvar_sv_timeout || !timeoutStatus) return ""; local string retStr; @@ -1963,9 +2034,12 @@ string getTimeoutText(float addOneSecond) { 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, cvar("g_jetpack_attenuation")); + SoundEntity_StartSound(self, CHAN_PLAYER, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation); self.modelflags |= MF_ROCKET; } else @@ -2011,7 +2085,7 @@ void player_powerups (void) if (self.items & IT_INVINCIBLE) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); - if (time > self.invincible_finished && cvar("g_balance_powerup_timer")) + if (time > self.invincible_finished && autocvar_g_balance_powerup_timer) { self.items = self.items - (self.items & IT_INVINCIBLE); sprint(self, "^3Speed has worn off\n"); @@ -2025,64 +2099,67 @@ void player_powerups (void) sprint(self, "^3You are on speed\n"); } } - return; } - - if (self.items & IT_STRENGTH) + else // if we're not in minstagib, continue. I added this else to replace the "return" which was here that broke the callhook for this function -- This code is nasty. { - play_countdown(self.strength_finished, "misc/poweroff.wav"); - self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.strength_finished && cvar("g_balance_powerup_timer")) + if (self.items & IT_STRENGTH) { - self.items = self.items - (self.items & IT_STRENGTH); - sprint(self, "^3Strength has worn off\n"); + play_countdown(self.strength_finished, "misc/poweroff.wav"); + self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); + if (time > self.strength_finished && autocvar_g_balance_powerup_timer) + { + self.items = self.items - (self.items & IT_STRENGTH); + sprint(self, "^3Strength has worn off\n"); + } } - } - else - { - if (time < self.strength_finished) + else { - self.items = self.items | IT_STRENGTH; - sprint(self, "^3Strength infuses your weapons with devastating power\n"); + if (time < self.strength_finished) + { + self.items = self.items | IT_STRENGTH; + sprint(self, "^3Strength infuses your weapons with devastating power\n"); + } } - } - if (self.items & IT_INVINCIBLE) - { - play_countdown(self.invincible_finished, "misc/poweroff.wav"); - self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.invincible_finished && cvar("g_balance_powerup_timer")) + if (self.items & IT_INVINCIBLE) { - self.items = self.items - (self.items & IT_INVINCIBLE); - sprint(self, "^3Shield has worn off\n"); + play_countdown(self.invincible_finished, "misc/poweroff.wav"); + self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); + if (time > self.invincible_finished && autocvar_g_balance_powerup_timer) + { + self.items = self.items - (self.items & IT_INVINCIBLE); + sprint(self, "^3Shield has worn off\n"); + } } - } - else - { - if (time < self.invincible_finished) + else { - self.items = self.items | IT_INVINCIBLE; - sprint(self, "^3Shield surrounds you\n"); + if (time < self.invincible_finished) + { + self.items = self.items | IT_INVINCIBLE; + sprint(self, "^3Shield surrounds you\n"); + } } - } - if(cvar("g_nodepthtestplayers")) - self.effects = self.effects | EF_NODEPTHTEST; + if(autocvar_g_nodepthtestplayers) + self.effects = self.effects | EF_NODEPTHTEST; - if(cvar("g_fullbrightplayers")) - self.effects = self.effects | EF_FULLBRIGHT; + if(autocvar_g_fullbrightplayers) + self.effects = self.effects | EF_FULLBRIGHT; - // midair gamemode: damage only while in the air - // if in midair mode, being on ground grants temporary invulnerability - // (this is so that multishot weapon don't clear the ground flag on the - // first damage in the frame, leaving the player vulnerable to the - // remaining hits in the same frame) - if (self.flags & FL_ONGROUND) - if (g_midair) - self.spawnshieldtime = max(self.spawnshieldtime, time + cvar("g_midair_shieldtime")); + // midair gamemode: damage only while in the air + // if in midair mode, being on ground grants temporary invulnerability + // (this is so that multishot weapon don't clear the ground flag on the + // first damage in the frame, leaving the player vulnerable to the + // remaining hits in the same frame) + if (self.flags & FL_ONGROUND) + if (g_midair) + self.spawnshieldtime = max(self.spawnshieldtime, time + autocvar_g_midair_shieldtime); - if (time >= game_starttime) - if (time < self.spawnshieldtime) - self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); + if (time >= game_starttime) + if (time < self.spawnshieldtime) + self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT); + } + + MUTATOR_CALLHOOK(PlayerPowerups); } float CalcRegen(float current, float stable, float regenfactor, float regenframetime) @@ -2133,15 +2210,15 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re void player_regen (void) { float minh, mina, minf, maxh, maxa, maxf, limith, limita, limitf, max_mod, regen_mod, rot_mod, limit_mod; - maxh = cvar("g_balance_health_rotstable"); - maxa = cvar("g_balance_armor_rotstable"); - maxf = cvar("g_balance_fuel_rotstable"); - minh = cvar("g_balance_health_regenstable"); - mina = cvar("g_balance_armor_regenstable"); - minf = cvar("g_balance_fuel_regenstable"); - limith = cvar("g_balance_health_limit"); - limita = cvar("g_balance_armor_limit"); - limitf = cvar("g_balance_fuel_limit"); + maxh = autocvar_g_balance_health_rotstable; + maxa = autocvar_g_balance_armor_rotstable; + maxf = autocvar_g_balance_fuel_rotstable; + minh = autocvar_g_balance_health_regenstable; + mina = autocvar_g_balance_armor_regenstable; + minf = autocvar_g_balance_fuel_regenstable; + limith = autocvar_g_balance_health_limit; + limita = autocvar_g_balance_armor_limit; + limitf = autocvar_g_balance_fuel_limit; max_mod = regen_mod = rot_mod = limit_mod = 1; @@ -2149,27 +2226,27 @@ void player_regen (void) { if (self.runes & CURSE_VENOM) // do we have both rune/curse? { - regen_mod = cvar("g_balance_rune_regen_combo_regenrate"); - max_mod = cvar("g_balance_rune_regen_combo_hpmod"); - limit_mod = cvar("g_balance_rune_regen_combo_limitmod"); + regen_mod = autocvar_g_balance_rune_regen_combo_regenrate; + max_mod = autocvar_g_balance_rune_regen_combo_hpmod; + limit_mod = autocvar_g_balance_rune_regen_combo_limitmod; } else { - regen_mod = cvar("g_balance_rune_regen_regenrate"); - max_mod = cvar("g_balance_rune_regen_hpmod"); - limit_mod = cvar("g_balance_rune_regen_limitmod"); + regen_mod = autocvar_g_balance_rune_regen_regenrate; + max_mod = autocvar_g_balance_rune_regen_hpmod; + limit_mod = autocvar_g_balance_rune_regen_limitmod; } } else if (self.runes & CURSE_VENOM) { - max_mod = cvar("g_balance_curse_venom_hpmod"); + max_mod = autocvar_g_balance_curse_venom_hpmod; if (self.runes & RUNE_REGEN) // do we have both rune/curse? - rot_mod = cvar("g_balance_rune_regen_combo_rotrate"); + rot_mod = autocvar_g_balance_rune_regen_combo_rotrate; else - rot_mod = cvar("g_balance_curse_venom_rotrate"); - limit_mod = cvar("g_balance_curse_venom_limitmod"); + rot_mod = autocvar_g_balance_curse_venom_rotrate; + limit_mod = autocvar_g_balance_curse_venom_limitmod; //if (!self.runes & RUNE_REGEN) - // rot_mod = cvar("g_balance_curse_venom_rotrate"); + // rot_mod = autocvar_g_balance_curse_venom_rotrate; } maxh = maxh * max_mod; //maxa = maxa * max_mod; @@ -2184,10 +2261,10 @@ void player_regen (void) if(g_lms && g_ca) rot_mod = 0; - if (!g_minstagib && !g_ca && (!g_lms || cvar("g_lms_regenerate"))) + if (!g_minstagib && !g_ca && (!g_lms || autocvar_g_lms_regenerate)) { - self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita); - self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserothealth_finished), limith); + self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita); + self.health = CalcRotRegen(self.health, minh, autocvar_g_balance_health_regen, autocvar_g_balance_health_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxh, autocvar_g_balance_health_rot, autocvar_g_balance_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith); // if player rotted to death... die! if(self.health < 1) @@ -2195,7 +2272,7 @@ void player_regen (void) } if not(self.items & IT_UNLIMITED_WEAPON_AMMO) - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregen_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf); + self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, rot_mod * frametime * (time > self.pauserotfuel_finished), limitf); } float zoomstate_set; @@ -2253,33 +2330,13 @@ void GetPressedKeys(void) { self.pressedkeys &~= KEY_CROUCH; } -void update_stats (float number, float hit, float fired) { -// self.stat_hit = number + ((number==0) ? 1 : 64) * hit * sv_accuracy_data_share; -// self.stat_fired = number + ((number==0) ? 1 : 64) * fired * sv_accuracy_data_share; - - if(number) { - self.stat_hit = number + 64 * hit * sv_accuracy_data_share; - self.stat_fired = number + 64 * fired * sv_accuracy_data_share; - } else { - self.stat_hit = hit * sv_accuracy_data_share; - self.stat_fired = fired * sv_accuracy_data_share; - } -} - /* ====================== spectate mode routines ====================== */ -.float weapon_count; void SpectateCopy(entity spectatee) { - if(spectatee.weapon_count < WEP_LAST) { - update_stats (spectatee.weapon_count, spectatee.cvar_cl_accuracy_data_share * floor(spectatee.stats_hit[spectatee.weapon_count - 1]), spectatee.cvar_cl_accuracy_data_share * floor(spectatee.stats_fired[spectatee.weapon_count - 1])); - spectatee.weapon_count ++; - } else - update_stats (0, spectatee.cvar_cl_accuracy_data_share * spectatee.stat_hit, spectatee.cvar_cl_accuracy_data_share * spectatee.stat_fired); - other = spectatee; MUTATOR_CALLHOOK(SpectateCopy); self.armortype = spectatee.armortype; @@ -2347,8 +2404,7 @@ float SpectateNext() { WriteEntity(MSG_ONE, self.enemy); //stuffcmd(self, "set viewsize $tmpviewsize \n"); self.movetype = MOVETYPE_NONE; - - self.enemy.weapon_count = 0; + accuracy_resend(self); if(!SpectateUpdate()) PutObserverInServer(); @@ -2388,23 +2444,21 @@ void ShowRespawnCountdown() void LeaveSpectatorMode() { if(isJoinAllowed()) { - if(!teams_matter || cvar("g_campaign") || cvar("g_balance_teams") || (self.wasplayer && cvar("g_changeteam_banned")) || self.team_forced > 0) { + if(!teams_matter || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) { self.classname = "player"; - if(cvar("g_campaign") || cvar("g_balance_teams") || cvar("g_balance_teams_force")) + if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) JoinBestTeam(self, FALSE, TRUE); - if(cvar("g_campaign")) + if(autocvar_g_campaign) campaign_bots_may_start = 1; - self.stat_count = WEP_LAST; - PutClientInServer(); if(self.classname == "player") bprint ("^4", self.netname, "^4 is playing now\n"); - if(!cvar("g_campaign")) + if(!autocvar_g_campaign) centerprint(self,""); // clear MOTD return; @@ -2432,7 +2486,7 @@ float isJoinAllowed() { if(self.team_forced < 0) return FALSE; // forced spectators can never join - if (!cvar("g_maxplayers")) + if (!autocvar_g_maxplayers) return TRUE; local entity e; @@ -2441,7 +2495,7 @@ float isJoinAllowed() { if(e.classname == "player") currentlyPlaying += 1; } - if(currentlyPlaying < cvar("g_maxplayers")) + if(currentlyPlaying < autocvar_g_maxplayers) return TRUE; return FALSE; @@ -2453,7 +2507,7 @@ float isJoinAllowed() { */ void checkSpectatorBlock() { if(self.classname == "spectator" || self.classname == "observer") { - if( time > (self.spectatortime + cvar("g_maxplayers_spectator_blocktime")) ) { + if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { sprint(self, "^7You were kicked from the server because you are spectator and spectators aren't allowed at the moment.\n"); dropclient(self); } @@ -2502,14 +2556,12 @@ void SpectatorThink() self.classname = "spectator"; } else { self.classname = "observer"; - self.stat_count = WEP_LAST; PutClientInServer(); } } else if (self.BUTTON_ATCK2) { self.welcomemessage_time = 0; self.flags &~= FL_JUMPRELEASED; self.classname = "observer"; - self.stat_count = WEP_LAST; PutClientInServer(); } else { if(!SpectateUpdate()) @@ -2546,8 +2598,8 @@ void() nexball_setstatus; void PlayerPreThink (void) { self.stat_game_starttime = game_starttime; - self.stat_allow_oldnexbeam = cvar("g_allow_oldnexbeam"); - self.stat_leadlimit = cvar("leadlimit"); + self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam; + self.stat_leadlimit = autocvar_leadlimit; if(frametime) { @@ -2563,7 +2615,7 @@ void PlayerPreThink (void) if(self.netname_previous != self.netname) { - if(cvar("sv_eventlog")) + if(autocvar_sv_eventlog) GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname)); if(self.netname_previous) strunzone(self.netname_previous); @@ -2577,24 +2629,24 @@ void PlayerPreThink (void) { if(strstr(self.cvar_g_xonoticversion, "git", 0) < 0) { - if(strstr(cvar_string("g_xonoticversion"), "git", 0) >= 0) + if(strstr(autocvar_g_xonoticversion, "git", 0) >= 0) { - dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); - sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); + dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); + sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); } else { float r; - r = vercmp(self.cvar_g_xonoticversion, cvar_string("g_xonoticversion")); + r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion); if(r < 0) { - dprint("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", cvar_string("g_xonoticversion"), "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n"); - sprint(self, strcat("\{1}^1NOTE: ^3Xonotic ", cvar_string("g_xonoticversion"), "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n")); + dprint("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n"); + sprint(self, strcat("\{1}^1NOTE: ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n")); } else if(r > 0) { - dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); - sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); + dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); + sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); } } } @@ -2648,18 +2700,18 @@ void PlayerPreThink (void) if(frametime) { - if(self.health <= 0 && cvar("g_deathglow")) + if(self.health <= 0 && autocvar_g_deathglow) { if(self.glowmod_x > 0) - self.glowmod_x -= cvar("g_deathglow") * frametime; + self.glowmod_x -= autocvar_g_deathglow * frametime; else self.glowmod_x = -1; if(self.glowmod_y > 0) - self.glowmod_y -= cvar("g_deathglow") * frametime; + self.glowmod_y -= autocvar_g_deathglow * frametime; else self.glowmod_y = -1; if(self.glowmod_z > 0) - self.glowmod_z -= cvar("g_deathglow") * frametime; + self.glowmod_z -= autocvar_g_deathglow * frametime; else self.glowmod_z = -1; } @@ -2685,7 +2737,7 @@ void PlayerPreThink (void) if(frametime) player_anim(); button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE); - force_respawn = (g_lms || (g_ca) || cvar("g_forced_respawn")); + force_respawn = (g_lms || (g_ca) || autocvar_g_forced_respawn); if (self.deadflag == DEAD_DYING) { if(force_respawn) @@ -2733,7 +2785,7 @@ void PlayerPreThink (void) } } - if(g_lms && !self.deadflag && cvar("g_lms_campcheck_interval")) + if(g_lms && !self.deadflag && autocvar_g_lms_campcheck_interval) { vector dist; @@ -2742,23 +2794,23 @@ void PlayerPreThink (void) dist_z = 0; self.lms_traveled_distance += fabs(vlen(dist)); - if((cvar("g_campaign") && !campaign_bots_may_start) || (time < game_starttime)) + if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime)) { - self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2; + self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2; self.lms_traveled_distance = 0; } if(time > self.lms_nextcheck) { //sprint(self, "distance: ", ftos(self.lms_traveled_distance), "\n"); - if(self.lms_traveled_distance < cvar("g_lms_campcheck_distance")) + if(self.lms_traveled_distance < autocvar_g_lms_campcheck_distance) { - centerprint(self, cvar_string("g_lms_campcheck_message")); + centerprint(self, autocvar_g_lms_campcheck_message); // FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3 // I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :( - 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'); + Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0'); } - self.lms_nextcheck = time + cvar("g_lms_campcheck_interval"); + self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval; self.lms_traveled_distance = 0; } } @@ -2820,8 +2872,8 @@ void PlayerPreThink (void) player_regen(); // rot nex charge to the charge limit - if(cvar("g_balance_nex_charge_rot_rate") && self.nex_charge > cvar("g_balance_nex_charge_limit") && self.nex_charge_rottime < time) - self.nex_charge = bound(cvar("g_balance_nex_charge_limit"), self.nex_charge - cvar("g_balance_nex_charge_rot_rate") * frametime / W_TICSPERFRAME, 1); + if(autocvar_g_balance_nex_charge_rot_rate && self.nex_charge > autocvar_g_balance_nex_charge_limit && self.nex_charge_rottime < time) + self.nex_charge = bound(autocvar_g_balance_nex_charge_limit, self.nex_charge - autocvar_g_balance_nex_charge_rot_rate * frametime / W_TICSPERFRAME, 1); if(frametime) player_anim(); @@ -2829,10 +2881,13 @@ void PlayerPreThink (void) if (g_minstagib) minstagib_ammocheck(); - ctf_setstatus(); - nexball_setstatus(); + if(g_ctf) + ctf_setstatus(); - self.dmg_team = max(0, self.dmg_team - cvar("g_teamdamage_resetspeed") * frametime); + if(g_nexball) + nexball_setstatus(); + + self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime); //self.angles_y=self.v_angle_y + 90; // temp } else if(gameover) { @@ -2846,7 +2901,7 @@ void PlayerPreThink (void) } if(!zoomstate_set) - SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_CAMPINGRIFLE && cvar("g_balance_campingrifle_secondary") == 0)); + SetZoomState(self.BUTTON_ZOOM || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_CAMPINGRIFLE && autocvar_g_balance_campingrifle_secondary == 0)); float oldspectatee_status; oldspectatee_status = self.spectatee_status; @@ -2902,12 +2957,12 @@ float isInvisibleString(string s) case 32: // space break; case 192: // charmap space - if (!cvar("utf8_enable")) + if (!autocvar_utf8_enable) break; return FALSE; case 160: // space in unicode fonts case 0xE000 + 192: // utf8 charmap space - if (cvar("utf8_enable")) + if (autocvar_utf8_enable) break; default: return FALSE; @@ -2944,15 +2999,6 @@ void PlayerPostThink (void) stuffcmd(self, strcat("name ", self.netname, substring(ftos(random()), 2, -1), "\n")); } - // send the clients accuracy stats to the client - if(self.stat_count > 0) - if(frametime) - { - self.stat_hit = self.stat_count + 64 * floor(self.(stats_hit[self.stat_count - 1])); - self.stat_fired = self.stat_count + 64 * floor(self.(stats_fired[self.stat_count - 1])); - self.stat_count -= 1; - } - if(sv_maxidle && frametime) { // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). @@ -3025,9 +3071,9 @@ void PlayerPostThink (void) //pointparticles(particleeffectnum("machinegun_impact"), self.origin + self.view_ofs + '0 0 7', '0 0 0', 1); if(self.waypointsprite_attachedforcarrier) - WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, cvar("g_balance_armor_blockpercent"))); + 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 && cvar("r_showbboxes")) + if(self.classname == "player" && self.deadflag == DEAD_NO && autocvar_r_showbboxes) { if(!self.showheadshotbbox) { @@ -3049,7 +3095,7 @@ void PlayerPostThink (void) playerdemo_write(); - if((g_cts || g_race) && self.cvar_cl_allow_uid2name) + if((g_cts || g_race) && self.cvar_cl_allow_uid2name == 1) { if(!self.stored_netname) self.stored_netname = strzone(uid2name(self.crypto_idfp));