]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Ensure trigger_flipflop starts disabled upon reset, also allow flipflop triggers...
authorMario <mario.mario@y7mail.com>
Fri, 31 Jul 2020 09:50:35 +0000 (19:50 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 31 Jul 2020 09:50:35 +0000 (19:50 +1000)
qcsrc/common/mapobjects/trigger/flipflop.qc

index 141f3ea9f19e513dcad6aeaa07e304efaec9dea8..84c4dd9357af639dd482b7d9a66a4bd55aefb560 100644 (file)
@@ -1,10 +1,14 @@
 #include "flipflop.qh"
+
 #ifdef SVQC
 /*QUAKED spawnfunc_trigger_flipflop (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ENABLED
 "Flip-flop" trigger gate... lets only every second trigger event through
 */
 void flipflop_use(entity this, entity actor, entity trigger)
 {
+       if(this.active != ACTIVE_ACTIVE)
+               return;
+
     this.state = !this.state;
     if(this.state)
         SUB_UseTargets(this, actor, trigger);
@@ -12,12 +16,9 @@ void flipflop_use(entity this, entity actor, entity trigger)
 
 spawnfunc(trigger_flipflop)
 {
-    if(this.spawnflags & START_ENABLED)
-    {
-        this.state = true;
-    }
+       this.active = ACTIVE_ACTIVE;
+    this.state = (this.spawnflags & START_ENABLED);
     this.use = flipflop_use;
     this.reset = spawnfunc_trigger_flipflop; // perfect resetter
 }
-
 #endif