]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Properly handle .active state for func_button
authorFreddy <schro.sb@gmail.com>
Thu, 7 Sep 2017 14:54:02 +0000 (16:54 +0200)
committerFreddy <schro.sb@gmail.com>
Thu, 7 Sep 2017 14:57:29 +0000 (16:57 +0200)
qcsrc/common/triggers/func/button.qc

index 8ded50d16b2da0d88a35c68eb333006786a15636..8c157d93cc96a30da31e695dd975e5acf467db3e 100644 (file)
@@ -24,6 +24,12 @@ void button_done(entity this)
 
 void button_return(entity this)
 {
+       if (this.active != ACTIVE_ACTIVE)
+       {
+               this.nextthink = this.ltime + frametime;
+               setthink(this, button_return);
+               return;
+       }
        this.state = STATE_DOWN;
        SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, button_done);
        this.frame = 0;                 // use normal textures
@@ -77,6 +83,8 @@ void button_use(entity this, entity actor, entity trigger)
 
 void button_touch(entity this, entity toucher)
 {
+       if (this.active != ACTIVE_ACTIVE)
+               return;
        if (!toucher)
                return;
        if (!toucher.iscreature)
@@ -91,6 +99,8 @@ void button_touch(entity this, entity toucher)
 
 void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
+       if (this.active != ACTIVE_ACTIVE)
+               return;
        if(this.spawnflags & DOOR_NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;