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 eee61c9..dde1a77 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 9adcd66..7586bd3 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 bf03b15..5291f52 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;