]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/trigger/disablerelay.qc
Merge branch 'master' into TimePath/global_self
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / disablerelay.qc
1 #ifdef SVQC
2 void trigger_disablerelay_use()
3 {SELFPARAM();
4         entity e;
5
6         float a, b;
7         a = b = 0;
8
9         for(e = world; (e = find(e, targetname, self.target)); )
10         {
11                 if(e.use == SUB_UseTargets)
12                 {
13                         e.use = SUB_DontUseTargets;
14                         ++a;
15                 }
16                 else if(e.use == SUB_DontUseTargets)
17                 {
18                         e.use = SUB_UseTargets;
19                         ++b;
20                 }
21         }
22
23         if((!a) == (!b))
24                 LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!\n");
25 }
26
27 void spawnfunc_trigger_disablerelay()
28 {SELFPARAM();
29         self.use = trigger_disablerelay_use;
30 }
31 #endif