From: Mario Date: Sun, 27 Aug 2017 22:21:29 +0000 (+1000) Subject: Fix button not resetting, and allow wait time < 0 to mean never return X-Git-Tag: xonotic-v0.8.5~2495 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=be02942e46447afd1ec51aff81478fbccc936880;p=xonotic%2Fxonotic-data.pk3dir.git Fix button not resetting, and allow wait time < 0 to mean never return --- diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 3c7d47fea..8ded50d16 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -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