4 #include "mutators/mutators_include.qh"
7 * The point of these entities is to avoid the problems
8 * with clientprediction.
9 * If you add SendEntity to players, the engine will not
10 * do any prediction anymore, and you'd have to write the whole
11 * prediction code in CSQC, you want that? :P
12 * Data can depend on gamemode. For now, it serves as GPS entities
13 * in onslaught... YAY ;)
16 // Beware: do not redefine those in other files
17 // and NO, you cannot use ".version", which already exists (at least
18 // it did when I added this) But you have to use .Version
25 print("Initializing ClientSide information entities\n");
28 float entcs_customize()
32 if(o.deadflag != DEAD_NO)
38 if((IS_PLAYER(other)) || other.caplayer)
39 if(!teamplay || o.team != other.team)
40 if (!radar_showennemies)
45 float entcs_send(entity to, int sf)
47 WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
48 WriteByte(MSG_ENTITY, sf);
50 WriteByte(MSG_ENTITY, num_for_edict(self.owner)-1);
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 + 0.033333333333; // increase this to like 0.15 once the client can do smoothing
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;