// disown the parent entity from this DamageText
// and (likely) give the entity a new DT afterwards
// this should only cancel damage accumulation for this DT
- if ((autocvar_cl_damagetext_accumulate_lifetime >= 0) // negative never disowns
- && (time - it.hit_time > autocvar_cl_damagetext_accumulate_lifetime)
- && (current_alpha(it) > alphathreshold))
+
+ if (flags & DTFLAG_STOP_ACCUMULATION
+ || ((autocvar_cl_damagetext_accumulate_lifetime >= 0) // negative never disowns
+ && (time - it.hit_time > autocvar_cl_damagetext_accumulate_lifetime)
+ && (current_alpha(it) > alphathreshold)))
{
it.m_group = 0;
}
.float dent_net_health;
.float dent_net_armor;
.float dent_net_potential;
+.entity dent_attackers;
bool write_damagetext(entity this, entity client, int sf)
{
net_text_prev.dent_net_potential = potential_damage;
return;
}
+ else if (!IL_CONTAINS(hit.dent_attackers, attacker))
+ {
+ // player is hit for the first time after respawn by this attacker
+ IL_PUSH(hit.dent_attackers, attacker);
+ flags |= DTFLAG_STOP_ACCUMULATION; // forcedly stop client-side damage accumulation
+ }
+
entity net_text = new_pure(net_damagetext);
net_text.realowner = attacker;
net_text.enemy = hit;
Net_LinkEntity(net_text, false, 0, write_damagetext);
}
+
+MUTATOR_HOOKFUNCTION(damagetext, ClientDisconnect)
+{
+ entity player = M_ARGV(0, entity);
+ if (player.dent_attackers)
+ IL_DELETE(player.dent_attackers);
+
+ // NOTE this player is automatically removed from dent_attackers lists of other players
+ // by intrusive list's ONREMOVE
+}
+
+MUTATOR_HOOKFUNCTION(damagetext, PlayerSpawn)
+{
+ entity player = M_ARGV(0, entity);
+ if (player.dent_attackers == NULL)
+ {
+ player.dent_attackers = IL_NEW();
+ return true;
+ }
+
+ IL_CLEAR(player.dent_attackers);
+}