]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/checkpoint.qc
Merge branch 'master' into Mario/entcs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / checkpoint.qc
1 #include "checkpoint.qh"
2 /**
3     turret_checkpoint
4 **/
5
6
7 //.entity checkpoint_target;
8
9 /*
10 #define checkpoint_cache_who  flagcarried
11 #define checkpoint_cache_from lastrocket
12 #define checkpoint_cache_to   selected_player
13 */
14
15 .entity pathgoal;
16
17 /*
18 entity path_makeorcache(entity forwho,entity start, entity end)
19 {
20     entity pth;
21
22     //pth = pathlib_makepath(forwho, start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR);
23
24     return pth;
25 }
26 */
27
28 void turret_checkpoint_use()
29 {
30 }
31
32 #if 0
33 void turret_checkpoint_think(entity this)
34 {
35     if(this.enemy)
36         te_lightning1(this,this.origin, this.enemy.origin);
37
38     this.nextthink = time + 0.25;
39 }
40 #endif
41 /*QUAKED turret_checkpoint (1 0 1) (-32 -32 -32) (32 32 32)
42 -----------KEYS------------
43 target: .targetname of next waypoint in chain.
44 wait:   Pause at this point # seconds.
45 -----------SPAWNFLAGS-----------
46 ---------NOTES----------
47 If a loop is of targets are formed, any unit entering this loop will patrol it indefinitly.
48 If the checkpoint chain in not looped, the unit will go "Roaming" when the last point is reached.
49 */
50 //float tc_acum;
51 void turret_checkpoint_init(entity this)
52 {
53     traceline(this.origin + '0 0 16', this.origin - '0 0 1024', MOVE_WORLDONLY, this);
54     setorigin(this, trace_endpos + '0 0 32');
55
56     if(this.target != "")
57     {
58         this.enemy = find(NULL, targetname, this.target);
59         if(this.enemy == NULL)
60             LOG_TRACE("A turret_checkpoint faild to find its target!");
61     }
62     //setthink(this, turret_checkpoint_think);
63     //this.nextthink = time + tc_acum + 0.25;
64     //tc_acum += 0.25;
65 }
66
67 spawnfunc(turret_checkpoint)
68 {
69     setorigin(this, this.origin);
70     setthink(this, turret_checkpoint_init);
71     this.nextthink = time + 0.2;
72 }
73
74 // Compat.
75 spawnfunc(walker_checkpoint)
76 {
77     this.classname = "turret_checkpoint";
78     spawnfunc_turret_checkpoint(this);
79 }