]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show damage text for spectators
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 23 Aug 2015 04:05:55 +0000 (14:05 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 23 Aug 2015 04:11:02 +0000 (14:11 +1000)
qcsrc/common/mutators/mutator/damagetext.qc

index 143c1679787c6d0a34c70f1e92fce81568616abc..884b74ed06bd5f75988c234771793648db7e8f95 100644 (file)
@@ -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