20 FOREACH(EntCSProps,
true, it.m_id = i);
52#define _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
53 void id##_set(entity ent, entity player) \
55 setprop(ent.(checkprop), player.(checkprop_pl)); \
57 void id##_send(int chan, entity ent) \
61 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) \
63 this.m_public = ispublic; \
64 this.m_check = id##_check; \
65 this.m_set = id##_set; \
66 this.m_send = id##_send; \
69#define ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
70 bool id##_check(entity ent, entity player) \
72 return (ent.(checkprop) != player.(checkprop_pl)); \
74 _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
76#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive) \
77 bool id##_check(entity ent, entity player) \
79 return (floor(ent.(checkprop)) / decfactor != floor(player.(checkprop_pl)) / decfactor); \
81 _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
84#define ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
85 void id##_receive(entity ent) \
89 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) \
91 this.m_public = ispublic; \
92 this.m_receive = id##_receive; \
95#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive) \
96 ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
100#define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
101 bool id##_check(entity ent, entity player) \
103 return (floor(GetResource(ent, checkprop) / decfactor) != floor(GetResource(player, checkprop) / decfactor)); \
105 void id##_set(entity ent, entity player) \
107 SetResourceExplicit(ent, checkprop, GetResource(player, checkprop)); \
109 void id##_send(int chan, entity ent) \
113 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) \
115 this.m_public = ispublic; \
116 this.m_check = id##_check; \
117 this.m_set = id##_set; \
118 this.m_send = id##_send; \
121#define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
122 void id##_receive(entity ent) \
126 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) \
128 this.m_public = ispublic; \
129 this.m_receive = id##_receive; \
133#define ENTCS_SET_NORMAL(var, x) var = x;
135#define ENTCS_SET_MUTABLE_STRING(var, x) strcpy(var, x);
140 WriteVector(chan, ent.
origin),
141 { ent.has_sv_origin =
true; setorigin(ent,
ReadVector()); })
146 { vector v; v.y = ReadByte() * DEC_FACTOR; v.x = 0; v.z = 0; ent.angles = v; })
178 ent.
frags = ReadShort())
196 int ENTCS_PUBLICMASK = 0, ENTCS_PRIVATEMASK = 0;
202 ENTCS_PUBLICMASK |=
BIT(it.m_id);
204 ENTCS_PRIVATEMASK |=
BIT(it.m_id);
226 sf &= ENTCS_PUBLICMASK;
238 FOREACH(EntCSProps, sf &
BIT(it.m_id), it.m_send(chan,
this));
251 FOREACH(EntCSProps, it.m_check(
this, player),
253 it.m_set(this, player);
254 this.SendFlags |= BIT(it.m_id);
293 delete(
CS(player).entcs);
325 setorigin(
this, this.
origin);
327 if (this.model != e.model)
328 strcpy(this.model, e.model);
346 else if (e !=
this &&
this)
357 int sf = ReadShort();
358 e.has_sv_origin =
false;
360 FOREACH(EntCSProps, sf &
BIT(it.m_id), it.m_receive(e));
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define ENTCS_SET_MUTABLE_STRING(var, x)
the engine player name strings are mutable!
WriteString(chan, ent.netname)
void entcs_detach(entity player)
#define ENTCS_SET_NORMAL(var, x)
bool ReadEntcs(entity this)
#define ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
bool entcs_send(entity this, entity to, int sf)
#define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive)
bool _entcs_send(entity this, entity to, int sf, int chan)
WriteByte(chan, ent.angles.y/DEC_FACTOR)
#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive)
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
void entcs_attach(entity player)
void entcs_think(entity this)
void entcs_update_players(entity player)
void entcs_force_origin(entity player)
void Ent_RemoveEntCS(entity this)
bool has_sv_origin
True when a recent server sent origin has been received.
#define entcs_receiver(...)
entity CSQCModel_server2csqc(int i)
bool intermission_running
void InterpolateOrigin_Undo(entity this)
snap origin to iorigin2 (actual origin)
void InterpolateOrigin_Reset(entity this)
void InterpolateOrigin_Note(entity this)
void InterpolateOrigin_Do(entity this)
set origin based on iorigin1 (old pos), iorigin2 (desired pos), and time
#define FOREACH(list, cond, body)
#define NET_HANDLE(id, param)
#define WriteHeader(to, id)
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
#define MODEL(name, path)
#define make_pure(e)
direct use is
#define new_pure(class)
purely logical entities (not linked to the area grid)
#define REGISTRY_SORT(...)
#define REGISTER_REGISTRY(id)
#define REGISTRY(id, max)
Declares a new registry.
#define REGISTRY_CHECK(id)
#define REGISTRY_DEFINE_GET(id, null)
ClientState CS(Client this)
#define STATIC_INIT(func)
during worldspawn
Header file that describes the resource system.
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)