]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
trigger_heal: minor cleanup
authorFreddy <schro.sb@gmail.com>
Mon, 12 Mar 2018 15:02:55 +0000 (16:02 +0100)
committerFreddy <schro.sb@gmail.com>
Mon, 12 Mar 2018 15:02:55 +0000 (16:02 +0100)
qcsrc/common/triggers/spawnflags.qh
qcsrc/common/triggers/trigger/heal.qc

index eaf7914688c5546f961496619760539a5003de8d..711fdd1f4b97a7497ff98c1931ef2ea06f818778 100644 (file)
@@ -107,6 +107,9 @@ const int COUNTER_FIRE_AT_COUNT = BIT(2);
 const int GRAVITY_STICKY = BIT(0); // keep gravity multiplier even after exiting the trigger_gravity
 const int GRAVITY_START_DISABLED = BIT(1);
 
+// heal
+const int HEAL_SOUND_ALWAYS = BIT(2);
+
 //----------
 // SENDFLAGS
 //----------
index 0f5c69c777f65c0540a41de281622f4af56feb08..cfcd726fcdb8e02c4a8997cf1477b0556f1c54dd 100644 (file)
@@ -9,9 +9,7 @@ void trigger_heal_touch(entity this, entity toucher)
        // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
        if (toucher.iscreature)
        {
-               if (toucher.takedamage)
-               if (!IS_DEAD(toucher))
-               if (toucher.triggerhealtime < time)
+               if (toucher.takedamage && !IS_DEAD(toucher) && toucher.triggerhealtime < time)
                {
                        bool is_trigger = this.targetname == "";
                        if(is_trigger)
@@ -19,7 +17,7 @@ void trigger_heal_touch(entity this, entity toucher)
                        if(this.delay > 0)
                                toucher.triggerhealtime = time + this.delay;
 
-                       bool playthesound = (this.spawnflags & 4);
+                       bool playthesound = (this.spawnflags & HEAL_SOUND_ALWAYS);
                        if (toucher.health < this.max_health)
                        {
                                playthesound = true;