From be02942e46447afd1ec51aff81478fbccc936880 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 28 Aug 2017 08:21:29 +1000 Subject: [PATCH 1/1] Fix button not resetting, and allow wait time < 0 to mean never return --- qcsrc/common/triggers/func/button.qc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.2