]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'DefaultUser/more_damagetext' into 'master'
authorMario <zacjardine@y7mail.com>
Thu, 10 Nov 2016 15:58:10 +0000 (15:58 +0000)
committerMario <zacjardine@y7mail.com>
Thu, 10 Nov 2016 15:58:10 +0000 (15:58 +0000)
Add more options for damagetext

{potential} describes the full damage the target took without capping it when the target dies
{potential_health} describes the health damage the target took without capping it when the target dies

See merge request !382

1  2 
defaultXonotic.cfg
qcsrc/server/mutators/events.qh
qcsrc/server/player.qc

diff --combined defaultXonotic.cfg
index 5df6d59bb47423025b8a9eb9f089d284ea012e1d,0ae1e3dae708707bde38daea3d0cfbf6cb6a7590..bc346e94a7e6c66d1e10a0daadb4852a7a537c0d
@@@ -782,7 -782,7 +782,7 @@@ seta g_waypointsprite_turrets_maxdist 5
  seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
  
  seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
- seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}"
+ seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}, {potential_health}"
  seta cl_damagetext_color "1 1 0" "Damage text color"
  seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
  seta cl_damagetext_size "8" "Damage text font size"
@@@ -791,7 -791,6 +791,7 @@@ seta cl_damagetext_alpha_lifetime "3" "
  seta cl_damagetext_velocity "0 0 20" "Damage text move direction"
  seta cl_damagetext_offset "0 -40 0" "Damage text offset"
  seta cl_damagetext_accumulate_range "30" "Damage text spawned within this range is accumulated"
 +seta cl_damagetext_accumulate_alpha_rel "0.65" "Only update existing damage text when it's above this much percentage (0 to 1) of the starting alpha"
  seta cl_damagetext_friendlyfire "1" "Show damage text for friendlyfire too"
  seta cl_damagetext_friendlyfire_color "1 0 0" "Damage text color for friendlyfire"
  
index 9d7d8af916e5d621230698b9accc6b2d1d840bae,0a5b823fb5b6ac14f2c39690385ca77b338c4804..21c8ef9a5c114e92b0650f4ca5b6ec251a14d3a5
@@@ -359,6 -359,7 +359,7 @@@ MUTATOR_HOOKABLE(PlayerDamage_Calculate
      /** armor     */ i(float,    MUTATOR_ARGV_3_float) \
      /** location  */ i(vector, MUTATOR_ARGV_4_vector) \
      /** deathtype */ i(int,    MUTATOR_ARGV_5_int) \
+     /** potential_damage     */ i(float,    MUTATOR_ARGV_6_float) \
      /**/
  MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
  
@@@ -540,7 -541,7 +541,7 @@@ MUTATOR_HOOKABLE(HelpMePing, EV_HelpMeP
  
  /**
   * called when a vehicle initializes
 - * return false to remove the vehicle
 + * return true to remove the vehicle
   */
  #define EV_VehicleInit(i, o) \
      /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
diff --combined qcsrc/server/player.qc
index 77eae0aa20c516594e1e5b71c43f637468a83a2b,9df628860318b2a005b4a755f5c8e4d6ad64c759..904447c218418c936f5f933cce7cf13062813c61
@@@ -62,8 -62,6 +62,8 @@@ void CopyBody(entity this, float keepve
        clone.iscreature = this.iscreature;
        clone.teleportable = this.teleportable;
        clone.damagedbycontents = this.damagedbycontents;
 +      if(clone.damagedbycontents)
 +              IL_PUSH(g_damagedbycontents, clone);
        clone.angles = this.angles;
        clone.v_angle = this.v_angle;
        clone.avelocity = this.avelocity;
@@@ -214,8 -212,6 +214,8 @@@ void PlayerCorpseDamage(entity this, en
                this.alpha = -1;
                this.solid = SOLID_NOT; // restore later
                this.takedamage = DAMAGE_NO; // restore later
 +              if(this.damagedbycontents)
 +                      IL_REMOVE(g_damagedbycontents, this);
                this.damagedbycontents = false;
        }
  }
@@@ -509,9 -505,9 +509,9 @@@ void PlayerDamage(entity this, entity i
        {
                WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da);
        }
-       if (dh + da)
+       if (damage)
        {
-               MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype);
+               MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
        }
  
        if (this.health < 1)