X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_player.qc;h=d80848f5a6f4cbb11db0be0d053f495260011863;hp=3e507f4ab644b2bb25f1d2eced3a7a3363e4b178;hb=9c40c25078426ed90e985c402c648fea3e3a8832;hpb=48fccca0eefd5b290d47ff7f86064962f9c8a0e1 diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 3e507f4ab..d80848f5a 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -1,3 +1,6 @@ +.entity accuracy; +.float accuracy_frags[WEP_MAXCOUNT]; + float weaponstats_buffer; void WeaponStats_Init() @@ -337,11 +340,11 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CHAN_PROJECTILE, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); else if (take > 30) - sound (self, CHAN_PROJECTILE, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); else if (take > 10) - sound (self, CHAN_PROJECTILE, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); } if (take > 50) @@ -384,7 +387,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht float valid_damage_for_weaponstats; float excess; - if((g_arena && numspawned < 2) || (g_ca && ca_players < required_ca_players) && !inWarmupStage) + if((g_arena && numspawned < 2) || (g_ca && !ca_teams_ok) && !inWarmupStage) return; dh = max(self.health, 0); @@ -454,11 +457,11 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CHAN_PROJECTILE, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); else if (take > 30) - sound (self, CHAN_PROJECTILE, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); else if (take > 10) - sound (self, CHAN_PROJECTILE, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); // FIXME possibly remove them? + sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); // FIXME possibly remove them? } if (take > 50) @@ -494,15 +497,15 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two { if(deathtype == DEATH_FALL) - PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 75) // TODO make a "gentle" version? - PlayerSound(playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 50) - PlayerSound(playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND); else if(self.health > 25) - PlayerSound(playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND); else - PlayerSound(playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND); } } @@ -526,7 +529,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // escape a lava pit or similar //self.pushltime = 0; } - else if(attacker.classname == "player" || attacker.classname == "gib") + else if(attacker.classname == "player") { self.pusher = attacker; self.pushltime = time + autocvar_g_maxpushtime; @@ -555,7 +558,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht awep = DEATH_WEAPONOF(deathtype); valid_damage_for_weaponstats = 1; } - + if(valid_damage_for_weaponstats) { dh = dh - max(self.health, 0); @@ -581,9 +584,9 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(sound_allowed(MSG_BROADCAST, attacker)) { if(deathtype == DEATH_DROWN) - PlayerSound(playersound_drown, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND); else - PlayerSound(playersound_death, CHAN_PAIN, VOICETYPE_PLAYERSOUND); + PlayerSound(playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND); } // get rid of kill indicator @@ -615,6 +618,14 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht race_PreDie(); DropAllRunes(self); + // increment frag counter for used weapon type + float w; + w = DEATH_WEAPONOF(deathtype); + if(WEP_VALID(w)) + if(self.classname == "player") + if(self != attacker) + attacker.accuracy.(accuracy_frags[w-1]) += 1; + if(deathtype == DEATH_HURTTRIGGER && g_freezetag) { PutClientInServer(); @@ -631,7 +642,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(self.flagcarried) { - if(attacker.classname != "player" && attacker.classname != "gib") + if(attacker.classname != "player") DropFlag(self.flagcarried, self, attacker); // penalty for flag loss by suicide else if(attacker.team == self.team) DropFlag(self.flagcarried, attacker, attacker); // penalty for flag loss by suicide/teamkill @@ -735,72 +746,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht } } -// sendflags use: 1 = origin, 2 = health (0 or 1 for dead/alive on enemies), 4 = armor, 0x80 = same team (includes health) -float SendEntity_ShowNames(entity to, float sendflags) -{ - float the_health; - the_health = self.health; - - WriteByte(MSG_ENTITY, ENT_CLIENT_SHOWNAMES); - WriteByte(MSG_ENTITY, num_for_edict(self.owner)); - - sendflags = sendflags & 127; - if(teams_matter && self.owner.team == to.team) - sendflags |= 128; - else if(self.owner.health >= 1) - the_health = 1; - - WriteByte(MSG_ENTITY, sendflags); - if(sendflags & 1) - { - WriteShort(MSG_ENTITY, rint(self.origin_x)); - WriteShort(MSG_ENTITY, rint(self.origin_y)); - WriteShort(MSG_ENTITY, rint(self.origin_z)); - } - if(sendflags & 2) - { - WriteByte(MSG_ENTITY, the_health); - } - if(sendflags & 4) - { - WriteByte(MSG_ENTITY, self.armorvalue); - } - return TRUE; -} - -const vector SHOWNAMES_ORIGIN_OFFSET = '0 0 48'; -void shownames_think() -{ - if(self.origin - SHOWNAMES_ORIGIN_OFFSET != self.owner.origin) - { - setorigin(self, self.owner.origin + SHOWNAMES_ORIGIN_OFFSET); - self.SendFlags |= 1; - } - if(self.health != max(0, floor(self.owner.health)) || self.armorvalue != max(0, floor(self.owner.armorvalue))) - { - self.health = max(0, floor(self.owner.health)); - self.armorvalue = max(0, floor(self.owner.armorvalue)); - self.SendFlags |= 2; - } - if(self.armorvalue != max(0, floor(self.owner.armorvalue))) - { - self.armorvalue = max(0, floor(self.owner.armorvalue)); - self.SendFlags |= 4; - } - self.nextthink = time; -} - -float shownames_customize() -{ - if(self.owner.classname == "player") // only send players, no spectators! - if(self.owner != other) // no need to spam own coordinates - if(vlen(other.origin - self.origin) < autocvar_sv_shownames_cull_distance) // distance cull - if(self.owner.team == other.team || (self.owner.team != other.team && checkpvs(self.origin, other))) - return TRUE; - - return FALSE; -} - .float muted; // to be used by prvm_edictset server playernumber muted 1 float Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol) // message "": do not say, just test flood control @@ -826,7 +771,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f if(source.classname != "player") colorstr = "^0"; // black for spectators - else if(teams_matter) + else if(teamplay) colorstr = Team_ColorCode(source.team); else teamsay = FALSE; @@ -1188,8 +1133,9 @@ void UpdatePlayerSounds() self.skinindex_for_playersound = self.skinindex; ClearPlayerSounds(); LoadPlayerSounds("sound/player/default.sounds", 1); - if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0)) - LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0); + if(!autocvar_g_debug_defaultsounds) + if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0)) + LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0); } void FakeGlobalSound(string sample, float chan, float voicetype) @@ -1315,7 +1261,7 @@ void GlobalSound(string sample, float chan, float voicetype) break; case VOICETYPE_TEAMRADIO: FOR_EACH_REALCLIENT(msg_entity) - if(!teams_matter || msg_entity.team == self.team) + if(!teamplay || msg_entity.team == self.team) { if(msg_entity.cvar_cl_voice_directional == 1) soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); @@ -1389,9 +1335,9 @@ void VoiceMessage(string type, string msg) flood = Say(self, ownteam, world, msg, 1); if (flood > 0) - GlobalSound(self.sample, CHAN_VOICE, voicetype); + GlobalSound(self.sample, CH_VOICE, voicetype); else if (flood < 0) - FakeGlobalSound(self.sample, CHAN_VOICE, voicetype); + FakeGlobalSound(self.sample, CH_VOICE, voicetype); } void MoveToTeam(entity client, float team_colour, float type, float show_message)