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 float conveyor_send(entity to, float sf)
75 WriteByte(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 void spawnfunc_trigger_conveyor()
139 void spawnfunc_func_conveyor()
142 InitMovingBrushTrigger();
143 self.movetype = MOVETYPE_NONE;
151 self.draw = conveyor_think;
152 self.drawmask = MASK_NORMAL;
154 self.movetype = MOVETYPE_NONE;
156 self.solid = SOLID_TRIGGER;
157 self.move_origin = self.origin;
158 self.move_time = time;
163 float sf = ReadByte();
167 self.warpzone_isboxy = ReadByte();
168 self.origin_x = ReadCoord();
169 self.origin_y = ReadCoord();
170 self.origin_z = ReadCoord();
171 setorigin(self, self.origin);
173 self.mins_x = ReadCoord();
174 self.mins_y = ReadCoord();
175 self.mins_z = ReadCoord();
176 self.maxs_x = ReadCoord();
177 self.maxs_y = ReadCoord();
178 self.maxs_z = ReadCoord();
179 setsize(self, self.mins, self.maxs);
181 self.movedir_x = ReadCoord();
182 self.movedir_y = ReadCoord();
183 self.movedir_z = ReadCoord();
185 self.speed = ReadByte();
186 self.state = ReadByte();
188 self.targetname = strzone(ReadString());
189 self.target = strzone(ReadString());
195 self.state = ReadByte();