]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/damagetext/damagetext.qc
Merge branch 'terencehill/menu_fixes' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / damagetext / damagetext.qc
index 264a412b0c14eb1d483f4a8b734f05a45fbaa813..5fb4b1bf4cc3615bf98aefffab3b6e2a7db7eaca 100644 (file)
@@ -2,7 +2,7 @@
 #define MUTATOR_DAMAGETEXT_H
 
 #ifdef MENUQC
-#include "../../../../menu/xonotic/tab.qc"
+#include <menu/xonotic/tab.qc>
 #endif
 
 #endif
@@ -88,23 +88,24 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) {
     const int armor = MUTATOR_ARGV(1, int);
     const int deathtype = MUTATOR_ARGV(2, int);
     const vector location = hit.origin;
-    entity e;
-    FOR_EACH_REALCLIENT(e) if (
-        (SV_DAMAGETEXT_ALL()) ||
-        (SV_DAMAGETEXT_PLAYERS() && e == attacker) ||
-        (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_SPEC(e) && e.enemy == attacker) ||
-        (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_OBSERVER(e))
-    ) {
-        msg_entity = e;
-        WriteHeader(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);
-        WriteInt24_t(MSG_ONE, deathtype);
-    }
+    FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+        if (
+            (SV_DAMAGETEXT_ALL()) ||
+            (SV_DAMAGETEXT_PLAYERS() && it == attacker) ||
+            (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_SPEC(it) && it.enemy == attacker) ||
+            (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_OBSERVER(it))
+        ) {
+            msg_entity = it;
+            WriteHeader(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);
+            WriteInt24_t(MSG_ONE, deathtype);
+        }
+    ));
 }
 #endif
 
@@ -133,7 +134,7 @@ NET_HANDLE(damagetext, bool isNew)
 
 #ifdef MENUQC
 CLASS(XonoticDamageTextSettings, XonoticTab)
-    #include "../../../../menu/gamesettings.qh"
+    #include <menu/gamesettings.qh>
     REGISTER_SETTINGS(damagetext, NEW(XonoticDamageTextSettings));
     ATTRIB(XonoticDamageTextSettings, title, string, _("Damage text"))
     ATTRIB(XonoticDamageTextSettings, intendedWidth, float, 0.9)