]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/trigger/monoflop.qc
Remove SELFPARAM() from .think and .touch
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / monoflop.qc
1 #ifdef SVQC
2 /*QUAKED spawnfunc_trigger_monoflop (.5 .5 .5) (-8 -8 -8) (8 8 8)
3 "Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait"
4 */
5 void monoflop_use(entity this, entity actor, entity trigger)
6 {
7         this.nextthink = time + this.wait;
8         this.enemy = actor;
9         if(this.state)
10                 return;
11         this.state = 1;
12         SUB_UseTargets(this, actor, trigger);
13 }
14 void monoflop_fixed_use(entity this, entity actor, entity trigger)
15 {
16         if(this.state)
17                 return;
18         this.nextthink = time + this.wait;
19         this.state = 1;
20         this.enemy = actor;
21         SUB_UseTargets(this, actor, trigger);
22 }
23
24 void monoflop_think(entity this)
25 {
26         this.state = 0;
27         SUB_UseTargets(this, this.enemy, NULL);
28 }
29
30 void monoflop_reset(entity this)
31 {
32         this.state = 0;
33         this.nextthink = 0;
34 }
35
36 spawnfunc(trigger_monoflop)
37 {
38         if(!this.wait)
39                 this.wait = 1;
40         if(this.spawnflags & 1)
41                 this.use = monoflop_fixed_use;
42         else
43                 this.use = monoflop_use;
44         setthink(this, monoflop_think);
45         this.state = 0;
46         this.reset = monoflop_reset;
47 }
48 #endif