Xonotic
checkpoint.qc
Go to the documentation of this file.
1 #include "checkpoint.qh"
2 
3 #ifdef SVQC
4 
5 /*QUAKED turret_checkpoint (1 0 1) (-32 -32 -32) (32 32 32)
6 -----------KEYS------------
7 target: .targetname of next waypoint in chain.
8 wait: Pause at this point # seconds.
9 -----------SPAWNFLAGS-----------
10 ---------NOTES----------
11 If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly.
12 If the checkpoint chain is not looped, the unit will go "Roaming" when the last point is reached.
13 */
14 void turret_checkpoint_init(entity this)
15 {
16  traceline(this.origin + '0 0 16', this.origin - '0 0 1024', MOVE_WORLDONLY, this);
17  setorigin(this, trace_endpos + '0 0 32');
18 
19  if(this.target && this.target != "")
20  {
21  this.enemy = find(NULL, targetname, this.target);
22  if(!this.enemy)
23  LOG_TRACE("A turret_checkpoint failed to find its target!");
24  }
25 }
26 
27 spawnfunc(turret_checkpoint)
28 {
29  setorigin(this, this.origin);
30  InitializeEntity(this, turret_checkpoint_init, INITPRIO_FINDTARGET);
31 }
32 
33 // Compat.
34 spawnfunc(walker_checkpoint)
35 {
36  spawnfunc_turret_checkpoint(this);
37 }
38 
39 #endif
entity() spawn
spawnfunc(info_player_attacker)
Definition: sv_assault.qc:283
origin
Definition: ent_cs.qc:114
entity enemy
Definition: sv_ctf.qh:143
#define NULL
Definition: post.qh:17
vector trace_endpos
Definition: csprogsdefs.qc:37
void InitializeEntity(entity e, void(entity this) func, int order)
Definition: world.qc:2146
#define LOG_TRACE(...)
Definition: log.qh:81
string targetname
Definition: progsdefs.qc:194
setorigin(ent, v)
string target
Definition: progsdefs.qc:193
float MOVE_WORLDONLY