Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
monoflop.qc
Go to the documentation of this file.
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*/
6void 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}
15void 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
26{
27 this.state = 0;
28 SUB_UseTargets(this, this.enemy, NULL);
29}
30
32{
33 this.state = 0;
34 this.nextthink = 0;
35}
36
37spawnfunc(trigger_monoflop)
38{
39 if(!this.wait)
40 this.wait = 1;
41 if(this.spawnflags & MONOFLOP_FIXED)
43 else
44 this.use = monoflop_use;
46 this.state = 0;
47 this.reset = monoflop_reset;
48}
49#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float wait
Definition items.qc:17
int spawnflags
Definition ammo.qh:15
float time
float nextthink
#define use
int state
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
void monoflop_reset(entity this)
Definition monoflop.qc:31
void monoflop_think(entity this)
Definition monoflop.qc:25
void monoflop_use(entity this, entity actor, entity trigger)
Definition monoflop.qc:6
void monoflop_fixed_use(entity this, entity actor, entity trigger)
Definition monoflop.qc:15
const int MONOFLOP_FIXED
Definition monoflop.qh:4
#define NULL
Definition post.qh:14
#define setthink(e, f)
#define spawnfunc(id)
Definition spawnfunc.qh:96
entity enemy
Definition sv_ctf.qh:153