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
\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
return TRUE;\r
};\r
\r
void entcs_think()\r
{\r
- self.nextthink = time;\r
+ self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing\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
};\r
\r