+#include "conveyor.qh"
REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR)
void conveyor_think(entity this)
this.move_time = time;
if(dt <= 0) { return; }
#endif
- entity e;
// set mythis as current conveyor where possible
- for(e = world; (e = findentity(e, conveyor, this)); )
- e.conveyor = world;
+ IL_EACH(g_conveyed, it.conveyor == this,
+ {
+ it.conveyor = NULL;
+ IL_REMOVE(g_conveyed, it);
+ });
if(this.state)
{
- for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
- if(!e.conveyor.state)
- if(isPushable(e))
+ FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.conveyor.state && isPushable(it),
+ {
+ vector emin = it.absmin;
+ vector emax = it.absmax;
+ if(this.solid == SOLID_BSP)
+ {
+ emin -= '1 1 1';
+ emax += '1 1 1';
+ }
+ if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
+ if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
{
- vector emin = e.absmin;
- vector emax = e.absmax;
- if(this.solid == SOLID_BSP)
- {
- emin -= '1 1 1';
- emax += '1 1 1';
- }
- if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
- e.conveyor = this;
+ if(!it.conveyor)
+ IL_PUSH(g_conveyed, it);
+ it.conveyor = this;
}
+ });
- for(e = world; (e = findentity(e, conveyor, this)); )
+ IL_EACH(g_conveyed, it.conveyor == this,
{
- if(IS_CLIENT(e)) // doing it via velocity has quite some advantages
+ if(IS_CLIENT(it)) // doing it via velocity has quite some advantages
continue; // done in SV_PlayerPhysics continue;
- setorigin(e, e.origin + this.movedir * PHYS_INPUT_FRAMETIME);
- move_out_of_solid(e);
+ setorigin(it, it.origin + this.movedir * PHYS_INPUT_FRAMETIME);
+ move_out_of_solid(it);
#ifdef SVQC
- UpdateCSQCProjectile(e);
+ UpdateCSQCProjectile(it);
#endif
/*
// stupid conveyor code
- tracebox(e.origin, e.mins, e.maxs, e.origin + this.movedir * sys_frametime, MOVE_NORMAL, e);
+ tracebox(it.origin, it.mins, it.maxs, it.origin + this.movedir * sys_frametime, MOVE_NORMAL, it);
if(trace_fraction > 0)
- setorigin(e, trace_endpos);
+ setorigin(it, trace_endpos);
*/
- }
+ });
}
#ifdef SVQC
{
SetMovedir(this);
InitMovingBrushTrigger(this);
- this.movetype = MOVETYPE_NONE;
+ set_movetype(this, MOVETYPE_NONE);
conveyor_init(this);
}
void conveyor_init(entity this)
{
this.draw = conveyor_draw;
+ IL_PUSH(g_drawables, this);
this.drawmask = MASK_NORMAL;
- this.movetype = MOVETYPE_NONE;
+ set_movetype(this, MOVETYPE_NONE);
this.model = "";
this.solid = SOLID_TRIGGER;
- this.move_origin = this.origin;
this.move_time = time;
}