X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fent_cs.qc;h=e60717e25b6de4cf8751982c536df59bb0911a9f;hb=9a7544b57ac57e73f3cecfbfe1e6b1331714ad0e;hp=bee79d682e9e2d5d4ad31cd84a8c0231b788187c;hpb=0e7ed909bffb4ff21f0c68d163edfc17487e380a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/ent_cs.qc b/qcsrc/server/ent_cs.qc index bee79d682..e60717e25 100644 --- a/qcsrc/server/ent_cs.qc +++ b/qcsrc/server/ent_cs.qc @@ -28,40 +28,63 @@ float entcs_customize() return FALSE; if(o.classname != "player") return FALSE; - if(other == o) - return FALSE; + //if(other == o) // allow sending entcs for self, for damage effects to work. To be decided! + // return FALSE; if(other.classname == "player") - if(o.team != other.team) - if not (radar_showennemies) + if(!teamplay || o.team != other.team) + //if not (radar_showennemies) + if not (checkpvs(other.origin + other.view_ofs, o)) // allow sending entcs for enemies in view, for damage effects to work. To be decided! return FALSE; return TRUE; } float entcs_send(entity to, float sf) { - entity o; - o = self.owner; WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS); - WriteByte(MSG_ENTITY, num_for_edict(o)); - WriteShort(MSG_ENTITY, o.origin_x); - WriteShort(MSG_ENTITY, o.origin_y); - WriteShort(MSG_ENTITY, o.origin_z); - WriteByte(MSG_ENTITY, o.angles_y * 256.0 / 360); + WriteByte(MSG_ENTITY, sf); + if(sf & 1) + WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1); + if(sf & 2) + { + WriteShort(MSG_ENTITY, self.origin_x); + WriteShort(MSG_ENTITY, self.origin_y); + WriteShort(MSG_ENTITY, self.origin_z); + } + if(sf & 4) + 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; }; void entcs_think() { - self.nextthink = time; + self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing entity o; o = self.owner; - if(o.origin != self.origin || o.angles != self.angles) + if(o.origin != self.origin) { setorigin(self, o.origin); + self.SendFlags |= 2; + } + if(o.angles_y != self.angles_y) + { self.angles = o.angles; - self.SendFlags |= 1; + 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; } };