From: TimePath Date: Sun, 23 Aug 2015 04:05:55 +0000 (+1000) Subject: Show damage text for spectators X-Git-Tag: xonotic-v0.8.2~2054^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d0b453c6a90568139aefb9c99111bed90c35af8e;p=xonotic%2Fxonotic-data.pk3dir.git Show damage text for spectators --- 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