From: Lyberta Date: Thu, 1 Jun 2017 10:14:08 +0000 (+0300) Subject: Player templates: Added no blaster selfdamage option. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=89508e151b28b8b79f50dd7d834c5bb856c9cd24;p=xonotic%2Fxonotic-data.pk3dir.git Player templates: Added no blaster selfdamage option. --- diff --git a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc index fc68643c9d..b8142494f8 100644 --- a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc +++ b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc @@ -88,6 +88,10 @@ float PlayerTemplate_GetDefaultFloatValue(string variable) { return 1; } + case "blaster_self_damage": + { + return 1; + } default: { // TODO: Report error. @@ -981,8 +985,14 @@ float PlayerTemplate_ItemTouch(entity player, entity item, string template) } float PlayerTemplate_Damage_Calculate(entity attacker, string attackertemplate, - entity victim, string victimtemplate, float damage) + entity victim, string victimtemplate, float deathtype, float damage) { + if ((attacker == victim) && (DEATH_ISWEAPON(deathtype, WEP_BLASTER)) && + (PlayerTemplate_GetFloatValue(victimtemplate, "blaster_self_damage") == + 0)) + { + return 0; + } damage *= PlayerTemplate_GetFloatValue(attackertemplate, "attack_scale"); damage /= PlayerTemplate_GetFloatValue(victimtemplate, "defense_scale"); return damage; diff --git a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh index eea4241929..3242690cb0 100644 --- a/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh +++ b/qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh @@ -66,7 +66,8 @@ float PlayerTemplate_ItemTouch(entity player, entity item, string template); /// \param[in] attackertemplate Template of the attacker. /// \param[in] victim Victim entity. /// \param[in] victimtemplate Template of the victim. +/// \param[in] deathtype Type of the damage. /// \param[in] damage Damage to adjust. /// \return Adjusted damage. float PlayerTemplate_Damage_Calculate(entity attacker, string attackertemplate, - entity victim, string victimtemplate, float damage); + entity victim, string victimtemplate, float deathtype, float damage);