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(o.team != other.team)
35 if not (radar_showennemies)
40 float entcs_send(entity to, float sf)
43 if(teams_matter && !radar_showennemies)
44 if(to.team != self.team)
45 sf &~= (8 | 16 | 128); // don't send h/a for enemies
47 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
48 WriteByte(MSG_ENTITY, sf);
50 WriteByte(MSG_ENTITY, num_for_edict(self.owner));
53 WriteShort(MSG_ENTITY, self.origin_x);
54 WriteShort(MSG_ENTITY, self.origin_y);
55 WriteShort(MSG_ENTITY, self.origin_z);
58 WriteByte(MSG_ENTITY, self.angles_y * 256.0 / 360);
60 WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
62 WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
68 self.nextthink = time;
73 if(o.origin != self.origin)
75 setorigin(self, o.origin);
78 if(o.angles_y != self.angles_y)
80 self.angles = o.angles;
83 if(o.health != self.health)
85 self.health = o.health;
88 if(o.armorvalue != self.armorvalue)
90 self.armorvalue = o.armorvalue;
100 ent.classname = "entcs_sender_v2";
102 ent.think = entcs_think;
103 ent.nextthink = time;
105 Net_LinkEntity(ent, FALSE, 0, entcs_send);
106 ent.customizeentityforclient = entcs_customize;