X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_player.qc;h=1227a3e9da8329e3982224836710f5d0f4c3b85c;hp=95aeced31b308b5db10fa4ab9da332baab5151aa;hb=719b47d60479f233baa8719e66e73a60bff28176;hpb=58b8eafbf5e2ff9147477e115292246458c4c5eb diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 95aeced31..1227a3e9d 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -262,25 +262,9 @@ void player_anim (void) void SpawnThrownWeapon (vector org, float w) { - if(g_minstagib) - if(self.ammo_cells <= 0) - return; - - if(g_pinata) - { - float j; - for(j = WEP_FIRST; j <= WEP_LAST; ++j) - { - if(WEPSET_CONTAINS_EW(self, j)) - if(W_IsWeaponThrowable(j)) - W_ThrowNewWeapon(self, j, FALSE, org, randomvec() * 175 + '0 0 325'); - } - } - else - { + if(self.weapons & WepSet_FromWeapon(self.weapon)) if(W_IsWeaponThrowable(self.weapon)) W_ThrowNewWeapon(self, self.weapon, FALSE, org, randomvec() * 125 + '0 0 200'); - } } void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) @@ -299,11 +283,11 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); } if (take > 50) @@ -387,17 +371,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); - if (!g_minstagib) - { - v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage); - take = v_x; - save = v_y; - } - else - { - save = 0; - take = damage; - } + + v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage); + take = v_x; + save = v_y; if(attacker == self) { @@ -406,7 +383,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht //self.pushltime = 0; self.istypefrag = 0; } - else if(attacker.classname == "player") + else if(IS_PLAYER(attacker)) { self.pusher = attacker; self.pushltime = time + autocvar_g_maxpushtime; @@ -426,6 +403,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht frag_inflictor = inflictor; frag_attacker = attacker; frag_target = self; + frag_damage = damage; damage_take = take; damage_save = save; damage_force = force; @@ -437,11 +415,11 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if(sound_allowed(MSG_BROADCAST, attacker)) { if (save > 10) - sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/armorimpact.wav", VOL_BASE, ATTEN_NORM); else if (take > 30) - sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTN_NORM); + sound (self, CH_SHOTS, "misc/bodyimpact2.wav", VOL_BASE, ATTEN_NORM); else if (take > 10) - sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTN_NORM); // FIXME possibly remove them? + sound (self, CH_SHOTS, "misc/bodyimpact1.wav", VOL_BASE, ATTEN_NORM); // FIXME possibly remove them? } if (take > 50) @@ -507,18 +485,15 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht self.dmg_take = self.dmg_take + take;//max(take - 10, 0); self.dmg_inflictor = inflictor; - if(g_ca && self != attacker && attacker.classname == "player") - PlayerScore_Add(attacker, SP_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier); - float abot, vbot, awep; - abot = (clienttype(attacker) == CLIENTTYPE_BOT); - vbot = (clienttype(self) == CLIENTTYPE_BOT); + abot = (IS_BOT_CLIENT(attacker)); + vbot = (IS_BOT_CLIENT(self)); valid_damage_for_weaponstats = 0; awep = 0; - if(vbot || clienttype(self) == CLIENTTYPE_REAL) - if(abot || clienttype(attacker) == CLIENTTYPE_REAL) + if(vbot || IS_REAL_CLIENT(self)) + if(abot || IS_REAL_CLIENT(attacker)) if(attacker && self != attacker) if(IsDifferentTeam(self, attacker)) { @@ -598,7 +573,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht Portal_ClearAllLater(self); - if(clienttype(self) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(self)) { self.fixangle = TRUE; //msg_entity = self; @@ -613,7 +588,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht // player could have been miraculously resuscitated ;) // e.g. players in freezetag get frozen, they don't really die - if(self.health >= 1 || self.classname != "player") + if(self.health >= 1 || !IS_PLAYER(self)) return; // when we get here, player actually dies @@ -638,7 +613,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht self.solid = SOLID_CORPSE; self.ballistics_density = autocvar_g_ballistics_density_corpse; // don't stick to the floor - self.flags &~= FL_ONGROUND; + self.flags &= ~FL_ONGROUND; // dying animation self.deadflag = DEAD_DYING; // when to allow respawn @@ -664,7 +639,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else self.respawn_countdown = -1; // do not count down - if(g_lms || g_cts || autocvar_g_forced_respawn) + if(g_cts || autocvar_g_forced_respawn) self.respawn_flags = self.respawn_flags | RESPAWN_FORCE; self.death_time = time; @@ -719,7 +694,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f msgin = formatmessage(msgin); - if(source.classname != "player") + if not(IS_PLAYER(source)) colorstr = "^0"; // black for spectators else if(teamplay) colorstr = Team_ColorCode(source.team); @@ -879,10 +854,10 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f } if(!privatesay) - if(source.classname != "player") + if not(IS_PLAYER(source)) { if not(intermission_running) - if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(inWarmupStage || gameover))) + if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover))) teamsay = -1; // spectators } @@ -947,7 +922,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f { sprint(source, sourcemsgstr); dedicated_print(msgstr); // send to server console too - FOR_EACH_REALCLIENT(head) if(head.classname != "player") + FOR_EACH_REALCLIENT(head) if not(IS_PLAYER(head)) if(head != source) sprint(head, msgstr); } @@ -1120,16 +1095,16 @@ void FakeGlobalSound(string sample, float chan, float voicetype) if(self.pusher) { msg_entity = self; - if(clienttype(msg_entity) == CLIENTTYPE_REAL) - soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE); + if(IS_REAL_CLIENT(msg_entity)) + soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTEN_NONE); } break; case VOICETYPE_TEAMRADIO: msg_entity = self; if(msg_entity.cvar_cl_voice_directional == 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_MIN); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); break; case VOICETYPE_AUTOTAUNT: if(!sv_autotaunt) @@ -1143,13 +1118,13 @@ void FakeGlobalSound(string sample, float chan, float voicetype) if (tauntrand < msg_entity.cvar_cl_autotaunt) { if (msg_entity.cvar_cl_voice_directional >= 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTEN_MAX)); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } break; case VOICETYPE_TAUNT: - if(self.classname == "player") + if(IS_PLAYER(self)) if(self.deadflag == DEAD_NO) animdecide_setaction(self, ANIMACTION_TAUNT, TRUE); if(!sv_taunt) @@ -1158,13 +1133,13 @@ void FakeGlobalSound(string sample, float chan, float voicetype) break; msg_entity = self; if (msg_entity.cvar_cl_voice_directional >= 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTEN_MAX)); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); break; case VOICETYPE_PLAYERSOUND: msg_entity = self; - soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NORM); + soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTEN_NORM); break; default: backtrace("Invalid voice type!"); @@ -1193,12 +1168,12 @@ void GlobalSound(string sample, float chan, float voicetype) if(self.pusher) { msg_entity = self.pusher; - if(clienttype(msg_entity) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(msg_entity)) { if(msg_entity.cvar_cl_voice_directional == 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_MIN); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } } break; @@ -1206,16 +1181,16 @@ void GlobalSound(string sample, float chan, float voicetype) if(self.pusher) { msg_entity = self.pusher; - if(clienttype(msg_entity) == CLIENTTYPE_REAL) + if(IS_REAL_CLIENT(msg_entity)) { if(msg_entity.cvar_cl_voice_directional == 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_MIN); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } msg_entity = self; - if(clienttype(msg_entity) == CLIENTTYPE_REAL) - soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE); + if(IS_REAL_CLIENT(msg_entity)) + soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTEN_NONE); } break; case VOICETYPE_TEAMRADIO: @@ -1223,9 +1198,9 @@ void GlobalSound(string sample, float chan, float voicetype) 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); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_MIN); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } break; case VOICETYPE_AUTOTAUNT: @@ -1240,13 +1215,13 @@ void GlobalSound(string sample, float chan, float voicetype) if (tauntrand < msg_entity.cvar_cl_autotaunt) { if (msg_entity.cvar_cl_voice_directional >= 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTEN_MAX)); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } break; case VOICETYPE_TAUNT: - if(self.classname == "player") + if(IS_PLAYER(self)) if(self.deadflag == DEAD_NO) animdecide_setaction(self, ANIMACTION_TAUNT, TRUE); if(!sv_taunt) @@ -1256,13 +1231,13 @@ void GlobalSound(string sample, float chan, float voicetype) FOR_EACH_REALCLIENT(msg_entity) { if (msg_entity.cvar_cl_voice_directional >= 1) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTEN_MAX)); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTEN_NONE); } break; case VOICETYPE_PLAYERSOUND: - sound(self, chan, sample, VOL_BASE, ATTN_NORM); + sound(self, chan, sample, VOL_BASE, ATTEN_NORM); break; default: backtrace("Invalid voice type!");