]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_common.qc
Replace all player/bot/spectator classname checks with macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_common.qc
index 67f5b3356b056b0d63c071877068247b87376897..592fa7df35d86e9302bc6d15bae0e62a5fd6ff89 100644 (file)
@@ -12,7 +12,7 @@ void W_GiveWeapon (entity e, float wep, string name)
        self = e;
 
        if not(g_minstagib)
-       if (other.classname == "player")
+       if (IS_PLAYER(other))
        {
                sprint (other, "You got the ^2");
                sprint (other, name);
@@ -109,7 +109,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        // Find all non-hit players the beam passed close by
        if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX)
        {
-               FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(msg_entity.classname == "spectator" && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
+               FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(IS_SPEC(msg_entity) && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
                {
                        // nearest point on the beam
                        beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
@@ -445,7 +445,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                lag = ANTILAG_LATENCY(self);
                if(lag < 0.001)
                        lag = 0;
-               if(clienttype(self) != CLIENTTYPE_REAL)
+               if not(IS_REAL_CLIENT(self))
                        lag = 0;
                if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
                        lag = 0; // only do hitscan, but no antilag
@@ -618,7 +618,7 @@ void W_PrepareExplosionByDamage(entity attacker, void() explode)
        self.takedamage = DAMAGE_NO;
        self.event_damage = func_null;
        
-       if((attacker.flags & FL_CLIENT) && !autocvar_g_projectiles_keep_owner)
+       if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
                self.owner = attacker;
                self.realowner = attacker;