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");
21 entcs_start = spawn();
22 entcs_start.solid = SOLID_NOT;
23 entcs_start.chain = world;
26 entity get_entcs_ent()
30 entcs.chain = entcs_start.chain;
31 entcs_start.chain = entcs;
35 void entcs_ons(entity to)
37 if(to == self.owner || self.team != to.team ||
38 self.owner.classname == "observer" || to.classname == "observer")
40 WriteByte(MSG_ENTITY, ENTCS_MSG_ONS_REMOVE);
43 WriteByte(MSG_ENTITY, ENTCS_MSG_ONS_GPS);
44 WriteShort(MSG_ENTITY, self.owner.origin_x);
45 WriteShort(MSG_ENTITY, self.owner.origin_y);
46 WriteShort(MSG_ENTITY, self.owner.origin_z);
47 WriteByte(MSG_ENTITY, self.owner.angles_y * 256.0 / 360);
50 void entcs_common_self()
54 float entcs_send(entity to)
56 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
57 WriteByte(MSG_ENTITY, self.health); // serves as entitynumber
67 WriteByte(MSG_ENTITY, ENTCS_MSG_END);
73 self.team = self.owner.team;
75 setorigin(self, self.owner.origin);
76 self.nextthink = time;
84 num = num_for_edict(self);
85 ent = get_entcs_ent();
87 ent.classname = "entcs_sender";
89 setorigin(ent, self.origin);
91 ent.think = entcs_think;
93 ent.effects = EF_NODEPTHTEST | EF_LOWPRECISION;
94 ent.model = "entcs_sender";
96 setsize(ent, '0 0 0', '0 0 0');
98 ent.SendEntity = entcs_send;
106 num = num_for_edict(self);
107 for(ent = entcs_start; ent.chain.owner != self && ent.chain != world; ent = ent.chain);
108 if(ent.chain != world && ent.chain.owner == self)
111 ent.chain = ent.chain.chain;