Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
disablerelay.qc File Reference
#include "disablerelay.qh"
Include dependency graph for disablerelay.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 spawnfunc (trigger_disablerelay)
void trigger_disablerelay_use (entity this, entity actor, entity trigger)

Function Documentation

◆ spawnfunc()

spawnfunc ( trigger_disablerelay )

Definition at line 28 of file disablerelay.qc.

29{
30 this.reset = spawnfunc_trigger_disablerelay; // this spawnfunc resets fully
31 this.active = ACTIVE_ACTIVE;
33}
#define use
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
void trigger_disablerelay_use(entity this, entity actor, entity trigger)

References active, ACTIVE_ACTIVE, trigger_disablerelay_use(), and use.

◆ trigger_disablerelay_use()

void trigger_disablerelay_use ( entity this,
entity actor,
entity trigger )

Definition at line 3 of file disablerelay.qc.

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}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const int ACTIVE_NOT
Definition defs.qh:36
#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
string targetname
Definition triggers.qh:56
string target
Definition triggers.qh:55

References active, ACTIVE_ACTIVE, ACTIVE_NOT, entity(), find(), ftos(), LOG_INFO, NULL, target, and targetname.

Referenced by spawnfunc().