4 REGISTER_NET_LINKED(ENT_CLIENT_ENTCS)
5 REGISTER_NET_TEMP(CLIENT_ENTCS)
7 /** True when private information such as origin is available */
9 /** True when origin is available */
11 /** True when a recent server sent origin has been received */
16 * The point of these entities is to avoid the problems
17 * with clientprediction.
18 * If you add SendEntity to players, the engine will not
19 * do any prediction anymore, and you'd have to write the whole
20 * prediction code in CSQC, you want that? :P
21 * Data can depend on gamemode. For now, it serves as GPS entities
22 * in onslaught... YAY ;)
27 bool entcs_send(entity this, entity to, int sf);
31 void entcs_attach(entity e);
33 void entcs_detach(entity e);
37 /** Force an origin update, for player sounds */
38 #define entcs_force_origin(e) ((e).entcs.m_forceupdate = BIT(2))
47 AL_NEW(_entcs, 255, NULL, e); // 255 is the engine limit on maxclients
53 #define entcs_receiver(...) EVAL(OVERLOAD(entcs_receiver, __VA_ARGS__))
54 #define entcs_receiver_1(i) AL_gete(_entcs, i)
55 #define entcs_receiver_2(i, v) AL_sete(_entcs, i, v)
56 #define entcs_is_self(e) ((e).sv_entnum == player_localentnum - 1)
59 * @param i zero indexed player
61 bool entcs_IsSpectating(int i)
63 bool unconnected = !playerslots[i].gotscores;
64 return unconnected || stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR;
68 * @param i zero indexed player
69 * @returns 0 if not teamplay
71 int entcs_GetTeamColor(int i)
73 return (!teamplay) ? 0 : stof(getplayerkeyvalue(i, "colors")) & 15;
77 * @param i zero indexed player
78 * @returns 0 if not teamplay | NUM_TEAM_##N | NUM_SPECTATOR
80 int entcs_GetTeam(int i)
82 return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
86 * Same as `entcs_GetTeam`, but returns -1 for no team in teamplay
88 int entcs_GetScoreTeam(int i)
90 int t = entcs_GetTeam(i);
91 if (teamplay && !t) t = -1;
96 * @param i zero indexed player
98 string entcs_GetName(int i)
100 return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
104 * @param i zero indexed player
106 entity CSQCModel_server2csqc(int i);
111 * @param i zero indexed player
113 float entcs_GetAlpha(int i)
115 entity e = CSQCModel_server2csqc(i);
116 return e ? e.alpha : 1;
120 * @param i zero indexed player
122 vector entcs_GetColor(int i)
124 entity e = CSQCModel_server2csqc(i);
125 return (!e || e.colormap <= 0)
127 : colormapPaletteColor(((e.colormap >= 1024)
129 : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 15, true)
134 * @param i zero indexed player
136 bool entcs_IsDead(int i)
138 entity e = CSQCModel_server2csqc(i);
139 return e ? e.csqcmodel_isdead : false;