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