Xonotic
disablerelay.qc
Go to the documentation of this file.
1
#include "
disablerelay.qh
"
2
#ifdef SVQC
3
void
trigger_disablerelay_use(
entity
this
,
entity
actor,
entity
trigger)
4
{
5
if
(this.
active
!=
ACTIVE_ACTIVE
)
6
return
;
7
8
int
a = 0, b = 0;
9
10
for
(
entity
e =
NULL
; (e =
find
(e,
targetname
, this.
target
)); )
11
{
12
if
(e.active ==
ACTIVE_ACTIVE
)
13
{
14
e.active =
ACTIVE_NOT
;
15
++a;
16
}
17
else
if
(e.active ==
ACTIVE_NOT
)
18
{
19
e.active =
ACTIVE_ACTIVE
;
20
++b;
21
}
22
}
23
24
if
((!a) == (!b))
25
LOG_INFO
(
"Invalid use of trigger_disablerelay: "
,
ftos
(a),
" relays were on, "
,
ftos
(b),
" relays were off!"
);
26
}
27
28
spawnfunc
(trigger_disablerelay)
29
{
30
this.reset = spawnfunc_trigger_disablerelay;
// this spawnfunc resets fully
31
this.
active
=
ACTIVE_ACTIVE
;
32
this.
use
= trigger_disablerelay_use;
33
}
34
#endif
ftos
string ftos(float f)
entity
entity() spawn
spawnfunc
spawnfunc(info_player_attacker)
Definition:
sv_assault.qc:283
disablerelay.qh
ACTIVE_ACTIVE
const int ACTIVE_ACTIVE
Definition:
defs.qh:37
NULL
#define NULL
Definition:
post.qh:17
LOG_INFO
#define LOG_INFO(...)
Definition:
log.qh:70
find
entity find(entity start,.string field, string match)
targetname
string targetname
Definition:
progsdefs.qc:194
active
int active
Definition:
defs.qh:34
use
#define use
Definition:
csprogsdefs.qh:50
target
string target
Definition:
progsdefs.qc:193
ACTIVE_NOT
const int ACTIVE_NOT
Definition:
defs.qh:36
common
mapobjects
trigger
disablerelay.qc
Generated on Thu Mar 17 2022 17:26:27 for Xonotic by
1.8.13