]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Player templates: Added no blaster selfdamage option.
authorLyberta <lyberta@lyberta.net>
Thu, 1 Jun 2017 10:14:08 +0000 (13:14 +0300)
committerLyberta <lyberta@lyberta.net>
Thu, 1 Jun 2017 10:14:08 +0000 (13:14 +0300)
qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qc
qcsrc/common/mutators/mutator/playertemplates/sv_playertemplates.qh

index fc68643c9d8cbe09990d4324af9f5e29282d5d32..b8142494f890432d65b890ec5216d5e97779ca80 100644 (file)
@@ -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;
index eea424192930576d947b4973d8126ecb07ad6dc2..3242690cb0f57b75642dff01f4fb204b1c1d4a8c 100644 (file)
@@ -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);