Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
disablerelay.qc
Go to the documentation of this file.
1#include "disablerelay.qh"
2#ifdef SVQC
3void 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
28spawnfunc(trigger_disablerelay)
29{
30 this.reset = spawnfunc_trigger_disablerelay; // this spawnfunc resets fully
31 this.active = ACTIVE_ACTIVE;
33}
34#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define use
const int ACTIVE_NOT
Definition defs.qh:36
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
void trigger_disablerelay_use(entity this, entity actor, entity trigger)
#define LOG_INFO(...)
Definition log.qh:65
entity find(entity start,.string field, string match)
string ftos(float f)
#define NULL
Definition post.qh:14
#define spawnfunc(id)
Definition spawnfunc.qh:96
string targetname
Definition triggers.qh:56
string target
Definition triggers.qh:55