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