4 #include "../dpdefs/progsdefs.qh"
5 #include "../dpdefs/dpextensions.qh"
6 #include "../common/constants.qh"
7 #include "constants.qh"
9 #include "mutators/mutators_include.qh"
13 * The point of these entities is to avoid the problems
14 * with clientprediction.
15 * If you add SendEntity to players, the engine will not
16 * do any prediction anymore, and you'd have to write the whole
17 * prediction code in CSQC, you want that? :P
18 * Data can depend on gamemode. For now, it serves as GPS entities
19 * in onslaught... YAY ;)
22 // Beware: do not redefine those in other files
23 // and NO, you cannot use ".version", which already exists (at least
24 // it did when I added this) But you have to use .Version
31 print("Initializing ClientSide information entities\n");
34 float entcs_customize()
38 if(o.deadflag != DEAD_NO)
44 if((IS_PLAYER(other)) || other.caplayer)
45 if(!teamplay || o.team != other.team)
46 if (!radar_showennemies)
51 float entcs_send(entity to, int sf)
53 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
54 WriteByte(MSG_ENTITY, sf);
56 WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);
59 WriteShort(MSG_ENTITY, self.origin.x);
60 WriteShort(MSG_ENTITY, self.origin.y);
61 WriteShort(MSG_ENTITY, self.origin.z);
64 WriteByte(MSG_ENTITY, self.angles.y * 256.0 / 360);
66 WriteByte(MSG_ENTITY, self.health / 10); // FIXME use a better scale?
68 WriteByte(MSG_ENTITY, self.armorvalue / 10); // FIXME use a better scale?
74 self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing
79 if(o.origin != self.origin)
81 setorigin(self, o.origin);
84 if(o.angles.y != self.angles.y)
86 self.angles = o.angles;
89 if(o.health != self.health)
91 self.health = o.health;
94 if(o.armorvalue != self.armorvalue)
96 self.armorvalue = o.armorvalue;
101 entity attach_entcs()
106 ent.classname = "entcs_sender_v2";
108 ent.think = entcs_think;
109 ent.nextthink = time;
111 Net_LinkEntity(ent, false, 0, entcs_send);
112 ent.customizeentityforclient = entcs_customize;