Xonotic
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
*/
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
state
float state
Definition:
subs.qh:32
entity
entity() spawn
SUB_UseTargets
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition:
triggers.qc:366
spawnfunc
spawnfunc(info_player_attacker)
Definition:
sv_assault.qc:283
spawnflags
float spawnflags
Definition:
progsdefs.qc:191
enemy
entity enemy
Definition:
sv_ctf.qh:143
wait
float wait
Definition:
subs.qh:39
NULL
#define NULL
Definition:
post.qh:17
monoflop.qh
nextthink
float nextthink
Definition:
csprogsdefs.qc:121
MONOFLOP_FIXED
const int MONOFLOP_FIXED
Definition:
monoflop.qh:4
setthink
#define setthink(e, f)
use
#define use
Definition:
csprogsdefs.qh:50
time
float time
Definition:
csprogsdefs.qc:16
common
mapobjects
trigger
monoflop.qc
Generated on Thu Mar 17 2022 17:26:28 for Xonotic by
1.8.13