]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/targettrigger.qc
spawnfunc and SendEntity3 have a 'this' parameter, use it
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / targettrigger.qc
1 spawnfunc(turret_targettrigger);
2 void turret_targettrigger_touch();
3
4 void turret_targettrigger_touch()
5 {SELFPARAM();
6     entity e;
7     if (self.cnt > time) return;
8     entity oldself = this;
9
10     e = find(world, targetname, self.target);
11     while (e)
12     {
13         if (e.turret_flags & TUR_FLAG_RECIEVETARGETS)
14         {
15             setself(e);
16             if(e.turret_addtarget)
17                 e.turret_addtarget(other,oldself);
18         }
19
20         e = find(e, targetname, oldself.target);
21     }
22
23     oldself.cnt = time + 0.5;
24
25     setself(this);
26 }
27
28 /*QUAKED turret_targettrigger (.5 .5 .5) ?
29 */
30 spawnfunc(turret_targettrigger)
31 {
32     if(!autocvar_g_turrets) { remove(this); return; }
33
34     WITHSELF(this, InitTrigger());
35
36     this.touch = turret_targettrigger_touch;
37 }