From: Freddy Date: Wed, 30 Aug 2017 21:28:20 +0000 (+0200) Subject: Add spawnflag that enables buttons to not accumulate damage X-Git-Tag: xonotic-v0.8.5~2429^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fca0b262506051bfd8d28547a7e9b54e43d9b18d;p=xonotic%2Fxonotic-data.pk3dir.git Add spawnflag that enables buttons to not accumulate damage --- diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index 8ded50d16..ddd62ae4e 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -94,11 +94,22 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage, if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - this.health = this.health - damage; - if (this.health <= 0) + if (this.spawnflags & BUTTON_DONTACCUMULATEDMG) { - this.enemy = attacker; - button_fire(this); + if (this.health <= damage) + { + this.enemy = attacker; + button_fire(this); + } + } + else + { + this.health = this.health - damage; + if (this.health <= 0) + { + this.enemy = attacker; + button_fire(this); + } } } diff --git a/qcsrc/common/triggers/func/button.qh b/qcsrc/common/triggers/func/button.qh index 6f70f09be..a7e0e8a26 100644 --- a/qcsrc/common/triggers/func/button.qh +++ b/qcsrc/common/triggers/func/button.qh @@ -1 +1,3 @@ #pragma once + +#define BUTTON_DONTACCUMULATEDMG 128