]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/trigger/heal.qc
Fix (de)activation of func_button
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / trigger / heal.qc
index 6d68610b5cf8ddb5afb7c2101a0b3ffacdb83f5b..e7b309062848d0fe673b8d797f4039512f292372 100644 (file)
@@ -1,42 +1,43 @@
+#include "heal.qh"
 #ifdef SVQC
 .float triggerhealtime;
-void trigger_heal_touch()
+void trigger_heal_touch(entity this, entity toucher)
 {
-       if (self.active != ACTIVE_ACTIVE)
+       if (this.active != ACTIVE_ACTIVE)
                return;
 
        // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
-       if (other.iscreature)
+       if (toucher.iscreature)
        {
-               if (other.takedamage)
-               if (!other.deadflag)
-               if (other.triggerhealtime < time)
+               if (toucher.takedamage)
+               if (!IS_DEAD(toucher))
+               if (toucher.triggerhealtime < time)
                {
-                       EXACTTRIGGER_TOUCH;
-                       other.triggerhealtime = time + 1;
+                       EXACTTRIGGER_TOUCH(this, toucher);
+                       toucher.triggerhealtime = time + 1;
 
-                       if (other.health < self.max_health)
+                       if (toucher.health < this.max_health)
                        {
-                               other.health = min(other.health + self.health, self.max_health);
-                               other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
-                               sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+                               toucher.health = min(toucher.health + this.health, this.max_health);
+                               toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
+                               _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
                        }
                }
        }
 }
 
-void spawnfunc_trigger_heal()
+spawnfunc(trigger_heal)
 {
-       self.active = ACTIVE_ACTIVE;
+       this.active = ACTIVE_ACTIVE;
 
        EXACTTRIGGER_INIT;
-       self.touch = trigger_heal_touch;
-       if (!self.health)
-               self.health = 10;
-       if (!self.max_health)
-               self.max_health = 200; //Max health topoff for field
-       if(self.noise == "")
-               self.noise = "misc/mediumhealth.wav";
-       precache_sound(self.noise);
+       settouch(this, trigger_heal_touch);
+       if (!this.health)
+               this.health = 10;
+       if (!this.max_health)
+               this.max_health = 200; //Max health topoff for field
+       if(this.noise == "")
+               this.noise = "misc/mediumhealth.wav";
+       precache_sound(this.noise);
 }
 #endif