From d0b453c6a90568139aefb9c99111bed90c35af8e Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 23 Aug 2015 14:05:55 +1000 Subject: [PATCH] Show damage text for spectators --- qcsrc/common/mutators/mutator/damagetext.qc | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/qcsrc/common/mutators/mutator/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext.qc index 143c16797..884b74ed0 100644 --- a/qcsrc/common/mutators/mutator/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext.qc @@ -54,20 +54,23 @@ ENDCLASS(DamageText) #ifdef SVQC MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) { - const entity me = mutator_argv_entity_0; if (!IS_REAL_CLIENT(me)) return; - const entity hit = mutator_argv_entity_1; if (hit == me) return; + const entity attacker = mutator_argv_entity_0; + const entity hit = mutator_argv_entity_1; if (hit == attacker) return; const int health = mutator_argv_int_0; const int armor = mutator_argv_int_1; const vector location = hit.origin; - msg_entity = me; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteMutator(MSG_ONE, damagetext); - WriteShort(MSG_ONE, health); - WriteShort(MSG_ONE, armor); - WriteEntity(MSG_ONE, hit); - WriteCoord(MSG_ONE, location.x); - WriteCoord(MSG_ONE, location.y); - WriteCoord(MSG_ONE, location.z); + entity e; + FOR_EACH_REALCLIENT(e) if (e == attacker || (IS_SPEC(e) && e.enemy == attacker)) { + msg_entity = e; + WriteByte(MSG_ONE, SVC_TEMPENTITY); + WriteMutator(MSG_ONE, damagetext); + WriteShort(MSG_ONE, health); + WriteShort(MSG_ONE, armor); + WriteEntity(MSG_ONE, hit); + WriteCoord(MSG_ONE, location.x); + WriteCoord(MSG_ONE, location.y); + WriteCoord(MSG_ONE, location.z); + } } #endif -- 2.39.2