49#define _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
50 void id##_set(entity ent, entity player) { setprop(ent.(checkprop), player.(checkprop_pl)); } \
51 void id##_send(int chan, entity ent) { LAMBDA(svsend); } \
52 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \
53 this.m_public = ispublic; \
54 this.m_check = id##_check; \
55 this.m_set = id##_set; \
56 this.m_send = id##_send; \
59#define ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
60 bool id##_check(entity ent, entity player) { return (ent.(checkprop) != player.(checkprop_pl)); } \
61 _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
63#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive) \
64 bool id##_check(entity ent, entity player) { \
65 return (floor(ent.(checkprop)) / decfactor != floor(player.(checkprop_pl)) / decfactor); \
67 _ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
70#define ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive) \
71 void id##_receive(entity ent) { LAMBDA(clreceive); } \
72 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \
73 this.m_public = ispublic; \
74 this.m_receive = id##_receive; \
77#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive) \
78 ENTCS_PROP(id, ispublic, checkprop, checkprop_pl, setprop, svsend, clreceive)
82#define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
83 bool id##_check(entity ent, entity player) { \
84 return (floor(GetResource(ent, checkprop) / decfactor) != floor(GetResource(player, checkprop) / decfactor)); \
86 void id##_set(entity ent, entity player) { SetResourceExplicit(ent, checkprop, GetResource(player, checkprop)); } \
87 void id##_send(int chan, entity ent) { LAMBDA(svsend); } \
88 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \
89 this.m_public = ispublic; \
90 this.m_check = id##_check; \
91 this.m_set = id##_set; \
92 this.m_send = id##_send; \
95#define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
96 void id##_receive(entity ent) { LAMBDA(clreceive); } \
97 REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \
98 this.m_public = ispublic; \
99 this.m_receive = id##_receive; \
103#define ENTCS_SET_NORMAL(var, x) MACRO_BEGIN \
108#define ENTCS_SET_MUTABLE_STRING(var, x) MACRO_BEGIN \
115 { WriteVector(chan, ent.origin); },
153 { ent.frags = ReadShort(); })
156 {
WriteByte(chan, ent.handicap_level); },
157 { ent.handicap_level =
ReadByte(); })
162 { ent.wants_join = ReadChar(); })
215 it.m_send(chan, this);
229 FOREACH(EntCSProps, it.m_check(
this, player),
231 it.m_set(this, player);
232 this.SendFlags |= BIT(it.m_id);
271 delete(
CS(player).entcs);
286 if (e !=
this)
delete(e);
304 setorigin(
this, this.
origin);
306 if (this.
model != e.model)
327 else if (e !=
this &&
this)
338 int sf = ReadShort();
339 e.has_sv_origin =
false;
#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.
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
#define ENTCS_SET_MUTABLE_STRING(var, x)
the engine player name strings are mutable!
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)
#define ENTCS_PROP_CODED(id, ispublic, checkprop, checkprop_pl, setprop, decfactor, svsend, clreceive)
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 has_origin
True when origin is available.
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)
Declare 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)