sf |= this.m_forceupdate;
this.m_forceupdate = 0;
bool valid =
- IS_PLAYER(player) // player must be active
- || player == to // player is self
+ time > game_starttime
+ && (IS_PLAYER(player) // player must be active
+ || player == to) // player is self
;
if (!valid) sf = 0;
if (chan == MSG_ENTITY)
return _entcs_send(this, to, sf, MSG_ENTITY);
}
- void entcs_think()
+ void entcs_think(entity this)
{
- SELFPARAM();
this.nextthink = time + 0.033333333333; // TODO: increase this to like 0.15 once the client can do smoothing
entity o = this.owner;
int i = 1;
i += 1;
ENTCS_NETPROPS(X);
#undef X
+ setorigin(this, this.origin); // relink
}
void entcs_attach(entity player)
{
entity e = player.entcs = new(entcs_sender);
- make_pure(e);
e.owner = player;
- e.think = entcs_think;
+ setthink(e, entcs_think);
e.nextthink = time;
Net_LinkEntity(e, false, 0, entcs_send);
if (!IS_REAL_CLIENT(player)) return;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
assert(it.entcs);
_entcs_send(it.entcs, msg_entity = player, BITS(23), MSG_ONE);
- ));
+ });
}
void entcs_detach(entity player)
{
if (!player.entcs) return;
- remove(player.entcs);
+ delete(player.entcs);
player.entcs = NULL;
}
int n = this.sv_entnum;
entity e = entcs_receiver(n);
entcs_receiver(n, NULL);
- if (e != this) remove(e);
+ if (e != this) delete(e);
}
- void entcs_think()
+ void entcs_think(entity this)
{
- SELFPARAM();
entity e = CSQCModel_server2csqc(this.sv_entnum);
if (e == NULL)
{
make_pure(e);
}
e.sv_entnum = n;
- e.think = entcs_think;
+ setthink(e, entcs_think);
entcs_receiver(n, e);
}
else if (this && e != this)
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITH(entity, self, this, this.think());
+ getthink(this)(this);
return true;
}