]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add spawnflag that enables buttons to not accumulate damage
authorFreddy <schro.sb@gmail.com>
Wed, 30 Aug 2017 21:28:20 +0000 (23:28 +0200)
committerFreddy <schro.sb@gmail.com>
Wed, 30 Aug 2017 21:28:20 +0000 (23:28 +0200)
qcsrc/common/triggers/func/button.qc
qcsrc/common/triggers/func/button.qh

index 8ded50d16b2da0d88a35c68eb333006786a15636..ddd62ae4e8f5f3ce5fc22b43d35086cc67d686ad 100644 (file)
@@ -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);
+               }
        }
 }
 
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..a7e0e8a262e78381975ef52789be9a20b2eb5262 100644 (file)
@@ -1 +1,3 @@
 #pragma once
+
+#define BUTTON_DONTACCUMULATEDMG 128