Xonotic
conveyor.qc File Reference
#include "conveyor.qh"
+ Include dependency graph for conveyor.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void conveyor_think (entity this)
 

Function Documentation

◆ conveyor_think()

void conveyor_think ( entity  this)

Definition at line 4 of file conveyor.qc.

References absmax, absmin, active, ACTIVE_ACTIVE, ACTIVE_NOT, boxesoverlap(), drawmask, entity(), EXACTTRIGGER_INIT, g_conveyed, g_drawables, IL_EACH, IL_PUSH(), isPushable(), MASK_NORMAL, maxs, mins, model, move_time, movedir, MOVETYPE_NONE, NET_HANDLE, nextthink, origin, ReadString, sendflags, set_movetype(), setorigin(), setthink, SF_TRIGGER_INIT, SF_TRIGGER_UPDATE, solid, SOLID_BSP, SOLID_TRIGGER, spawnfunc(), speed, strzone(), target, targetname, time, to, use, vector(), vlen(), warpzone_isboxy, WarpZoneLib_BoxTouchesBrush(), WriteByte(), and WriteString().

5 {
6 #ifdef CSQC
7  // TODO: check if this is what is causing the glitchiness when switching between them
8  float dt = time - this.move_time;
9  this.move_time = time;
10  if(dt <= 0) { return; }
11 #endif
12 
13  // set myself as current conveyor where possible
14  IL_EACH(g_conveyed, it.conveyor == this,
15  {
16  it.conveyor = NULL;
17  IL_REMOVE(g_conveyed, it);
18  });
19 
20  if(this.active == ACTIVE_ACTIVE)
21  {
22  FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, it.conveyor.active == ACTIVE_NOT && isPushable(it),
23  {
24  vector emin = it.absmin;
25  vector emax = it.absmax;
26  if(this.solid == SOLID_BSP)
27  {
28  emin -= '1 1 1';
29  emax += '1 1 1';
30  }
31  if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
32  if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
33  {
34  if(!it.conveyor)
35  IL_PUSH(g_conveyed, it);
36  it.conveyor = this;
37  }
38  });
39 
40  IL_EACH(g_conveyed, it.conveyor == this,
41  {
42  if(IS_CLIENT(it)) // doing it via velocity has quite some advantages
43  continue; // done in SV_PlayerPhysics continue;
44 
45  setorigin(it, it.origin + this.movedir * PHYS_INPUT_FRAMETIME);
46  move_out_of_solid(it);
47 #ifdef SVQC
48  UpdateCSQCProjectile(it);
49 #endif
50  /*
51  // stupid conveyor code
52  tracebox(it.origin, it.mins, it.maxs, it.origin + this.movedir * sys_frametime, MOVE_NORMAL, it);
53  if(trace_fraction > 0)
54  setorigin(it, trace_endpos);
55  */
56  });
57  }
58 
59 #ifdef SVQC
60  this.nextthink = time;
61 #endif
62 }
#define IL_EACH(this, cond, body)
IntrusiveList g_conveyed
Definition: conveyor.qh:4
vector absmax
Definition: csprogsdefs.qc:92
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
Definition: vector.qh:73
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
Definition: common.qc:138
const int ACTIVE_ACTIVE
Definition: defs.qh:37
float nextthink
Definition: csprogsdefs.qc:121
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const float SOLID_BSP
Definition: csprogsdefs.qc:248
float move_time
Definition: movetypes.qh:77
int active
Definition: defs.qh:34
vector absmin
Definition: csprogsdefs.qc:92
const int ACTIVE_NOT
Definition: defs.qh:36
float time
Definition: csprogsdefs.qc:16
bool isPushable(entity e)
Definition: triggers.qc:3
float solid
Definition: csprogsdefs.qc:99
+ Here is the call graph for this function: