4 // TODO: check if this is what is causing the glitchiness when switching between them
5 float dt = time - self.move_time;
7 if(dt <= 0) { return; }
11 // set myself as current conveyor where possible
12 for(e = world; (e = findentity(e, conveyor, self)); )
17 for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
21 vector emin = e.absmin;
22 vector emax = e.absmax;
23 if(self.solid == SOLID_BSP)
28 if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
29 if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
33 for(e = world; (e = findentity(e, conveyor, self)); )
35 if(IS_CLIENT(e)) // doing it via velocity has quite some advantages
36 continue; // done in SV_PlayerPhysics continue;
38 setorigin(e, e.origin + self.movedir * PHYS_INPUT_FRAMETIME);
41 UpdateCSQCProjectile(e);
44 // stupid conveyor code
45 tracebox(e.origin, e.mins, e.maxs, e.origin + self.movedir * sys_frametime, MOVE_NORMAL, e);
46 if(trace_fraction > 0)
47 setorigin(e, trace_endpos);
53 self.nextthink = time;
61 self.state = !self.state;
68 self.state = (self.spawnflags & 1);
73 bool conveyor_send(entity this, entity to, int sf)
75 WriteHeader(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
76 WriteByte(MSG_ENTITY, sf);
80 WriteByte(MSG_ENTITY, self.warpzone_isboxy);
81 WriteCoord(MSG_ENTITY, self.origin_x);
82 WriteCoord(MSG_ENTITY, self.origin_y);
83 WriteCoord(MSG_ENTITY, self.origin_z);
85 WriteCoord(MSG_ENTITY, self.mins_x);
86 WriteCoord(MSG_ENTITY, self.mins_y);
87 WriteCoord(MSG_ENTITY, self.mins_z);
88 WriteCoord(MSG_ENTITY, self.maxs_x);
89 WriteCoord(MSG_ENTITY, self.maxs_y);
90 WriteCoord(MSG_ENTITY, self.maxs_z);
92 WriteCoord(MSG_ENTITY, self.movedir_x);
93 WriteCoord(MSG_ENTITY, self.movedir_y);
94 WriteCoord(MSG_ENTITY, self.movedir_z);
96 WriteByte(MSG_ENTITY, self.speed);
97 WriteByte(MSG_ENTITY, self.state);
99 WriteString(MSG_ENTITY, self.targetname);
100 WriteString(MSG_ENTITY, self.target);
104 WriteByte(MSG_ENTITY, self.state);
113 self.movedir = self.movedir * self.speed;
114 self.think = conveyor_think;
115 self.nextthink = time;
118 self.use = conveyor_use;
119 self.reset = conveyor_reset;
127 Net_LinkEntity(self, 0, false, conveyor_send);
132 spawnfunc(trigger_conveyor)
139 spawnfunc(func_conveyor)
142 InitMovingBrushTrigger();
143 self.movetype = MOVETYPE_NONE;
149 void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
153 self.draw = conveyor_draw;
154 self.drawmask = MASK_NORMAL;
156 self.movetype = MOVETYPE_NONE;
158 self.solid = SOLID_TRIGGER;
159 self.move_origin = self.origin;
160 self.move_time = time;
163 NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew)
165 float sf = ReadByte();
169 self.warpzone_isboxy = ReadByte();
170 self.origin_x = ReadCoord();
171 self.origin_y = ReadCoord();
172 self.origin_z = ReadCoord();
173 setorigin(self, self.origin);
175 self.mins_x = ReadCoord();
176 self.mins_y = ReadCoord();
177 self.mins_z = ReadCoord();
178 self.maxs_x = ReadCoord();
179 self.maxs_y = ReadCoord();
180 self.maxs_z = ReadCoord();
181 setsize(self, self.mins, self.maxs);
183 self.movedir_x = ReadCoord();
184 self.movedir_y = ReadCoord();
185 self.movedir_z = ReadCoord();
187 self.speed = ReadByte();
188 self.state = ReadByte();
190 self.targetname = strzone(ReadString());
191 self.target = strzone(ReadString());
197 self.state = ReadByte();