2 * The point of these entities is to avoid the problems
3 * with clientprediction.
4 * If you add SendEntity to players, the engine will not
5 * do any prediction anymore, and you'd have to write the whole
6 * prediction code in CSQC, you want that? :P
7 * Data can depend on gamemode. For now, it serves as GPS entities
8 * in onslaught... YAY ;)
11 // Beware: do not redefine those in other files
12 // and NO, you cannot use ".version", which already exists (at least
13 // it did when I added this) But you have to use .Version
20 print("Initializing ClientSide information entities\n");
23 float entcs_customize()
27 //if(o.deadflag != DEAD_NO) // allow sending entcs for dead players, for damage effects to work. To be decided!
29 if(o.classname != "player")
31 //if(other == o) // allow sending entcs for self, for damage effects to work. To be decided!
33 if(other.classname == "player")
34 if(!teamplay || o.team != other.team)
35 //if not (radar_showennemies)
36 if not (checkpvs(other.origin + other.view_ofs, o)) // allow sending entcs for enemies in view, for damage effects to work. To be decided!
41 float entcs_send(entity to, float sf)
43 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
44 WriteByte(MSG_ENTITY, sf);
46 WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);
49 WriteShort(MSG_ENTITY, self.origin_x);
50 WriteShort(MSG_ENTITY, self.origin_y);
51 WriteShort(MSG_ENTITY, self.origin_z);
54 WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);
56 WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
58 WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
64 self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing
69 if(o.origin != self.origin)
71 setorigin(self, o.origin);
74 if(o.angles_y != self.angles_y)
76 self.angles = o.angles;
79 if(o.health != self.health)
81 self.health = o.health;
84 if(o.armorvalue != self.armorvalue)
86 self.armorvalue = o.armorvalue;
96 ent.classname = "entcs_sender_v2";
98 ent.think = entcs_think;
101 Net_LinkEntity(ent, FALSE, 0, entcs_send);
102 ent.customizeentityforclient = entcs_customize;