Xonotic
relay_activators.qc
Go to the documentation of this file.
1 #include "relay_activators.qh"
2 
3 #ifdef SVQC
4 void relay_activators_use(entity this, entity actor, entity trigger)
5 {
6  if(this.active != ACTIVE_ACTIVE)
7  return;
8 
9  for(entity trg = NULL; (trg = find(trg, targetname, this.target)); )
10  {
11  if (trg.setactive)
12  trg.setactive(trg, this.cnt);
13  else
14  {
15  //bprint("Not using setactive\n");
16  generic_setactive(trg, this.cnt);
17  }
18  }
19 }
20 
21 void relay_activators_init(entity this)
22 {
23  this.reset = relay_activators_init; // doubles as a reset function
24  this.active = ACTIVE_ACTIVE;
25  this.use = relay_activators_use;
26 }
27 
28 spawnfunc(relay_activate)
29 {
30  this.cnt = ACTIVE_ACTIVE;
31  relay_activators_init(this);
32 }
33 
34 spawnfunc(relay_deactivate)
35 {
36  this.cnt = ACTIVE_NOT;
37  relay_activators_init(this);
38 }
39 
40 spawnfunc(relay_activatetoggle)
41 {
42  this.cnt = ACTIVE_TOGGLE;
43  relay_activators_init(this);
44 }
45 #endif
const int ACTIVE_TOGGLE
Definition: defs.qh:40
entity() spawn
spawnfunc(info_player_attacker)
Definition: sv_assault.qc:283
float cnt
Definition: powerups.qc:24
const int ACTIVE_ACTIVE
Definition: defs.qh:37
#define NULL
Definition: post.qh:17
string targetname
Definition: progsdefs.qc:194
int active
Definition: defs.qh:34
#define use
Definition: csprogsdefs.qh:50
string target
Definition: progsdefs.qc:193
const int ACTIVE_NOT
Definition: defs.qh:36