]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc
Update hash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / damagetext / cl_damagetext.qc
index c6fef763350f3c6ac9b766287bfbb048f94b428e..5e59fd9f3274471f866e363894bcb5c510eed6f8 100644 (file)
@@ -23,7 +23,7 @@ AUTOCVAR_SAVE(cl_damagetext_alpha_start,            float,  1,          "Damage
 AUTOCVAR_SAVE(cl_damagetext_alpha_lifetime,         float,  3,          "Damage text lifetime in seconds");
 AUTOCVAR_SAVE(cl_damagetext_velocity_screen,        vector, '0 0 0',    "Damage text move direction (screen coordinates)");
 AUTOCVAR_SAVE(cl_damagetext_velocity_world,         vector, '0 0 20',   "Damage text move direction (world coordinates relative to player's view)");
-AUTOCVAR_SAVE(cl_damagetext_offset_screen,          vector, '0 -40 0',  "Damage text offset (screen coordinates)");
+AUTOCVAR_SAVE(cl_damagetext_offset_screen,          vector, '0 -45 0',  "Damage text offset (screen coordinates)");
 AUTOCVAR_SAVE(cl_damagetext_offset_world,           vector, '0 0 0',    "Damage text offset (world coordinates relative to player's view)");
 AUTOCVAR_SAVE(cl_damagetext_accumulate_range,       float,  30,         "Damage text spawned within this range is accumulated");
 AUTOCVAR_SAVE(cl_damagetext_accumulate_alpha_rel,   float,  0.65,       "Only update existing damage text when it's above this much percentage (0 to 1) of the starting alpha");
@@ -237,15 +237,14 @@ NET_HANDLE(damagetext, bool isNew)
 
     if (can_use_3d && !prefer_2d) {
         // world coords
-        if (autocvar_cl_damagetext_accumulate_range) {
-            for (entity e = findradius(entcs.origin, autocvar_cl_damagetext_accumulate_range); e; e = e.chain) {
-                if (e.instanceOfDamageText
-                    && !e.m_screen_coords // we're using origin for both world coords and screen coords so avoid mismatches
-                    && e.m_group == server_entity_index
-                    && current_alpha(e) > autocvar_cl_damagetext_accumulate_alpha_rel * autocvar_cl_damagetext_alpha_start) {
-                    DamageText_update(e, entcs.origin, e.m_healthdamage + health, e.m_armordamage + armor, e.m_potential_damage + potential_damage, deathtype);
-                    return;
-                }
+        // 1 as min because shotgun sends damagetext per pellet (see https://gitlab.com/xonotic/xonotic-data.pk3dir/issues/1994).
+        for (entity e = findradius(entcs.origin, max(autocvar_cl_damagetext_accumulate_range, 1)); e; e = e.chain) {
+            if (e.instanceOfDamageText
+                && !e.m_screen_coords // we're using origin for both world coords and screen coords so avoid mismatches
+                && e.m_group == server_entity_index
+                && current_alpha(e) > autocvar_cl_damagetext_accumulate_alpha_rel * autocvar_cl_damagetext_alpha_start) {
+                DamageText_update(e, entcs.origin, e.m_healthdamage + health, e.m_armordamage + armor, e.m_potential_damage + potential_damage, deathtype);
+                return;
             }
         }
         make_impure(NEW(DamageText, server_entity_index, entcs.origin, false, health, armor, potential_damage, deathtype, friendlyfire));