]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mapobjects/trigger/relay_teamcheck.qc
217c0e4b02e86945d279249f399b5b15cd204833
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / trigger / relay_teamcheck.qc
1 #include "relay_teamcheck.qh"
2
3 #ifdef SVQC
4 void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger)
5 {
6         if(this.active != ACTIVE_ACTIVE)
7                 return;
8
9         if(actor.team)
10         {
11                 if(this.spawnflags & RELAYTEAMCHECK_INVERT)
12                 {
13                         if(DIFF_TEAM(actor, this))
14                                 SUB_UseTargets(this, actor, trigger);
15                 }
16                 else
17                 {
18                         if(SAME_TEAM(actor, this))
19                                 SUB_UseTargets(this, actor, trigger);
20                 }
21         }
22         else
23         {
24                 if(this.spawnflags & RELAYTEAMCHECK_NOTEAM)
25                         SUB_UseTargets(this, actor, trigger);
26         }
27 }
28
29 void trigger_relay_teamcheck_reset(entity this)
30 {
31         this.active = ACTIVE_ACTIVE;
32         this.team = this.team_saved;
33 }
34
35 spawnfunc(trigger_relay_teamcheck)
36 {
37         this.active = ACTIVE_ACTIVE;
38         this.team_saved = this.team;
39         IL_PUSH(g_saved_team, this);
40         this.use = trigger_relay_teamcheck_use;
41         this.reset = trigger_relay_teamcheck_reset;
42 }
43 #endif