From b2e9de184227b0f37a03cfd18accec576f904625 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sun, 4 Nov 2018 14:32:25 +0100 Subject: [PATCH] fix issue 1994 in a better way --- .../mutator/damagetext/cl_damagetext.qc | 17 ++++++++--------- .../mutator/damagetext/ui_damagetext.qc | 4 +++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc index 35ae33bda..e9d2acd8f 100644 --- a/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc @@ -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; - } + // using 1 as minimum because of shotgun (same as menu) + 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)); diff --git a/qcsrc/common/mutators/mutator/damagetext/ui_damagetext.qc b/qcsrc/common/mutators/mutator/damagetext/ui_damagetext.qc index 26972682a..6ba83e922 100644 --- a/qcsrc/common/mutators/mutator/damagetext/ui_damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext/ui_damagetext.qc @@ -29,7 +29,9 @@ CLASS(XonoticDamageTextSettings, XonoticTab) this.TR(this); this.TD(this, 1, 1, e = makeXonoticTextLabel(0, _("Accumulate range:"))); setDependent(e, "cl_damagetext", 1, 1); - // 1 as min because shotgun sends damagetext per pellet (see https://gitlab.com/xonotic/xonotic-data.pk3dir/issues/1994) + // 1 as min because shotgun sends damagetext per pellet (see https://gitlab.com/xonotic/xonotic-data.pk3dir/issues/1994). + // It's capped to 1 in code too but let's not lie to users by allowing the slider to go to 0, it would still accumulate + // when hitting a stationary player using a weapon with no push. this.TD(this, 1, 2, e = makeXonoticSlider(1, 500, 1, "cl_damagetext_accumulate_range")); setDependent(e, "cl_damagetext", 1, 1); this.TR(this); -- 2.39.2