]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow deactivating trigger_relay_if, trigger_relay_teamcheck and trigger_disablerelay...
authorMario <mario.mario@y7mail.com>
Mon, 18 May 2020 09:38:41 +0000 (19:38 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 18 May 2020 09:38:41 +0000 (19:38 +1000)
qcsrc/common/mapobjects/trigger/disablerelay.qc
qcsrc/common/mapobjects/trigger/relay_if.qc
qcsrc/common/mapobjects/trigger/relay_teamcheck.qc

index eee61c993535f063b5ba30eeccdd6db3550b0273..dde1a77c73aeb1a18568da54de88c600107ff70d 100644 (file)
@@ -2,18 +2,21 @@
 #ifdef SVQC
 void trigger_disablerelay_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
        int a = 0, b = 0;
 
        for(entity e = NULL; (e = find(e, targetname, this.target)); )
        {
-               if(e.use == SUB_UseTargets)
+               if(e.active == ACTIVE_ACTIVE)
                {
-                       e.use = SUB_DontUseTargets;
+                       e.active = ACTIVE_NOT;
                        ++a;
                }
-               else if(e.use == SUB_DontUseTargets)
+               else if(e.active == ACTIVE_NOT)
                {
-                       e.use = SUB_UseTargets;
+                       e.active = ACTIVE_ACTIVE;
                        ++b;
                }
        }
@@ -24,6 +27,8 @@ void trigger_disablerelay_use(entity this, entity actor, entity trigger)
 
 spawnfunc(trigger_disablerelay)
 {
+       this.reset = spawnfunc_trigger_disablerelay; // this spawnfunc resets fully
+       this.active = ACTIVE_ACTIVE;
        this.use = trigger_disablerelay_use;
 }
 #endif
index 9adcd666ecc7ab3e73a8416ddfd118c869adce91..7586bd338428ef644cef1f060ff3db537b630ac2 100644 (file)
@@ -2,6 +2,9 @@
 #ifdef SVQC
 void trigger_relay_if_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
        int n = this.count;
 
        // TODO make this generic AND faster than nextent()ing through all, if somehow possible
@@ -15,6 +18,8 @@ void trigger_relay_if_use(entity this, entity actor, entity trigger)
 
 spawnfunc(trigger_relay_if)
 {
+       this.reset = spawnfunc_trigger_relay_if; // this spawnfunc resets fully
+       this.active = ACTIVE_ACTIVE;
        this.use = trigger_relay_if_use;
 }
 #endif
index bf03b1542f0f957279c80f8f81ed1dbb891c0eaa..5291f529062b8dd57bfbcaa5d9beaa4342b0cf2b 100644 (file)
@@ -2,6 +2,9 @@
 #ifdef SVQC
 void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
        if(actor.team)
        {
                if(this.spawnflags & RELAYTEAMCHECK_INVERT)
@@ -24,11 +27,13 @@ void trigger_relay_teamcheck_use(entity this, entity actor, entity trigger)
 
 void trigger_relay_teamcheck_reset(entity this)
 {
+       this.active = ACTIVE_ACTIVE;
        this.team = this.team_saved;
 }
 
 spawnfunc(trigger_relay_teamcheck)
 {
+       this.active = ACTIVE_ACTIVE;
        this.team_saved = this.team;
        IL_PUSH(g_saved_team, this);
        this.use = trigger_relay_teamcheck_use;