]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/ent_cs.qc
remove entity spam from shownames
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / ent_cs.qc
index 970f20a9205a1bdc3200fae83f477ed38dcc8226..0a477b1b4d5298738f52c5c778cc7cdf3d8aa839 100644 (file)
@@ -39,20 +39,27 @@ float entcs_customize()
 
 float entcs_send(entity to, float sf)
 {
-       entity o;
-       o = self.owner;
+       sf |= 128;
+       if(teams_matter && !radar_showennemies)
+               if(to.team != self.team)
+                       sf &~= (8 | 16 | 128); // don't send h/a for enemies
+
        WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
        WriteByte(MSG_ENTITY, sf);
        if(sf & 1)
-               WriteByte(MSG_ENTITY, num_for_edict(o));
+               WriteByte(MSG_ENTITY, num_for_edict(self.owner));
        if(sf & 2)
        {
-               WriteShort(MSG_ENTITY, o.origin_x);
-               WriteShort(MSG_ENTITY, o.origin_y);
-               WriteShort(MSG_ENTITY, o.origin_z);
+               WriteShort(MSG_ENTITY, self.origin_x);
+               WriteShort(MSG_ENTITY, self.origin_y);
+               WriteShort(MSG_ENTITY, self.origin_z);
        }
        if(sf & 4)
-               WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360);
+               WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);
+       if(sf & 8)
+               WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
+       if(sf & 16)
+               WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
        return TRUE;
 };
 
@@ -73,6 +80,16 @@ void entcs_think()
                self.angles = o.angles;
                self.SendFlags |= 4;
        }
+       if(o.health != self.health)
+       {
+               self.health = o.health;
+               self.SendFlags |= 8;
+       }
+       if(o.armorvalue != self.armorvalue)
+       {
+               self.armorvalue = o.armorvalue;
+               self.SendFlags |= 16;
+       }
 };
 
 entity attach_entcs()