]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix button not resetting, and allow wait time < 0 to mean never return
authorMario <mario@smbclan.net>
Sun, 27 Aug 2017 22:21:29 +0000 (08:21 +1000)
committerMario <mario@smbclan.net>
Sun, 27 Aug 2017 22:21:29 +0000 (08:21 +1000)
qcsrc/common/triggers/func/button.qc

index 3c7d47fea4e005962ef0012199a09c0ead36701b..8ded50d16b2da0d88a35c68eb333006786a15636 100644 (file)
@@ -8,8 +8,11 @@ void button_return(entity this);
 void button_wait(entity this)
 {
        this.state = STATE_TOP;
-       this.nextthink = this.ltime + this.wait;
-       setthink(this, button_return);
+       if(this.wait >= 0)
+       {
+               this.nextthink = this.ltime + this.wait;
+               setthink(this, button_return);
+       }
        SUB_UseTargets(this, this.enemy, NULL);
        this.frame = 1;                 // use alternate textures
 }
@@ -56,6 +59,9 @@ void button_reset(entity this)
        setorigin(this, this.pos1);
        this.frame = 0;                 // use normal textures
        this.state = STATE_BOTTOM;
+       this.velocity = '0 0 0';
+       setthink(this, func_null);
+       this.nextthink = 0;
        if (this.health)
                this.takedamage = DAMAGE_YES;   // can be shot again
 }
@@ -150,6 +156,8 @@ spawnfunc(func_button)
        this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
     this.flags |= FL_NOTARGET;
 
+    this.reset = button_reset;
+
        button_reset(this);
 }
 #endif