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)
29 if(o.classname != "player")
33 if(other.classname == "player")
34 if(!teams_matter || o.team != other.team)
35 if not (radar_showennemies)
40 float entcs_send(entity to, float sf)
42 // a simple safeguard, should not REALLY be needed
44 if(teams_matter && !radar_showennemies)
45 if(to.team != self.team)
46 sf &~= (8 | 16 | 128); // don't send h/a for enemies
48 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
49 WriteByte(MSG_ENTITY, sf);
51 WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);
54 WriteShort(MSG_ENTITY, self.origin_x);
55 WriteShort(MSG_ENTITY, self.origin_y);
56 WriteShort(MSG_ENTITY, self.origin_z);
59 WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);
61 WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
63 WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
69 self.nextthink = time;
74 if(o.origin != self.origin)
76 setorigin(self, o.origin);
79 if(o.angles_y != self.angles_y)
81 self.angles = o.angles;
84 if(o.health != self.health)
86 self.health = o.health;
89 if(o.armorvalue != self.armorvalue)
91 self.armorvalue = o.armorvalue;
101 ent.classname = "entcs_sender_v2";
103 ent.think = entcs_think;
104 ent.nextthink = time;
106 Net_LinkEntity(ent, FALSE, 0, entcs_send);
107 ent.customizeentityforclient = entcs_customize;