]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/targettrigger.qc
152a7d6a2715e362fde40fca3be8f20497ccc511
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / targettrigger.qc
1 #include "targettrigger.qh"
2 spawnfunc(turret_targettrigger);
3 void turret_targettrigger_touch(entity this, entity toucher);
4
5 void turret_targettrigger_touch(entity this, entity toucher)
6 {
7     if (this.cnt > time) return;
8     IL_EACH(g_turrets, it.targetname == this.target,
9     {
10         if (!(it.turret_flags & TUR_FLAG_RECIEVETARGETS)) continue;
11         if (!it.turret_addtarget) continue;
12         it.turret_addtarget(it, toucher, this);
13     });
14     this.cnt = time + 0.5;
15 }
16
17 /*QUAKED turret_targettrigger (.5 .5 .5) ?
18 */
19 spawnfunc(turret_targettrigger)
20 {
21     if(!autocvar_g_turrets) { delete(this); return; }
22
23     InitTrigger(this);
24
25     settouch(this, turret_targettrigger_touch);
26 }