]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/nades/nades.qc
Use the ONGROUND macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / nades / nades.qc
index 28aaac5dc17664df2622bcfab6634cc4ed3c66da..4b65abc55675319c966d3df4419be11b0f6867a7 100644 (file)
@@ -743,7 +743,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype,
        self.velocity += force;
        UpdateCSQCProjectile(self);
 
-       if(damage <= 0 || ((self.flags & FL_ONGROUND) && IS_PLAYER(attacker)))
+       if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker)))
                return;
 
        if(self.health == self.max_health)
@@ -1129,20 +1129,19 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
-               FOR_EACH_PLAYER(other) if(self != other)
-               {
-                       if(other.deadflag == DEAD_NO)
-                       if(other.frozen == 0)
-                       if(SAME_TEAM(other, self))
-                       if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, other.absmin, other.absmax))
+               FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+                       if(it.deadflag == DEAD_NO)
+                       if(it.frozen == 0)
+                       if(SAME_TEAM(it, self))
+                       if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, it.absmin, it.absmax))
                        {
                                if(!o)
-                                       o = other;
+                                       o = it;
                                if(self.frozen == 1)
-                                       other.reviving = true;
+                                       it.reviving = true;
                                ++n;
                        }
-               }
+               ));
        }
 
        if(n && self.frozen == 3) // OK, there is at least one teammate reviving us
@@ -1158,11 +1157,10 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                        Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
                }
 
-               FOR_EACH_PLAYER(other) if(other.reviving)
-               {
+               FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, LAMBDA(
                        other.revive_progress = self.revive_progress;
                        other.reviving = false;
-               }
+               ));
        }
 
        return false;