From c2f945d94771cf7e144563d35fc470816cafb87b Mon Sep 17 00:00:00 2001 From: Freddy Date: Mon, 12 Mar 2018 16:02:55 +0100 Subject: [PATCH] trigger_heal: minor cleanup --- qcsrc/common/triggers/spawnflags.qh | 3 +++ qcsrc/common/triggers/trigger/heal.qc | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qcsrc/common/triggers/spawnflags.qh b/qcsrc/common/triggers/spawnflags.qh index eaf791468..711fdd1f4 100644 --- a/qcsrc/common/triggers/spawnflags.qh +++ b/qcsrc/common/triggers/spawnflags.qh @@ -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 //---------- diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 0f5c69c77..cfcd726fc 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -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; -- 2.39.2