]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/ent_cs.qc
Offset the names for scaled players, to match the proper scale
[voretournament/voretournament.git] / data / qcsrc / server / ent_cs.qc
index 6635689ebc8c304a552e31cb7a201d2724359e3a..ff20effe5db672836dc4153e085984df995583cf 100644 (file)
@@ -31,7 +31,7 @@ float entcs_customize()
        if(other == o)\r
                return FALSE;\r
        if(other.classname == "player")\r
-               if(o.team != other.team)\r
+               if(!teamplay || o.team != other.team)\r
                        if not (radar_showennemies)\r
                                return FALSE;\r
        return TRUE;\r
@@ -39,29 +39,58 @@ float entcs_customize()
 \r
 float entcs_send(entity to, float sf)\r
 {\r
-       entity o;\r
-       o = self.owner;\r
        WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);\r
-       WriteByte(MSG_ENTITY, num_for_edict(o));\r
-       WriteShort(MSG_ENTITY, o.origin_x);\r
-       WriteShort(MSG_ENTITY, o.origin_y);\r
-       WriteShort(MSG_ENTITY, o.origin_z);\r
-       WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360);\r
+       WriteByte(MSG_ENTITY, sf);\r
+       if(sf & 1)\r
+               WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);\r
+       if(sf & 2)\r
+       {\r
+               WriteShort(MSG_ENTITY, self.origin_x);\r
+               WriteShort(MSG_ENTITY, self.origin_y);\r
+               WriteShort(MSG_ENTITY, self.origin_z);\r
+       }\r
+       if(sf & 4)\r
+               WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);\r
+       if(sf & 8)\r
+               WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?\r
+       if(sf & 16)\r
+               WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?\r
+       if(sf & 32)\r
+               WriteByte(MSG_ENTITY, num_for_edict(self.predator));\r
        return TRUE;\r
 };\r
 \r
 void entcs_think()\r
 {\r
-       self.nextthink = time;\r
+       self.nextthink = time + 0.03;\r
 \r
        entity o;\r
        o = self.owner;\r
 \r
-       if(o.origin != self.origin || o.angles != self.angles)\r
+       if(o.origin != self.origin)\r
        {\r
                setorigin(self, o.origin);\r
+               self.SendFlags |= 2;\r
+       }\r
+       if(o.angles_y != self.angles_y)\r
+       {\r
                self.angles = o.angles;\r
-               self.SendFlags |= 1;\r
+               self.SendFlags |= 4;\r
+       }\r
+       if(o.health != self.health)\r
+       {\r
+               self.health = o.health;\r
+               self.SendFlags |= 8;\r
+       }\r
+       if(o.armorvalue != self.armorvalue)\r
+       {\r
+               self.armorvalue = o.armorvalue;\r
+               self.SendFlags |= 16;\r
+       }\r
+       if(o.predator != self.predator)\r
+       {\r
+               self.predator = o.predator;\r
+               self.SendFlags |= 32;\r
        }\r
 };\r
 \r