+#include "conveyor.qh"
REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR)
void conveyor_think(entity this)
if(dt <= 0) { return; }
#endif
- // set mythis as current conveyor where possible
- FOREACH_ENTITY_ENT(conveyor, this,
+ // set myself as current conveyor where possible
+ IL_EACH(g_conveyed, it.conveyor == this,
{
it.conveyor = NULL;
+ IL_REMOVE(g_conveyed, it);
});
if(this.state)
}
if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
+ {
+ if(!it.conveyor)
+ IL_PUSH(g_conveyed, it);
it.conveyor = this;
+ }
});
- FOREACH_ENTITY_ENT(conveyor, this,
+ IL_EACH(g_conveyed, it.conveyor == this,
{
if(IS_CLIENT(it)) // doing it via velocity has quite some advantages
continue; // done in SV_PlayerPhysics continue;
void conveyor_draw(entity this) { conveyor_think(this); }
-void conveyor_init(entity this)
+void conveyor_init(entity this, bool isnew)
{
+ if(isnew)
+ IL_PUSH(g_drawables, this);
this.draw = conveyor_draw;
this.drawmask = MASK_NORMAL;
- this.move_movetype = MOVETYPE_NONE;
+ set_movetype(this, MOVETYPE_NONE);
this.model = "";
this.solid = SOLID_TRIGGER;
this.move_time = time;
this.targetname = strzone(ReadString());
this.target = strzone(ReadString());
- conveyor_init(this);
+ conveyor_init(this, isnew);
}
if(sf & 2)