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;
if(sf & 1)
{
WriteByte(MSG_ENTITY, this.warpzone_isboxy);
- WriteCoord(MSG_ENTITY, this.origin_x);
- WriteCoord(MSG_ENTITY, this.origin_y);
- WriteCoord(MSG_ENTITY, this.origin_z);
+ WriteVector(MSG_ENTITY, this.origin);
- WriteCoord(MSG_ENTITY, this.mins_x);
- WriteCoord(MSG_ENTITY, this.mins_y);
- WriteCoord(MSG_ENTITY, this.mins_z);
- WriteCoord(MSG_ENTITY, this.maxs_x);
- WriteCoord(MSG_ENTITY, this.maxs_y);
- WriteCoord(MSG_ENTITY, this.maxs_z);
+ WriteVector(MSG_ENTITY, this.mins);
+ WriteVector(MSG_ENTITY, this.maxs);
- WriteCoord(MSG_ENTITY, this.movedir_x);
- WriteCoord(MSG_ENTITY, this.movedir_y);
- WriteCoord(MSG_ENTITY, this.movedir_z);
+ WriteVector(MSG_ENTITY, this.movedir);
WriteByte(MSG_ENTITY, this.speed);
WriteByte(MSG_ENTITY, this.state);
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;
- IL_PUSH(g_drawables, this);
this.drawmask = MASK_NORMAL;
set_movetype(this, MOVETYPE_NONE);
if(sf & 1)
{
this.warpzone_isboxy = ReadByte();
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
setorigin(this, this.origin);
- this.mins_x = ReadCoord();
- this.mins_y = ReadCoord();
- this.mins_z = ReadCoord();
- this.maxs_x = ReadCoord();
- this.maxs_y = ReadCoord();
- this.maxs_z = ReadCoord();
+ this.mins = ReadVector();
+ this.maxs = ReadVector();
setsize(this, this.mins, this.maxs);
- this.movedir_x = ReadCoord();
- this.movedir_y = ReadCoord();
- this.movedir_z = ReadCoord();
+ this.movedir = ReadVector();
this.speed = ReadByte();
this.state = ReadByte();
this.targetname = strzone(ReadString());
this.target = strzone(ReadString());
- conveyor_init(this);
+ conveyor_init(this, isnew);
}
if(sf & 2)