Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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_init (entity this)
bool conveyor_send (entity this, entity to, int sendflags)
void conveyor_think (entity this)
 spawnfunc (func_conveyor)
 spawnfunc (trigger_conveyor)

Function Documentation

◆ conveyor_init()

void conveyor_init ( entity this)

Definition at line 86 of file conveyor.qc.

87{
88 if (!this.speed) this.speed = 200;
89 this.movedir *= this.speed;
91 this.nextthink = time;
92 this.setactive = generic_netlinked_setactive;
93 if(this.targetname && this.targetname != "")
94 {
95 // backwards compatibility
97 }
98 this.reset = generic_netlinked_reset;
99 this.reset(this);
100
101 Net_LinkEntity(this, 0, false, conveyor_send);
102
104}
bool conveyor_send(entity this, entity to, int sendflags)
Definition conveyor.qc:58
void conveyor_think(entity this)
Definition conveyor.qc:4
float time
float nextthink
#define use
const int SF_TRIGGER_INIT
Definition defs.qh:22
float speed
Definition dynlight.qc:9
int SendFlags
Definition net.qh:118
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
vector movedir
Definition viewloc.qh:18
#define setthink(e, f)
void generic_netlinked_reset(entity this)
Definition triggers.qc:76
void generic_netlinked_legacy_use(entity this, entity actor, entity trigger)
Definition triggers.qc:98
void generic_netlinked_setactive(entity this, int act)
Definition triggers.qc:65
string targetname
Definition triggers.qh:56

References conveyor_send(), conveyor_think(), entity(), generic_netlinked_legacy_use(), generic_netlinked_reset(), generic_netlinked_setactive(), movedir, Net_LinkEntity(), nextthink, SendFlags, setthink, SF_TRIGGER_INIT, speed, targetname, time, and use.

Referenced by spawnfunc(), and spawnfunc().

◆ conveyor_send()

bool conveyor_send ( entity this,
entity to,
int sendflags )

Definition at line 58 of file conveyor.qc.

59{
60 WriteHeader(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
61 WriteByte(MSG_ENTITY, sendflags);
62
63 if(sendflags & SF_TRIGGER_INIT)
64 {
66 WriteVector(MSG_ENTITY, this.origin);
67
68 WriteVector(MSG_ENTITY, this.mins);
69 WriteVector(MSG_ENTITY, this.maxs);
70
71 WriteVector(MSG_ENTITY, this.movedir);
72
75
78 }
79
80 if(sendflags & SF_TRIGGER_UPDATE)
82
83 return true;
84}
vector mins
vector maxs
vector origin
int active
Definition defs.qh:34
const int SF_TRIGGER_UPDATE
Definition defs.qh:23
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
float warpzone_isboxy
Definition common.qh:12
void WriteString(string data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
string target
Definition triggers.qh:55

References active, entity(), maxs, mins, movedir, MSG_ENTITY, origin, SF_TRIGGER_INIT, SF_TRIGGER_UPDATE, speed, target, targetname, warpzone_isboxy, WriteByte(), WriteHeader, and WriteString().

Referenced by conveyor_init().

◆ conveyor_think()

void conveyor_think ( entity this)

Definition at line 4 of file conveyor.qc.

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 if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
25 {
26 if(!it.conveyor)
28 it.conveyor = this;
29 }
30 });
31
32 IL_EACH(g_conveyed, it.conveyor == this,
33 {
34 if(IS_CLIENT(it)) // doing it via velocity has quite some advantages
35 continue; // done in SV_PlayerPhysics continue;
36
37 setorigin(it, it.origin + this.movedir * PHYS_INPUT_FRAMETIME);
38 move_out_of_solid(it);
39#ifdef SVQC
40 UpdateCSQCProjectile(it);
41#endif
42 /*
43 // stupid conveyor code
44 tracebox(it.origin, it.mins, it.maxs, it.origin + this.movedir * sys_frametime, MOVE_NORMAL, it);
45 if(trace_fraction > 0)
46 setorigin(it, trace_endpos);
47 */
48 });
49 }
50
51#ifdef SVQC
52 this.nextthink = time;
53#endif
54}
IntrusiveList g_conveyed
Definition conveyor.qh:4
vector absmax
vector absmin
const int ACTIVE_NOT
Definition defs.qh:36
const int ACTIVE_ACTIVE
Definition defs.qh:37
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define IL_EACH(this, cond, body)
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body)
Definition iter.qh:160
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc)
Definition common.qc:815
float vlen(vector v)
float move_time
Definition movetypes.qh:77
bool isPushable(entity e)
Definition triggers.qc:3

References absmax, absmin, active, ACTIVE_ACTIVE, ACTIVE_NOT, conveyor_think(), entity(), FOREACH_ENTITY_RADIUS, g_conveyed, IL_EACH, IL_PUSH(), isPushable(), move_time, nextthink, this, time, vlen(), void, and WarpZoneLib_ExactTrigger_Touch().

Referenced by conveyor_init(), and conveyor_think().

◆ spawnfunc() [1/2]

spawnfunc ( func_conveyor )

Definition at line 113 of file conveyor.qc.

114{
115 SetMovedir(this);
118 conveyor_init(this);
119}
void conveyor_init(entity this)
Definition conveyor.qc:86
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
void SetMovedir(entity this)
Definition subs.qc:540
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577

References conveyor_init(), InitMovingBrushTrigger(), MOVETYPE_NONE, set_movetype(), and SetMovedir().

◆ spawnfunc() [2/2]

spawnfunc ( trigger_conveyor )

Definition at line 106 of file conveyor.qc.

107{
108 SetMovedir(this);
110 conveyor_init(this);
111}
#define EXACTTRIGGER_INIT
Definition common.qh:116

References conveyor_init(), EXACTTRIGGER_INIT, and SetMovedir().